Skip to content

Instantly share code, notes, and snippets.

@barnabyalter
Created April 13, 2020 20:46
Show Gist options
  • Save barnabyalter/2e3a7b3b89b409e8f07b62bc7d3e64ab to your computer and use it in GitHub Desktop.
Save barnabyalter/2e3a7b3b89b409e8f07b62bc7d3e64ab to your computer and use it in GitHub Desktop.

The sublibrary code is only availabile in the top-level array of holdings like this:

{
  "matchForHoldings": [
    {
      "holdingRecord": "852##b",
      "matchOn": "MainLocation"
    },
    {
      "holdingRecord": "852##c",
      "matchOn": "SecondaryLocation"
    }
  ],
  "subLocationCode": "TAM",
  "ilsApiId": "NYU01002033731",
  "libraryCode": "BTAM",
  "isValidUser": true,
  "mainLocation": "OSTAM",
  "callNumber": "(PS3572.A387 Z6 1992 Non-circulating )",
  "adaptorid": "ALEPH_22",
  "organization": "NYU",
  "holdingURL": "OVP",
  "@id": "_:2",
  "availabilityStatus": "unavailable",
  "subLocation": "Main Collection",
  "holdId": "",
  "librarycodeTranslation": "NYU Bobst Tamiment/Wagner Archives",
  "collectionTranslation": "Main Collection"
}

But when we are making decisions about adding or hiding a "Request" button this is the only information we have available about the current holding:

{
  "_additionalData": {
    "itemid": "NYU50002033731000030",
    "itemdescription": "",
    "mainlocationname": "NYU Tamiment Offsite",
    "secondarylocationname": "Main Collection",
    "callnumber": "PS3572.A387 Z6 1992 Non-circulating",
    "itemcategoryname": "Ask at Special Collections",
    "itemstatusname": "Ask at Special Collections"
  },
  "itemFields": [
    "Ask at Special Collections",
    "Main Collection PS3572.A387 Z6 1992 Non-circulating",
    "Ask at Special Collections",
    ""
  ],
  "fullItemFields": [
    "Location: 
    ",
    "Barcode: 31142049045506",
    "Item Type: Books"
  ],
  "fullItemValues": [
    "NYU Tamiment Offsite Main Collection",
    "31142049045506",
    "Books"
  ],
  "isExpanded": false,
  "listOfServices": [],
  "item": "NYU50002033731000030"
}

While I do have access to both these items and as a human can see which holding belongs to which, there is no key to make this association programmatically.

If the text values in itemFields or fullItemValues are considered to be a reliable indication of which sublibrary the holdings fall into then we could replace the code list:

["NIFA", "NIFAC", "NISAW", "BARCH", "BFALE", "BTAM", "OSTAM", "OSFAL", "OSARC"]

With a list of text values:

['NYU Tamiment Offsite Main Collection', '...']

This means the exclusion logic has not been working as we thought it was. It could only ask, do ANY of the holdings match one of these sublibrary codes, and if so we'll make a general decision to add Request or Request to ILL for all the holdings on that item.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment