sul-dlss / dor-services-app

A Rails application exposing Digital Object Registry functions as a RESTful HTTP API
https://sul-dlss.github.io/dor-services-app/
Other
3 stars 2 forks source link

Research: Identifying location for objects with coordinate library MARC records #4422

Closed arcadiafalcone closed 1 year ago

arcadiafalcone commented 1 year ago

Provisional based on finalization of decision to include coordinate-specific locations in FOLIO holdings record

When an 856 with second indicator 0 is present in a MARC record in FOLIO, an inventory holdings record is generated. Current plan is to include the coordinate library location (Law, Business, Hoover, but not Lane) in the holdings record for SDR objects. Therefore, when adding a new purl 856 to a FOLIO MARC record and generating a holdings record, it needs to be known whether the MARC record is associated with one of these three libraries. Would it be possible/feasible to add this location info to the object Cocina in Argo?

justinlittman commented 1 year ago

Do you have a sense about where in the Cocina this should go?

arcadiafalcone commented 1 year ago

Action summary: Get the coordinate library location from the existing holdings record(s) when creating the SDR holdings record. No need to store anything in Cocina.

Tasks:

  1. When creating a SDR holdings record, get permanent location codes from existing holdings record(s) associated with the instance record. If there are multiple holdings, get all codes.[1]
  2. Map location codes to SDR coordinate library location terms based on beginning of code (BUS = Business SDR, HILA = HILA SDR, LAW = Law SDR). If no location codes match, use default location for the SDR holdings record. If location codes for multiple different coordinate libraries match, report as an error.
  3. In cases where the object is electronic only and there is no existing holdings record for the physical item, expect a cataloger to create the holdings record with the appropriate location at the same time as the instance record.

[1] Consult with Alissa on using location codes vs terms in FOLIO. Either is acceptable, but the codes seem to be easier to match on.

lwrubel commented 1 year ago
  1. Use the folio_instance_hrid to request holdings records attached to the instance:

/inventory-view/instance-set?limit=1&holdingsRecords=true&query=hrid==#{folio_instance_hrid}"

API documentation: https://s3.amazonaws.com/foliodocs/api/mod-inventory-storage/p/instance-set.html Example response:

{'instanceSets': [{'id': 'e43be071-1444-53e5-9894-ed9bed97a34f',
   'holdingsRecords': [{'id': 'edfd54d2-a196-5f6e-ae47-d451641f7fc5',
     'hrid': 'ah13412279_3',
     'notes': [],
     '_version': 1,
     'metadata': {'createdDate': '2023-02-14T03:13:22.541Z',
      'updatedDate': '2023-02-14T03:13:22.541Z',
      'createdByUserId': '3e2ed889-52f2-45ce-8a30-8767266f07d2',
      'updatedByUserId': '3e2ed889-52f2-45ce-8a30-8767266f07d2'},
     'sourceId': 'f32d531e-df79-46b3-8932-cdd35f7a2264',
     'formerIds': ['a13412279'],
     'instanceId': 'e43be071-1444-53e5-9894-ed9bed97a34f',
     'holdingsItems': [],
     'holdingsTypeId': '996f93e2-5b5e-4cf2-9168-33ced1f95eed',
     'electronicAccess': [],
     'bareHoldingsItems': [],
     'holdingsStatements': [],
     'statisticalCodeIds': [],
     'administrativeNotes': [],
     'effectiveLocationId': '1b14e21c-8d47-45c7-bc49-456a0086422b',
     'permanentLocationId': '1b14e21c-8d47-45c7-bc49-456a0086422b',
     'holdingsStatementsForIndexes': [],
     'holdingsStatementsForSupplements': []},
    {'id': 'b5a77738-04a0-521d-8784-6dfc5f05656a',
     'hrid': 'ah13412279_1',
     'notes': [],
     '_version': 1,
     'metadata': {'createdDate': '2023-02-14T03:14:25.271Z',
      'updatedDate': '2023-02-14T03:14:25.271Z',
      'createdByUserId': '3e2ed889-52f2-45ce-8a30-8767266f07d2',
      'updatedByUserId': '3e2ed889-52f2-45ce-8a30-8767266f07d2'},
     'sourceId': 'f32d531e-df79-46b3-8932-cdd35f7a2264',
     'formerIds': ['a13412279 1 1'],
     'callNumber': 'G6002.S63 1772 .V5',
     'instanceId': 'e43be071-1444-53e5-9894-ed9bed97a34f',
     'holdingsItems': [],
     'holdingsTypeId': '03c9c400-b9e3-4a07-ac0e-05ab470233ed',
     'callNumberTypeId': '95467209-6d7b-468b-94df-0f5d7ad2747d',
     'electronicAccess': [],
     'bareHoldingsItems': [],
     'holdingsStatements': [],
     'statisticalCodeIds': [],
     'administrativeNotes': [],
     'effectiveLocationId': 'b516689f-d96f-4c74-8b7a-86a4eb01624c',
     'permanentLocationId': 'b516689f-d96f-4c74-8b7a-86a4eb01624c',
     'holdingsStatementsForIndexes': [],
     'holdingsStatementsForSupplements': []}]}]}
  1. Get the ["instanceSets"][0]["holdingsRecords"] array from the response. Each record has a permanentLocationId.

  2. We need to find out what the "code" is for each holding's permanentLocationId (e.g. SUL-SDR, EAR-LOCKED-MAPS). Look up a permanent location using GET /locations/#{permanent_loc_id}. (API Docs)

Example response:

{'locations': [{'id': '1b14e21c-8d47-45c7-bc49-456a0086422b',
   'name': 'SUL SDR',
   'code': 'SUL-SDR',
   'discoveryDisplayName': 'SUL SDR',
   'isActive': True,
   'institutionId': '8d433cdd-4e8f-4dc1-aa24-8a4ddb7dc929',
   'campusId': 'c365047a-51f2-45ce-8601-e421ca3615c5',
   'libraryId': 'c1a86906-ced0-46cb-8f5b-8cef542bdd00',
   'primaryServicePoint': '7c5abc9f-f3d7-4856-b8d7-6712462ca007',
   'servicePointIds': ['7c5abc9f-f3d7-4856-b8d7-6712462ca007'],
   'servicePoints': [],
   'metadata': {'createdDate': '2023-02-08T23:38:05.776+00:00',
    'createdByUserId': '7dc1ae38-1e06-4de9-ac86-568b9a2318ec',
    'updatedDate': '2023-02-08T23:38:05.776+00:00',
    'updatedByUserId': '7dc1ae38-1e06-4de9-ac86-568b9a2318ec'}}],
 'totalRecords': 1}
arcadiafalcone commented 1 year ago

Current 856 processing with Symphony (from https://docs.google.com/document/d/1sNZCgiYRwRgxyb_mWioDWoIs_kW0K0Mmm3CzvTueUYg/edit#) - CDL post-processing is also described in doc:

Parse each line Captures ckey, druid, and 856 If 856 exists, Write to the delete file: any existing 856 for this druid on this ckey Write to the merge file: the 856 for this druid for this ckey If 856 does not exist Write to the delete file: any existing 856 for this druid on this ckey

Call Symphony API to delete the 856s in the delete file Call Symphony API to add the 856s in the merge file

(So, “updates” are not done for an existing 856, but rather a delete of an existing 856 for that druid, and then an add of the incoming 856 for that druid)

Send delete and load reports to specific users

lwrubel commented 1 year ago

Closed since ticketed for FolioWriter