MODDATAIMP-669: Script to refresh Authorities against an updated MARC-Authority map

MODDATAIMP-669 - Getting issue details... STATUS

For any library storing MARC Authority records in Source Record Storage (SRS), FOLIO contains a default MARC-to-Authority map. FOLIO uses that map when creating or updating Inventory Authority with Source = MARC. The map identifies the Authority fields that are controlled by the underlying MARC Authority record, and which fields and subfields of MARC data populate into which Authority fields. Occasionally libraries may adjust their default map, either because of 1) updated default mappings delivered in a new FOLIO release or 2) local fields or mapping decisions that differ from the default map. When a library's default map is updated, those updated mappings will affect any Authorities created or updated after the map change. However, some libraries would like to update all of their existing Authorities to reflect the updated mappings. This script allows for that to happen. 




NOTE!!! This Authority update script may affect performance of other imports, so it needs to be used during non-working hours or during off-peak hours!!!

NOTE!!! This script will only work for Kiwi and later releases.



Before launching Script, you need to download jq library to allow script work:

https://stedolan.github.io/jq/download/


In order to run the script, you need:

  1. Open terminal (Mac OS or UNIX Systems) or Power shell (Windows) 
  2. Go to the folder where the script is located.
  3. Run Script with or without parameters:
    • e.g. for launch without parameters - sh UpdateMarcToAuthorityMapping.sh
    • e.g. for launch with parameters - sh UpdateMarcToAuthorityMapping.sh url tenant username password limit release
      Where:
      • url (your library okapi url) - can be seen in the app settings → software versions → okapi services → okapi

      • tenant (admin tenant)
      • username (admin user name)
      • password (admin user name password)
      • limit (number of authorities to parse where all sources are counted - FOLIO/MARC)
      • release (release version: 0 is for Kiwi, 1 is for Lotus and future releases)

After the script completes its work, it shows how long the script has been running and number of processed authorities:

Total count: 1, Total succeeded count: 1, Total error count: 0
0 hours, 0 minutes and 4 seconds elapsed.

Also, as a result you will get 2 files: offset.txt and results.txt

offset file only will contain OFFSET value (the position in the dataset to start from, where all sources are counted - FOLIO/MARC). Script starts with the offset value from file.

results file will contain all processed authority ids with update status in format (if the results are presented):

   authorityId - status (e.g. 708979eb-c732-4dfa-8f51-8176c9dea6bf - ok)



NOTE!!! This Authority update Postman collection may affect performance of other imports, so it needs to be used during non-working hours or during off-peak hours!!!

NOTE!!! This Postman collection will only work for Kiwi and later releases.

NOTE!!! Postman collection can handle only about 1500 requests.


Before launching Postman collection, set up the environment:

  • Click on "eye" button and press "Edit/Add" on "Environment" variables
  • Name the environment and configure these mandatory variables:
    • protocol (http/https)
    • url (your library okapi url) - can be seen in the app settings → software versions → okapi services → okapi

    • username (admin user name)
    • password (admin user name password)
    • xokapitenant (admin tenant).
  • There is also an optional parameter "limit" to limit number of authorities to parse. Both sources are counted (FOLIO/MARC), but only MARC source types will be processed.
  • After setting up all the environment variables press "Reset all" and then "Save"
  1. Import collection by pressing "Import" button 
  2. Select collection file (Update MARC to Authority map.postman_collection.json) file from folder or drag it into open window and then press "Import" button.
  3. Go to the "Collections" tab and select "Update MARC to Authority map"
  4. Then select environment you'd set up
  5. To launch collection press "Run" button below environment selection and in the opened window press "Run Update MARC to Authority map"