boston-library / bpldc_authority_api

API for returning authority data and controlled values for BPLDC descriptive metadata
1 stars 0 forks source link

add new authorities: rdafmn & rdafnm #109

Closed ebenenglish closed 6 months ago

ebenenglish commented 6 months ago

For Trac #2109, we need to add two new authorities:

{ code: 'rdafmn', base_url: 'http://id.loc.gov/vocabulary/mmusnotation',
  name: 'Music Notation', genres: true },
{ code: 'rdafnm', base_url: 'http://id.loc.gov/vocabulary/mmusicformat',
  name: 'NOTATED MUSIC FORM', genres: true }

Need to:

ebenenglish commented 6 months ago

Documenting the process for adding a new authority:

bpldc_authority_api app

  1. From project home, run bin/rails db:seed
  2. From the rails console, run Bpldc::Authority.all.map(&:code).sort, confirm the new authority is there

curator_app

  1. From the rails console, run:
    
    auth_data = Curator::ControlledTerms::AuthorityService.call(path: 'authorities')
    auth_data&.each do |auth_input|
    Curator.controlled_terms.authority_class.transaction do
    begin
      Curator.controlled_terms.authority_class.where(auth_input).first_or_create!
    rescue StandardError => e
      puts "==== Failed to seed ControlledTerms::Authority with input #{auth_input.inspect} ===="
      puts e.inspect
    end
    end
    end

make sure new authority has been added:

Curator.controlled_terms.authority_class.all.map(&:code).sort