Skip to content

Instantly share code, notes, and snippets.

View ebenenglish's full-sized avatar

Eben English ebenenglish

  • Boston Public Library
View GitHub Profile
@ebenenglish
ebenenglish / Newspaper-Models-Acceptance-Testing.md
Last active January 30, 2018 15:28
Newspaper models acceptance testing criteria.

Newspaper Models Acceptance Testing

(For the sake of brevity, not all classes and metadata fields appear in the console examples.)

Classes ✅

There should be 6 classes:

  • NewspaperTitle (PCDM Object)
  • NewspaperContainer (PCDM Object)
  • NewspaperIssue (PCDM Object)
  • NewspaperPage (PCDM FileSet)
@ebenenglish
ebenenglish / word-coord-json-parse-test.md
Created March 7, 2018 21:21
compares performance of parsing word-coordinate data in different JSON source formats

Overview

For each of these JSON word-coordinate file formats of the same OCR word-coordinate data, representing a single newspaper page:

  1. Open-ONI (58.9 kB)
  2. IIIF Annotation List (826.4 kB)

I ran a test in the Rails console, benchmarking the time needed to:

  1. load the source file into memory
  2. parse as JSON
  3. find nodes matching a search term ("October")
@ebenenglish
ebenenglish / nblmc-collections-range-limit.scss
Created December 15, 2020 19:13
CSS for range limit styles found at collections.leventhalmap.org
.range_limit {
.form-control {
&.range_begin,
&.range_end {
width: 60px;
}
}
}
@ebenenglish
ebenenglish / preservica_rest_api_to_oai.rb
Created August 19, 2021 18:18
A set of scripts to query the Preservica REST API and create an OAI-PMH response XML file
# create a static OAI XML file with all records
# @param sets [Array] collection ids, e.g. ['c1ee8010-fb87-40d6-ac23-be547344c4f2', '2000d071-a976-4536-b173-8772a11c3588', ...]
# @param units_to_ignore [Array] ids of objects to ignore
# @param file_path [String] location where static XML file should be written
# @param credentials [Hash] Preservica REST API credentials: {un: 'foo', pw: 'bar'}
def generate_static_oai_xml(sets, units_to_ignore, file_path, credentials)
@oai_doc = initialize_oai_xml
@units_to_ignore = units_to_ignore
@preservica_rest_api_base = 'https://us.preservica.com/api/entity'
@ebenenglish
ebenenglish / bpl-mapportal_development-guide.md
Last active August 7, 2025 13:53
bpl-mapportal development guide

bpl-mapportal development guide

The goal of this project is to update the major dependencies for an existing Rails application currently in production.

This application is a digital library interface that provides access to historical maps from the Norman B. Leventhal Map & Education Center at the Boston Public Library. The application allows users to search the collection, view image content, download high-resolution files, sign up for an account, and create lists of favorite items, as well as other features.

URL: https://collections.leventhalmap.org/

Code: https://github.com/boston-library/bpl-mapportal/tree/develop/src/portal (private repo)

@ebenenglish
ebenenglish / digital-commonwealth_metadata-field-guide.md
Created September 23, 2025 15:44
A list of important metadata fields for metadata records in the Digital Commonwealth repository.

Digital Commonwealth metadata field guide

A list of important metadata fields for metadata records in the Digital Commonwealth repository.

See SolrDocument field reference: public API for a full list of available fields.

See the Digital Commonwealth API Guide for information on how to access metadata records.

Field names ending in "m" are multivalued.

@ebenenglish
ebenenglish / ndnp_issue_date_change.rb
Created May 20, 2026 16:10
Change the publication date in all issue-level files, and update directory names. Note: This does NOT update BATCH.xml
# run like so: ndnp_datefix('sn83020531/1414039/1801012101', '1801-01-22', '/absolute/path/to/batch_mb_23_01_0041')
def ndnp_datefix(bad_date_path, good_date, batch_home_path)
path_to_bad_issue = "#{batch_home_path}/#{bad_date_path}"
bad_date_raw = bad_date_path.split('/').last[0..7]
bad_date_w3c = [bad_date_raw[0..3], bad_date_raw[4..5], bad_date_raw[6..7]].join('-')
path_to_bad_issue_xml = "#{path_to_bad_issue}/#{bad_date_path.split('/').last}"
path_to_good_issue_xml = "#{path_to_bad_issue}/#{good_date.gsub('-', '')}#{bad_date_path.split('/').last[-2..-1]}"
# have to run string replacement separately for each file type, using *.{pdf,jp2,xml} not working