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 / 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 / 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 / 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 / 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)