sul-dlss / FOLIO-Project-Stanford

Task management for Stanford’s analysis of FOLIO.
2 stars 0 forks source link

Confirm no boundwith breaking changes with Poppy #629

Closed ahafele closed 2 months ago

ahafele commented 3 months ago

There are UI changes to boundwiths in Poppy and we want to confirm that nothing has changed in the underlying structure of the boundwith relationships.

We observed two changes in the UI. The first seems fine and I've determined how it is functioning. The second is the one that prompted concerns about unknown changes.

Item record for Geomagnetism applications in production

Screenshot 2024-03-21 at 7.44.47 AM.png

Item record for Geomagnetism applications in production on test after editing the item record

Screenshot 2024-03-21 at 7.46.24 AM.png
shelleydoljack commented 3 months ago

Screenshots don't display for some reason. 😢 Is it unintentional for the principle to display in the list of boundwiths? A bug in the UI? It seems like maybe the new endpoint gathers all the items on a holdings records via the bound with table and doesn't remove the one you looking at. How would it know? It's kind of like when you click on a subject heading in SearchWorks and the search result is the record from which you clicked the link.

This is nice though, that the parent item now displays in the holdings of the child record but I see how it might confuse users immensely.

I see they added a POST /inventory/items-by-holdings-id https://s3.amazonaws.com/foliodocs/api/mod-inventory/p/inventory.html#inventory_items_by_holdings_id_post which I think might be concerning or just another way to create the relationship (instead of using a "storage" endpoint). That POST has a lot of data in the body, not like the bound-with-parts endpoint.

shelleydoljack commented 3 months ago

The bound-with section on the item record view is generated using data from the item record. There is a field, boundWithTitles that includes a list of the data. Not sure how this field is created in the item record:

"boundWithTitles" : [ {
    "briefHoldingsRecord" : {
      "id" : "a2a363a2-fb32-5416-9ab6-625b7f6cdd56",
      "hrid" : "ah2814810_3"
    },
    "briefInstance" : {
      "id" : "aa90df9d-f08d-598c-b0b8-9134fa0fe74f",
      "title" : "Societal value of geologic maps / by Richard L. Bernknopf ... [et al.].",
      "hrid" : "a2814810"
    }
  }, {
    "briefHoldingsRecord" : {
      "id" : "a8ebd5d6-889e-5e5e-9d96-a26f324bb2f4",
      "hrid" : "ah2817763_3"
    },
    "briefInstance" : {
      "id" : "69ead7df-71cc-57d4-816c-73a8ef612318",
      "title" : "Natural aggregate : building America's future / by William H. Langer and V.M. Glanzman.",
      "hrid" : "a2817763"
    }
  }, {
    "briefHoldingsRecord" : {
      "id" : "7424aa72-23db-580d-ac1c-89000546c8aa",
      "hrid" : "ah2956981_3"
    },
    "briefInstance" : {
      "id" : "8755a962-882a-584b-a75c-2a1b9745a9b5",
      "title" : "The Future of energy gases / by Peter J. McCabe [and others] ; with contributions from Robert B. Halley [and others] ; editor, L.M.H. Carter.",
      "hrid" : "a2956981"
    }
  }, {
    "briefHoldingsRecord" : {
      "id" : "2fedbb63-7291-557e-9de1-98da45367b33",
      "hrid" : "ah2992271_3"
    },
    "briefInstance" : {
      "id" : "a62be133-bee3-5106-b594-d10dbe1f8494",
      "title" : "Earthquake research at Parkfield, California, 1993 and beyond-- : report of the NEPEC Working Group to evaluate the Parkfield Earthquake Prediction Experiment / by National Earthquake Prediction Evaluation Council Working Group.",
      "hrid" : "a2992271"
    }
  }, {
    "briefHoldingsRecord" : {
      "id" : "dce37075-b347-51f2-9a92-118071a17070",
      "hrid" : "ah3000999_3"
    },
    "briefInstance" : {
      "id" : "09a6e17f-773b-58b8-af65-c0f5eb92a48e",
      "title" : "1995 National Assessment of United States oil and gas resources / by U.S. Geological Survey, National Oil and Gas Resource Assessment Team.",
      "hrid" : "a3000999"
    }
  }, {
    "briefHoldingsRecord" : {
      "id" : "279d7532-8dbf-578e-a4ca-09ed59e0a023",
      "hrid" : "ah3019640_3"
    },
    "briefInstance" : {
      "id" : "8d0baf43-d910-50d8-8aab-96db6ec9f569",
      "title" : "The Alaska mineral resource assessment program : background information to accompany geologic and mineral-resource maps of the Killik River 1°x3° Quadrangle, northern Alaska / by K.D. Kelley and C.G. Mull.",
      "hrid" : "a3019640"
    }
  }, {
    "briefHoldingsRecord" : {
      "id" : "b6aa8d38-f159-5c71-a431-041526022b62",
      "hrid" : "ah3042963_3"
    },
    "briefInstance" : {
      "id" : "0f7f2eec-7c5f-5637-9a27-e4a5b7f349b0",
      "title" : "Design of the national water-quality assessment program : occurrence and distribution of water-quality conditions / by Robert J. Gilliom, William M. Alley, and Martin E. Gurtz.",
      "hrid" : "a3042963"
    }
  }, {
    "briefHoldingsRecord" : {
      "id" : "6ac186f5-311d-55e5-afd5-8ac18e92517d",
      "hrid" : "ah4100414_2"
    },
    "briefInstance" : {
      "id" : "0a15febb-d6b7-5aee-b4b8-db60a9fa151a",
      "title" : "Geomagnetism applications / by Wallace H. Campbell.",
      "hrid" : "a4100414"
    }
  } ]
shelleydoljack commented 3 months ago

Doing a GET /inventory/items/d6d91afc-c697-5f05-aab0-f14977acc2ed in prod, you see a boundWithTitles list too, but the _version of the item record is 1, so it's very unclear how this data got there. Do versions of records start at 0?

ahafele commented 3 months ago

I chatted with Charlotte this morning and showed her our boundwiths in Poppy test. She was unsure what might have gone wrong but confirms that there is no upgrade breaking changes or upgrade processes that we might have missed. She suggests we try to identify the bound-with records and edit/save them to trigger the UI display of the principle. She also shared the slide deck below and offered additional assistance if we need it. It is still not clear to me the mechanism that creates the UI display of the principle but based on the slides it is triggered by the save action. And then if all other relationships are deleted, the principle is automatically "cleaned up" e.g. the user can not delete/trashcan icon is grayed out. https://docs.google.com/presentation/d/1WRo8z_T63h5o2vqVBhfvTArubemBNNnUrayqtoypjvA/edit#slide=id.g29621cdef64_0_6

shelleydoljack commented 3 months ago

Just confirming that indeed, our version of mod-inventory (19.0.2) in production has this code that gets the bound with parts using the storage endpoint, to update the item record of the parent. https://github.com/folio-org/mod-inventory/blob/09c82d96006ce29effc0bf0aedef8a0babbfe167/src/main/java/org/folio/inventory/resources/Items.java#L874-L916

Related Jira ticket: https://folio-org.atlassian.net/browse/MODINV-443

So we need to figure out a way to update all our bound with parent item records... Or just wait until a user updates them 🤷‍♂️ I'll see if I can figure out how many bw parent items we have.

shelleydoljack commented 3 months ago

This query will count the distinct itemId values in the bound_with_part table, here is from prod:

select count(distinct jsonb ->> 'itemId') from sul_mod_inventory_storage.bound_with_part;
 count 
-------
 34984
ahafele commented 3 months ago

Did some more testing - editing the related instance doesn't work and checking in the item doesn't work even though it updates the Item Record last updated date. Maybe Jeanette could run a bulk edit and just add an item note. That action has the desired effect.

shelleydoljack commented 3 months ago

Whatever works. Should I get the item Id's for bw-parents from stage for her to test? Can bulk edit handle that many or will it need to be broken up? I guess we'll find out.

ahafele commented 3 months ago

I searched for "BWcreatedby" on folio-test because this is the note our bulk process adds. It doesn't look like the addition of that note has the desired effect on Poppy UI - see here https://folio-test.stanford.edu/inventory/view/1c1a4b4c-8de7-57f0-82d0-4c3ce04540da/466e561d-3d86-5701-9b1f-7d00f12855b4/c22376b9-4ab8-543c-8540-c93401269396?qindex=holdingsAdministrativeNotes&query=BWcreatedby&segment=holdings&sort=title

ahafele commented 3 months ago

I'll check in with Jeanette re: bulk edit

shelleydoljack commented 3 months ago

I searched for "BWcreatedby" on folio-test because this is the note our bulk process adds. It doesn't look like the addition of that note has the desired effect on Poppy UI - see here https://folio-test.stanford.edu/inventory/view/1c1a4b4c-8de7-57f0-82d0-4c3ce04540da/466e561d-3d86-5701-9b1f-7d00f12855b4/c22376b9-4ab8-543c-8540-c93401269396?qindex=holdingsAdministrativeNotes&query=BWcreatedby&segment=holdings&sort=title

I'm almost certain that the reason is because we are using the item-storage endpoint to update the item: https://github.com/sul-dlss/libsys-airflow/blob/f8f5ffd3cc36e5ef1419f623263a56795c9a27a9/libsys_airflow/plugins/folio/helpers/bw.py#L99-L102

shelleydoljack commented 3 months ago

Maybe I try testing changing the endpoint to use https://s3.amazonaws.com/foliodocs/api/mod-inventory/p/inventory.html#inventory_items__itemid__put locally and see what happens.

shelleydoljack commented 3 months ago

Hmm, I was about to make a ticket in libsys-airflow but did some testing first. In folio-stage, I wanted to create the bound with relationship between the records Alissa linked me to for an example in folio-test. First create bound with relationship:

curl -i -X POST \
   -H "Content-Type:application/json" \
   -H "X-Okapi-Tenant:sul" \
   -H "x-okapi-token:" \
   -d \
'{
  "holdingsRecordId": "aa50a69f-b654-539f-bc4b-79437b01aed4",
  "itemId": "c22376b9-4ab8-543c-8540-c93401269396"
}' \
 'https://okapi-stage.stanford.edu/inventory-storage/bound-with-parts'

View item record: Screenshot 2024-03-28 at 1 13 37 PM The strange thing is that the boundWithTitles array is populated and I didn't even try doing a PUT to the inventory/items endpoint! So now my theory is that doing a PUT to item-storage/items in libsys-airflow bw helper is overwriting maybe what is created when just doing a POST to inventory-storage/bound-with-parts

shelleydoljack commented 3 months ago

I did a GET and PUT to inventory/items and added an admin note, the boundWithTitles is still populated but only with the ID of the boundwith child is in the list. I did another GET and PUT to item-storage/items and added another admin note and the boundWithTitles list is still populated, only with the bound with child. I had expected maybe the bw parent would show up with the GET and PUT using the inventory/items endpoint but it does not. So alas, our libsys-airflow process seems okay. Maybe it IS a later mod-inventory version (not Nolana version) that adds the bw parent to the list of boundWithTitles on the item record.

shelleydoljack commented 3 months ago

Just testing in folio-test.

  1. create holdings record for bw child: https://folio-test.stanford.edu/inventory/view/c2bdc9f3-93f5-5368-ab33-b72f2498aedc/55a8ad4a-d459-425d-a8d7-509c4c41d027
  2. Check the item record that will be the bw parent to see what the boundWithTitles array looks like. Screenshot 2024-03-28 at 2 53 06 PM
  3. Make the bw relationship:
    curl -i -X POST \
    -H "Content-Type:application/json" \
    -H "X-Okapi-Tenant:sul" \
    -H "x-okapi-token:" \
    -d \
    '{
    "holdingsRecordId": "55a8ad4a-d459-425d-a8d7-509c4c41d027",
    "itemId": "766fe67c-bc7d-5c10-be48-6dc34f396100"
    }' \
    'https://okapi-test.stanford.edu/inventory-storage/bound-with-parts'
  4. Check the item record after the bw relationship is made: Screenshot 2024-03-28 at 2 55 25 PM
  5. Check the item record using the item-storage/items endpoint:
    {
    "id": "766fe67c-bc7d-5c10-be48-6dc34f396100",
    "_version": 1,
    "hrid": "ai2673945_1_1",
    "holdingsRecordId": "8a5137f8-acb8-567e-941b-33fc5a66b595",
    "formerIds": [
    ],
    "discoverySuppress": false,
    "barcode": "36105211279042",
    "effectiveShelvingOrder": "Y 13  !C 276 !13 12  !F 251 12 11",
    "effectiveCallNumberComponents": {
        "callNumber": "Y 3.C 76/3:2 F 51/2",
        "typeId": "fc388041-6cd0-4806-8a74-ebe3b9ab4c6e"
    },
    "yearCaption": [
    ],
    "copyNumber": "1",
    "numberOfPieces": "1",
    "administrativeNotes": [
    ],
    "notes": [
        {
            "itemNoteTypeId": "4856cab2-91da-46b1-8e23-0af7ee0c3f41",
            "note": "tf:GOV-DOCS 11/98 batch",
            "staffOnly": true
        }
    ],
    "circulationNotes": [
    ],
    "status": {
        "name": "Available",
        "date": "2023-08-21T03:39:19.387+00:00"
    },
    "materialTypeId": "1a54b431-2e4f-452d-9cae-9cee66c9a892",
    "permanentLoanTypeId": "2b94c631-fca9-4892-a730-03ee529ffe27",
    "effectiveLocationId": "203882d5-acd0-40b6-bc73-1cf8d64832cb",
    "electronicAccess": [
    ],
    "statisticalCodeIds": [
    ],
    "metadata": {
        "createdDate": "2023-08-21T03:50:24.402+00:00",
        "createdByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766",
        "updatedDate": "2023-08-21T03:50:24.402+00:00",
        "updatedByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766"
    }
    }
  6. Check the item record using the inventory/items endpoint:
    {
    "id": "766fe67c-bc7d-5c10-be48-6dc34f396100",
    "_version": "1",
    "status": {
        "name": "Available",
        "date": "2023-08-21T03:39:19.387+00:00"
    },
    "administrativeNotes": [
    ],
    "title": "The 9 lives of El Gato the Cat : a fire safety comic book.",
    "callNumber": "Y 3.C 76/3:2 F 51/2",
    "hrid": "ai2673945_1_1",
    "contributorNames": [
        {
            "name": "U.S. Consumer Product Safety Commission"
        }
    ],
    "formerIds": [
    ],
    "discoverySuppress": false,
    "holdingsRecordId": "8a5137f8-acb8-567e-941b-33fc5a66b595",
    "barcode": "36105211279042",
    "copyNumber": "1",
    "notes": [
        {
            "itemNoteTypeId": "4856cab2-91da-46b1-8e23-0af7ee0c3f41",
            "note": "tf:GOV-DOCS 11/98 batch",
            "staffOnly": true
        }
    ],
    "circulationNotes": [
    ],
    "numberOfPieces": "1",
    "tags": {
        "tagList": [
        ]
    },
    "yearCaption": [
    ],
    "electronicAccess": [
    ],
    "statisticalCodeIds": [
    ],
    "purchaseOrderLineIdentifier": null,
    "materialType": {
        "id": "1a54b431-2e4f-452d-9cae-9cee66c9a892",
        "name": "book"
    },
    "permanentLoanType": {
        "id": "2b94c631-fca9-4892-a730-03ee529ffe27",
        "name": "Can circulate"
    },
    "metadata": {
        "createdDate": "2023-08-21T03:50:24.402+00:00",
        "createdByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766",
        "updatedDate": "2023-08-21T03:50:24.402+00:00",
        "updatedByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766"
    },
    "effectiveCallNumberComponents": {
        "callNumber": "Y 3.C 76/3:2 F 51/2",
        "prefix": null,
        "suffix": null,
        "typeId": "fc388041-6cd0-4806-8a74-ebe3b9ab4c6e"
    },
    "effectiveShelvingOrder": "Y 13  !C 276 !13 12  !F 251 12 11",
    "isBoundWith": true,
    "boundWithTitles": [
        {
            "briefHoldingsRecord": {
                "id": "55a8ad4a-d459-425d-a8d7-509c4c41d027",
                "hrid": "ho00000021540"
            },
            "briefInstance": {
                "id": "c2bdc9f3-93f5-5368-ab33-b72f2498aedc",
                "title": "The 'Danzig trilogy' of Guenter Grass; a study of The tin drum, Cat and mouse, and Dog years.",
                "hrid": "a865597"
            }
        }
    ],
    "effectiveLocation": {
        "id": "203882d5-acd0-40b6-bc73-1cf8d64832cb",
        "name": "Green Federal Docs"
    }
    }
  7. Add an admin note using the item-storage/items endpoint using GET then PUT. The boundWithTitles array shows up when doing a GET to inventory/items (what the UI does) for the bw parent item record. The boundWithTitles array only has the info for the bw child record (not the parent).
    {
    "id": "766fe67c-bc7d-5c10-be48-6dc34f396100",
    "_version": "2",
    "status": {
        "name": "Available",
        "date": "2023-08-21T03:39:19.387+00:00"
    },
    "administrativeNotes": [
        "Note added using item-storage/items endpoint."
    ],
    "title": "The 9 lives of El Gato the Cat : a fire safety comic book.",
    "callNumber": "Y 3.C 76/3:2 F 51/2",
    "hrid": "ai2673945_1_1",
    "contributorNames": [
        {
            "name": "U.S. Consumer Product Safety Commission"
        }
    ],
    "formerIds": [
    ],
    "discoverySuppress": false,
    "holdingsRecordId": "8a5137f8-acb8-567e-941b-33fc5a66b595",
    "barcode": "36105211279042",
    "copyNumber": "1",
    "notes": [
        {
            "itemNoteTypeId": "4856cab2-91da-46b1-8e23-0af7ee0c3f41",
            "note": "tf:GOV-DOCS 11/98 batch",
            "staffOnly": true
        }
    ],
    "circulationNotes": [
    ],
    "numberOfPieces": "1",
    "tags": {
        "tagList": [
        ]
    },
    "yearCaption": [
    ],
    "electronicAccess": [
    ],
    "statisticalCodeIds": [
    ],
    "purchaseOrderLineIdentifier": null,
    "materialType": {
        "id": "1a54b431-2e4f-452d-9cae-9cee66c9a892",
        "name": "book"
    },
    "permanentLoanType": {
        "id": "2b94c631-fca9-4892-a730-03ee529ffe27",
        "name": "Can circulate"
    },
    "metadata": {
        "createdDate": "2023-08-21T03:50:24.402+00:00",
        "createdByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766",
        "updatedDate": "2024-03-28T21:08:13.560+00:00",
        "updatedByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766"
    },
    "effectiveCallNumberComponents": {
        "callNumber": "Y 3.C 76/3:2 F 51/2",
        "prefix": null,
        "suffix": null,
        "typeId": "fc388041-6cd0-4806-8a74-ebe3b9ab4c6e"
    },
    "effectiveShelvingOrder": "Y 13  !C  276 !13 12  !F 251 12 11",
    "isBoundWith": true,
    "boundWithTitles": [
        {
            "briefHoldingsRecord": {
                "id": "55a8ad4a-d459-425d-a8d7-509c4c41d027",
                "hrid": "ho00000021540"
            },
            "briefInstance": {
                "id": "c2bdc9f3-93f5-5368-ab33-b72f2498aedc",
                "title": "The 'Danzig trilogy' of Guenter Grass; a study of The tin drum, Cat and mouse, and Dog years.",
                "hrid": "a865597"
            }
        }
    ],
    "effectiveLocation": {
        "id": "203882d5-acd0-40b6-bc73-1cf8d64832cb",
        "name": "Green Federal Docs"
    }
    }
  8. I added another note, using the inventory/items endpoint, and the boundWithTitles array still only shows the info for the bw child.

So now I wonder what the UI is doing to create the bw relationships. Just had to doublecheck the json, the item record d6d91afc-c697-5f05-aab0-f14977acc2ed is the bw parent and does indeed have its holdings and instance data in the boundWithTitles array:

, {
    "briefHoldingsRecord" : {
      "id" : "6ac186f5-311d-55e5-afd5-8ac18e92517d",
      "hrid" : "ah4100414_2"
    },
    "briefInstance" : {
      "id" : "0a15febb-d6b7-5aee-b4b8-db60a9fa151a",
      "title" : "Geomagnetism applications / by Wallace H. Campbell.",
      "hrid" : "a4100414"
    }
  } ],
shelleydoljack commented 3 months ago

Testing in folio-test to see what the UI does to create bw relationships.

  1. Create a bw child holdings record. https://folio-test.stanford.edu/inventory/view/54ec1f1a-d039-5a39-95f2-71df00061664/0c3d4214-c563-46ec-9824-a5c52024a63a
  2. Identify a record to make the bw parent: https://folio-test.stanford.edu/inventory/view/5e14daff-0ef2-5cef-9194-ef9ff6337c31/fe8eb67a-b979-55ab-8663-f2f98198647b/da52d739-28bd-5e15-8331-f56f255d3edb
  3. With Chrome Dev Tools open, inspect the Network traffic. Select Actions > Edit on the item record. Scroll down and click the Add Bound-with and analytics button. Enter the holdings hrid of the bw child ho00000021541. Click save and close. The payload is a PUT to inventory-storage/bound-withs (not a POST to inventory-storage/bound-with-parts):
    {"itemId":"da52d739-28bd-5e15-8331-f56f255d3edb","boundWithContents":[{"holdingsRecordId":"0c3d4214-c563-46ec-9824-a5c52024a63a"}]}

    There is also a PUT to inventory/items/da52d739-28bd-5e15-8331-f56f255d3edb with the payload (note that the boundWithTitles array only has the bw child info in it:

    {
    "id": "da52d739-28bd-5e15-8331-f56f255d3edb",
    "_version": "1",
    "status": {
    "name": "Available",
    "date": "2023-08-21T03:59:32.352+00:00"
    },
    "administrativeNotes": [],
    "title": "'Four quartets' rehearsed : a commentary on T. S. Eliot's cycle of poems.",
    "callNumber": "PS3509 .L43 F67",
    "hrid": "ai2790190_1_1",
    "contributorNames": [
    {
      "name": "Preston, Raymond"
    }
    ],
    "formerIds": [],
    "discoverySuppress": false,
    "holdingsRecordId": "fe8eb67a-b979-55ab-8663-f2f98198647b",
    "barcode": "36105004505686",
    "copyNumber": "1",
    "notes": [
    {
      "itemNoteTypeId": "4856cab2-91da-46b1-8e23-0af7ee0c3f41",
      "note": "tf:SAL 02/09/13 batch; c:msh; tf:MEYER 03/99 batch",
      "staffOnly": true
    }
    ],
    "circulationNotes": [],
    "numberOfPieces": "1",
    "tags": {
    "tagList": []
    },
    "yearCaption": [],
    "electronicAccess": [],
    "statisticalCodeIds": [
    "e6f1059b-4ab2-4bb2-adcb-af66acb6f4fa"
    ],
    "purchaseOrderLineIdentifier": null,
    "materialType": {
    "id": "1a54b431-2e4f-452d-9cae-9cee66c9a892",
    "name": "book"
    },
    "permanentLoanType": {
    "id": "2b94c631-fca9-4892-a730-03ee529ffe27",
    "name": "Can circulate"
    },
    "metadata": {
    "createdDate": "2023-08-21T04:15:02.190+00:00",
    "createdByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766",
    "updatedDate": "2023-08-21T04:15:02.190+00:00",
    "updatedByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766"
    },
    "effectiveCallNumberComponents": {
    "callNumber": "PS3509 .L43 F67",
    "prefix": null,
    "suffix": null,
    "typeId": "95467209-6d7b-468b-94df-0f5d7ad2747d"
    },
    "effectiveShelvingOrder": "PS 43509 L43 F67 11",
    "isBoundWith": false,
    "effectiveLocation": {
    "id": "1146c4fa-5798-40e1-9b8e-92ee4c9f2ee2",
    "name": "SAL3 Stacks"
    },
    "boundWithTitles": [
    {
      "briefHoldingsRecord": {
        "hrid": "ho00000021541",
        "id": "0c3d4214-c563-46ec-9824-a5c52024a63a"
      },
      "briefInstance": {
        "id": "54ec1f1a-d039-5a39-95f2-71df00061664",
        "hrid": "a1994253",
        "title": "... Old Possum's book of practical cats."
      }
    }
    ]
    }

    The next network call is a GET to inventory/items/da52d739-28bd-5e15-8331-f56f255d3edb and the response shows version 2 of the record and includes the bwparent in the boundWithTitles array:

    {
    "id" : "da52d739-28bd-5e15-8331-f56f255d3edb",
    "_version" : "2",
    "status" : {
    "name" : "Available",
    "date" : "2023-08-21T03:59:32.352+00:00"
    },
    "administrativeNotes" : [ ],
    "title" : "'Four quartets' rehearsed : a commentary on T. S. Eliot's cycle of poems.",
    "callNumber" : "PS3509 .L43 F67",
    "hrid" : "ai2790190_1_1",
    "contributorNames" : [ {
    "name" : "Preston, Raymond"
    } ],
    "formerIds" : [ ],
    "discoverySuppress" : false,
    "holdingsRecordId" : "fe8eb67a-b979-55ab-8663-f2f98198647b",
    "barcode" : "36105004505686",
    "copyNumber" : "1",
    "notes" : [ {
    "itemNoteTypeId" : "4856cab2-91da-46b1-8e23-0af7ee0c3f41",
    "note" : "tf:SAL 02/09/13 batch; c:msh; tf:MEYER 03/99 batch",
    "staffOnly" : true
    } ],
    "circulationNotes" : [ ],
    "numberOfPieces" : "1",
    "tags" : {
    "tagList" : [ ]
    },
    "yearCaption" : [ ],
    "electronicAccess" : [ ],
    "statisticalCodeIds" : [ "e6f1059b-4ab2-4bb2-adcb-af66acb6f4fa" ],
    "purchaseOrderLineIdentifier" : null,
    "materialType" : {
    "id" : "1a54b431-2e4f-452d-9cae-9cee66c9a892",
    "name" : "book"
    },
    "permanentLoanType" : {
    "id" : "2b94c631-fca9-4892-a730-03ee529ffe27",
    "name" : "Can circulate"
    },
    "metadata" : {
    "createdDate" : "2023-08-21T04:15:02.190+00:00",
    "createdByUserId" : "58d0aaf6-dcda-4d5e-92da-012e6b7dd766",
    "updatedDate" : "2024-03-28T21:45:07.925+00:00",
    "updatedByUserId" : "58d0aaf6-dcda-4d5e-92da-012e6b7dd766"
    },
    "effectiveCallNumberComponents" : {
    "callNumber" : "PS3509 .L43 F67",
    "prefix" : null,
    "suffix" : null,
    "typeId" : "95467209-6d7b-468b-94df-0f5d7ad2747d"
    },
    "effectiveShelvingOrder" : "PS 43509 L43 F67 11",
    "isBoundWith" : true,
    "boundWithTitles" : [ {
    "briefHoldingsRecord" : {
      "id" : "fe8eb67a-b979-55ab-8663-f2f98198647b",
      "hrid" : "ah2790190_1"
    },
    "briefInstance" : {
      "id" : "5e14daff-0ef2-5cef-9194-ef9ff6337c31",
      "title" : "'Four quartets' rehearsed : a commentary on T. S. Eliot's cycle of poems.",
      "hrid" : "a2790190"
    }
    }, {
    "briefHoldingsRecord" : {
      "id" : "0c3d4214-c563-46ec-9824-a5c52024a63a",
      "hrid" : "ho00000021541"
    },
    "briefInstance" : {
      "id" : "54ec1f1a-d039-5a39-95f2-71df00061664",
      "title" : "... Old Possum's book of practical cats.",
      "hrid" : "a1994253"
    }
    } ],
    "effectiveLocation" : {
    "id" : "1146c4fa-5798-40e1-9b8e-92ee4c9f2ee2",
    "name" : "SAL3 Stacks"
    }
    }
shelleydoljack commented 3 months ago

Testing using the new endpoint PUT inventory-storage/bound-withs in folio-test.

  1. Create a new bw holdings for the bw child: https://folio-test.stanford.edu/inventory/view/3d21303b-f517-546e-8076-0e56f593eb2e/99286cfc-57fe-4cdb-b5ac-8b4b74b3d054
  2. Create the bw relationship using the new endpoint. A PUT to the endpoint returns 204.
    curl -i -X PUT \
    -H "Content-Type:application/json" \
    -H "X-Okapi-Tenant:sul" \
    -H "x-okapi-token:" \
    -d \
    '{
    "itemId" : "da52d739-28bd-5e15-8331-f56f255d3edb",
    "boundWithContents":[{"holdingsRecordId":"99286cfc-57fe-4cdb-b5ac-8b4b74b3d054"}]
    }' \
    'https://okapi-test.stanford.edu/inventory-storage/bound-withs'
  3. Check the item record using inventory/items/da52d739-28bd-5e15-8331-f56f255d3edb. It no longer lists the other bw child (HRID ho00000021541) in boundWithParts:
    {
    "id": "da52d739-28bd-5e15-8331-f56f255d3edb",
    "_version": "2",
    "status": {
        "name": "Available",
        "date": "2023-08-21T03:59:32.352+00:00"
    },
    "administrativeNotes": [
    ],
    "title": "'Four quartets' rehearsed : a commentary on T. S. Eliot's cycle of poems.",
    "callNumber": "PS3509 .L43 F67",
    "hrid": "ai2790190_1_1",
    "contributorNames": [
        {
            "name": "Preston, Raymond"
        }
    ],
    "formerIds": [
    ],
    "discoverySuppress": false,
    "holdingsRecordId": "fe8eb67a-b979-55ab-8663-f2f98198647b",
    "barcode": "36105004505686",
    "copyNumber": "1",
    "notes": [
        {
            "itemNoteTypeId": "4856cab2-91da-46b1-8e23-0af7ee0c3f41",
            "note": "tf:SAL 02/09/13 batch; c:msh; tf:MEYER 03/99 batch",
            "staffOnly": true
        }
    ],
    "circulationNotes": [
    ],
    "numberOfPieces": "1",
    "tags": {
        "tagList": [
        ]
    },
    "yearCaption": [
    ],
    "electronicAccess": [
    ],
    "statisticalCodeIds": [
        "e6f1059b-4ab2-4bb2-adcb-af66acb6f4fa"
    ],
    "purchaseOrderLineIdentifier": null,
    "materialType": {
        "id": "1a54b431-2e4f-452d-9cae-9cee66c9a892",
        "name": "book"
    },
    "permanentLoanType": {
        "id": "2b94c631-fca9-4892-a730-03ee529ffe27",
        "name": "Can circulate"
    },
    "metadata": {
        "createdDate": "2023-08-21T04:15:02.190+00:00",
        "createdByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766",
        "updatedDate": "2024-03-28T21:45:07.925+00:00",
        "updatedByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766"
    },
    "effectiveCallNumberComponents": {
        "callNumber": "PS3509 .L43 F67",
        "prefix": null,
        "suffix": null,
        "typeId": "95467209-6d7b-468b-94df-0f5d7ad2747d"
    },
    "effectiveShelvingOrder": "PS 43509 L43 F67 11",
    "isBoundWith": true,
    "boundWithTitles": [
        {
            "briefHoldingsRecord": {
                "id": "fe8eb67a-b979-55ab-8663-f2f98198647b",
                "hrid": "ah2790190_1"
            },
            "briefInstance": {
                "id": "5e14daff-0ef2-5cef-9194-ef9ff6337c31",
                "title": "'Four quartets' rehearsed : a commentary on T. S. Eliot's cycle of poems.",
                "hrid": "a2790190"
            }
        },
        {
            "briefHoldingsRecord": {
                "id": "99286cfc-57fe-4cdb-b5ac-8b4b74b3d054",
                "hrid": "ho00000021542"
            },
            "briefInstance": {
                "id": "3d21303b-f517-546e-8076-0e56f593eb2e",
                "title": "Anatomy of the cat, by Jacob Reighard and H.S. Jennings.",
                "hrid": "a698027"
            }
        }
    ],
    "effectiveLocation": {
        "id": "1146c4fa-5798-40e1-9b8e-92ee4c9f2ee2",
        "name": "SAL3 Stacks"
    }
    }
  4. The bw relationship for ho00000021541 is now gone.
  5. ~But interestingly (or maybe not), when checking the inventory-storage/bound-with-parts endpoint for the bw parent item Id, both of the relationships are still there:~ Actually, I mistook the holdingsRecordId fe8eb to be the UUID for holding HRID ho00000021541 but it is not, it is the holdings record for the bw parent.
    {
    "boundWithParts": [
        {
            "id": "3c512854-9500-4384-9a15-ac6832d71147",
            "holdingsRecordId": "fe8eb67a-b979-55ab-8663-f2f98198647b",
            "itemId": "da52d739-28bd-5e15-8331-f56f255d3edb",
            "metadata": {
                "createdDate": "2024-03-28T21:45:07.065+00:00",
                "updatedDate": "2024-03-28T21:45:07.065+00:00"
            }
        },
        {
            "id": "0d62e447-3bff-46de-a750-297d4d652a6b",
            "holdingsRecordId": "99286cfc-57fe-4cdb-b5ac-8b4b74b3d054",
            "itemId": "da52d739-28bd-5e15-8331-f56f255d3edb",
            "metadata": {
                "createdDate": "2024-03-28T22:07:27.973+00:00",
                "updatedDate": "2024-03-28T22:07:27.973+00:00"
            }
        }
    ],
    "totalRecords": 2
    }
shelleydoljack commented 3 months ago

I tried doing a PUT to re-establish the bw relationship:

curl -i -X PUT \
   -H "Content-Type:application/json" \
   -H "X-Okapi-Tenant:sul" \
   -H "x-okapi-token:" \
   -d \
'{
  "itemId" : "da52d739-28bd-5e15-8331-f56f255d3edb",
  "boundWithContents":[{"holdingsRecordId":"99286cfc-57fe-4cdb-b5ac-8b4b74b3d054"},
                       {"holdingsRecordId":"fe8eb67a-b979-55ab-8663-f2f98198647b"}]
}' \
 'https://okapi-test.stanford.edu/inventory-storage/bound-withs'

I got a 204 response but when I check the item record in folio, it still doesn't have the other bw child.

UPDATE: this happened b/c I used the wrong holdingsRecordId. Using the correct one

curl -i -X PUT \
   -H "Content-Type:application/json" \
   -H "X-Okapi-Tenant:sul" \
   -H "x-okapi-token:" \
   -d \
'{
  "itemId" : "da52d739-28bd-5e15-8331-f56f255d3edb",
  "boundWithContents":[{"holdingsRecordId":"99286cfc-57fe-4cdb-b5ac-8b4b74b3d054"},
                       {"holdingsRecordId":"0c3d4214-c563-46ec-9824-a5c52024a63a"}]
}' \
 'https://okapi-test.stanford.edu/inventory-storage/bound-withs'

and the item record of the bw parent now shows the 2 bw children + itself in boundWithTitles list.

shelleydoljack commented 3 months ago

Trying to see how the UI allows creating boundwiths with many children and one parent.

  1. Create 2 holdings records that will be the bw children: https://folio-test.stanford.edu/inventory/view/e6db9965-03cb-5ddc-b0cc-c1db52eda195/5a21973d-595c-46db-88df-8a678fc08eb0 and https://folio-test.stanford.edu/inventory/view/d4d28ab6-0762-5db6-bd8c-1784a512537e/0e482ee7-69a2-4654-ad96-f9f5f257b230
  2. Go to item record of the bw parent: https://folio-test.stanford.edu/inventory/view/fc83cc00-beb8-5375-9c91-6159c4e2104c/1ae97343-60e9-567a-a236-86e752b3300b/04f71b17-ee9e-5ed4-899f-89e990f31da2
  3. Open Chrome Dev Tools and see what the network traffic is when adding multiple holdings.
  4. A PUT was sent to inventory-storage/bound-withs with the payload:
    {
    "itemId": "04f71b17-ee9e-5ed4-899f-89e990f31da2",
    "boundWithContents": [
    {
      "holdingsRecordId": "0e482ee7-69a2-4654-ad96-f9f5f257b230"
    },
    {
      "holdingsRecordId": "5a21973d-595c-46db-88df-8a678fc08eb0"
    }
    ]
    }
  5. Another PUT was sent to inventory/items/04f71b17-ee9e-5ed4-899f-89e990f31da2 with the payload:
    {
    "id": "04f71b17-ee9e-5ed4-899f-89e990f31da2",
    "_version": "1",
    "status": {
    "name": "Available",
    "date": "2023-08-20T21:16:35.710+00:00"
    },
    "administrativeNotes": [],
    "title": "The art of T. S. Eliot.",
    "callNumber": "811.4 .E423GA",
    "hrid": "ai1265807_1_1",
    "contributorNames": [
    {
      "name": "Gardner, Helen, 1908-1986"
    }
    ],
    "formerIds": [],
    "discoverySuppress": false,
    "holdingsRecordId": "1ae97343-60e9-567a-a236-86e752b3300b",
    "barcode": "36105010562648",
    "copyNumber": "2",
    "notes": [
    {
      "itemNoteTypeId": "4856cab2-91da-46b1-8e23-0af7ee0c3f41",
      "note": "RECON 910824; 1968, c1949",
      "staffOnly": true
    }
    ],
    "circulationNotes": [],
    "numberOfPieces": "1",
    "tags": {
    "tagList": []
    },
    "yearCaption": [],
    "electronicAccess": [],
    "statisticalCodeIds": [],
    "purchaseOrderLineIdentifier": null,
    "materialType": {
    "id": "1a54b431-2e4f-452d-9cae-9cee66c9a892",
    "name": "book"
    },
    "permanentLoanType": {
    "id": "2b94c631-fca9-4892-a730-03ee529ffe27",
    "name": "Can circulate"
    },
    "metadata": {
    "createdDate": "2023-08-20T21:30:09.787+00:00",
    "createdByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766",
    "updatedDate": "2023-08-20T21:30:09.787+00:00",
    "updatedByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766"
    },
    "effectiveCallNumberComponents": {
    "callNumber": "811.4 .E423GA",
    "prefix": null,
    "suffix": null,
    "typeId": "03dd64d0-5626-4ecd-8ece-4531e0069f35"
    },
    "effectiveShelvingOrder": "3811.4 E423GA 12",
    "isBoundWith": false,
    "effectiveLocation": {
    "id": "4573e824-9273-4f13-972f-cff7bf504217",
    "name": "Green Stacks"
    },
    "boundWithTitles": [
    {
      "briefHoldingsRecord": {
        "hrid": "ho00000021544",
        "id": "0e482ee7-69a2-4654-ad96-f9f5f257b230"
      },
      "briefInstance": {
        "id": "d4d28ab6-0762-5db6-bd8c-1784a512537e",
        "hrid": "a611728",
        "title": "Anatomy of the cat, by Jacob Reighard ... and H.S. Jennings ... with one hundred and seventy-three original figures drawn by Louise Burridge Jennings."
      }
    },
    {
      "briefHoldingsRecord": {
        "hrid": "ho00000021543",
        "id": "5a21973d-595c-46db-88df-8a678fc08eb0"
      },
      "briefInstance": {
        "id": "e6db9965-03cb-5ddc-b0cc-c1db52eda195",
        "hrid": "a10156831",
        "title": "And the cat says... / Susan L. Helwig."
      }
    }
    ]
    }
  6. The item record now has the 2 bw children and the bw parent info in boundWithTitles array.
shelleydoljack commented 3 months ago

So, I think this is all to say, that we should update our airflow bw creation to use the new endpoint for Poppy. But that means when establishing new relationships, we need to send in the existing ones too to the PUT or else we will inadvertently unbind things that are bound with and then they'll be lost forever!!!! AAHHHhh!!! 🤯

shelleydoljack commented 3 months ago

While driving my kid home from daycare, I had the brilliant idea that maybe our assumption of the inventory-storage/bound-with-parts endpoint was that it only should contain the bw children records' holdingsRecordIds is wrong and that in fact, the expectation is that the bw parent would also have an entry in this table for bw parent holdingsRecordId and itemId (which is not at all how I understood the description in the API docs):

Add a new part to a bound-with item

"holdingsRecordId": {
"type": "string",
"description": "the ID of the holdings record representing a part of a bound-with; a UUID"
},
"itemId": {
"type": "string",
"description": "the ID of the item representing the bind; a UUID"
}

But alas, the parent is a part of the bound with item, ergo it should get an entry as well (or so I assume is the thinking).

Indeed, the item record example in this ticket has these entries in /inventory-storage/bound-with-parts:

{
    "boundWithParts": [
        {
            "id": "ef8ee0ec-bf18-4458-8680-b8a811a5b038",
            "holdingsRecordId": "a2a363a2-fb32-5416-9ab6-625b7f6cdd56",
            "itemId": "d6d91afc-c697-5f05-aab0-f14977acc2ed",
            "metadata": {
                "createdDate": "2023-08-23T19:32:42.113+00:00",
                "createdByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766",
                "updatedDate": "2023-08-23T19:32:42.113+00:00",
                "updatedByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766"
            }
        },
        {
            "id": "0aba7773-9094-4e3a-b5fe-3b0247ecf9fd",
            "holdingsRecordId": "a8ebd5d6-889e-5e5e-9d96-a26f324bb2f4",
            "itemId": "d6d91afc-c697-5f05-aab0-f14977acc2ed",
            "metadata": {
                "createdDate": "2023-08-23T19:32:44.806+00:00",
                "createdByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766",
                "updatedDate": "2023-08-23T19:32:44.806+00:00",
                "updatedByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766"
            }
        },
        {
            "id": "a6a072c5-1b25-4b7d-8825-fdcf0bfb4eb0",
            "holdingsRecordId": "dce37075-b347-51f2-9a92-118071a17070",
            "itemId": "d6d91afc-c697-5f05-aab0-f14977acc2ed",
            "metadata": {
                "createdDate": "2023-08-23T20:05:37.721+00:00",
                "createdByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766",
                "updatedDate": "2023-08-23T20:05:37.721+00:00",
                "updatedByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766"
            }
        },
        {
            "id": "86f2ba8f-a4ed-48a2-8ea7-d296ff50a602",
            "holdingsRecordId": "279d7532-8dbf-578e-a4ca-09ed59e0a023",
            "itemId": "d6d91afc-c697-5f05-aab0-f14977acc2ed",
            "metadata": {
                "createdDate": "2023-08-23T20:06:03.542+00:00",
                "createdByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766",
                "updatedDate": "2023-08-23T20:06:03.542+00:00",
                "updatedByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766"
            }
        },
        {
            "id": "1e268e1f-a225-41cb-915d-da443c907e3b",
            "holdingsRecordId": "b6aa8d38-f159-5c71-a431-041526022b62",
            "itemId": "d6d91afc-c697-5f05-aab0-f14977acc2ed",
            "metadata": {
                "createdDate": "2023-08-23T20:06:18.809+00:00",
                "createdByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766",
                "updatedDate": "2023-08-23T20:06:18.809+00:00",
                "updatedByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766"
            }
        },
        {
            "id": "719f6b52-22bb-4692-9ca3-f21fb330bb11",
            "holdingsRecordId": "7424aa72-23db-580d-ac1c-89000546c8aa",
            "itemId": "d6d91afc-c697-5f05-aab0-f14977acc2ed",
            "metadata": {
                "createdDate": "2023-08-23T20:13:02.266+00:00",
                "createdByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766",
                "updatedDate": "2023-08-23T20:13:02.266+00:00",
                "updatedByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766"
            }
        },
        {
            "id": "b061085d-f557-4c1d-848c-84c6c8be56c4",
            "holdingsRecordId": "2fedbb63-7291-557e-9de1-98da45367b33",
            "itemId": "d6d91afc-c697-5f05-aab0-f14977acc2ed",
            "metadata": {
                "createdDate": "2023-08-23T20:13:26.771+00:00",
                "createdByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766",
                "updatedDate": "2023-08-23T20:13:26.771+00:00",
                "updatedByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766"
            }
        },
        {
            "id": "d3d3c60a-85f5-4a62-8f2e-331901ea9894",
            "holdingsRecordId": "6ac186f5-311d-55e5-afd5-8ac18e92517d",
            "itemId": "d6d91afc-c697-5f05-aab0-f14977acc2ed",
            "metadata": {
                "createdDate": "2024-03-20T17:46:43.686+00:00",
                "updatedDate": "2024-03-20T17:46:43.686+00:00"
            }
        }
    ],
    "totalRecords": 8
}

The last one is the holdingsRecordId for the bw parent item 6ac186f5-311d-55e5-afd5-8ac18e92517d. Maybe all we need to do to fix the problem is create an entry in this table for the bw we created? So going back to the records in folio-stage, where I created the bw relationship but I only created an entry in the bound-with-parts table for the bw-child (see this comment). I did a POST to inventory-storage/bound-with-parts using the holdingsRecordId and itemId of the parent,

curl -i -X POST \
   -H "Content-Type:application/json" \
   -H "X-Okapi-Tenant:sul" \
   -H "x-okapi-token:" \
   -d \
'{
  "holdingsRecordId": "466e561d-3d86-5701-9b1f-7d00f12855b4",
  "itemId": "c22376b9-4ab8-543c-8540-c93401269396"
}' \
 'https://okapi-stage.stanford.edu/inventory-storage/bound-with-parts'

And now the item record shows the parent and child in the boundWithTitles array, see https://folio-stage.stanford.edu/inventory/view/1c1a4b4c-8de7-57f0-82d0-4c3ce04540da/466e561d-3d86-5701-9b1f-7d00f12855b4/c22376b9-4ab8-543c-8540-c93401269396.

I agree that now, it is super confusing to figure out which is the parent and which is the child. But it probably doesn't matter after all. 🤷‍♂️ But I guess this makes it better and easier for us to make the bound with relationships in batch; we just need to POST additional data to the endpoint we are currently using and we don't have to futz around with grabbing all the bound with parts when using the other endpoint that the UI uses.

shelleydoljack commented 3 months ago

I started writing a sql script to get the bw parent item and holdings record UUID's in a file to be used to create the bw parts data for these, if we want to go this route (we probably should even though it looks confusing). It is currently on folio@sul-folio-pgpool-stage-01:get_bwparent_holdingsRecordIds.sh and uses the file bwparent_item_ids.txt as input. The result file looks like:

 00ad7381-5128-5c68-a6a8-6f7cd5383e69 | "29c7c706-ca9d-5411-b366-512a66c66e88"
 00bfae39-5ef9-5208-bbf6-abb13a0bdbbb | "b0b80292-171b-5dd5-a7f1-4950db025d3d"
 010cea4f-4dfc-5665-88f7-bdbd2a455fe6 | "320a4c8f-aab3-5d44-96dc-0e66a3372a82"
 0187d479-d90c-59f5-b458-5841386bf32e | "faff44f0-a6f2-563f-a489-2c1d27f425c9"
 0190bd17-4e56-5991-bcc4-5dfed90ef951 | "5e6317fe-6afc-5810-92df-ab71770cbce4"
 02653c0b-978a-57a4-b05e-0c841c476b2d | "8ec69cd9-401d-57c3-b4a9-6c573631dc25"
 02b83a8c-524c-5eca-86fa-dad98d40f22e | "4b61fb12-89f4-5e65-a584-9ec714329bcb"
 030ef907-a1fa-5784-96e5-a5f85f0fb9d8 | "54f0534f-1c0f-5157-b7b6-1c4ba7bf59a8"
 035f53cf-b1c2-5622-882c-9238394ac1b7 | "031d9581-fc49-5ddd-a5b6-e1b78530334d"
 03632f2b-2153-5202-9c33-237b5d0c4ae8 | "7ef286e9-3d98-520d-9763-5c103ec14cb0"

I only ran it agains the first 1,000 item record ID's. It takes about 30s to run for 1,000 ID's.

ahafele commented 2 months ago

I asked Charlotte if we should go the above route of POSTing the bw "parent" holdingsRecordId and itemId to the bound-with parts table. Her response is summarized here -

No because original one is there already - that is why it gets to display correct when you 'touch' the item record. She suggests the original solution of editing the item records (e.g. adding an admin note). But, she offered to set up a meeting with the developer if we want to investigate further - it wouldn't be till end of April because of Q release work happening right now.

@shelleydoljack I'm curious if you tried the above solution of test/poppy? In the stage example you include the "parent" doesn't display in the UI as I would expect, e.g. in Poppy they are always listed first.

shelleydoljack commented 2 months ago

Her assumption that the "original one is there already" is false; we don't have the "parent's" holdingsRecordId and itemId in that bound-with-parts table because we created that data using the storage endpoint and not the new one available in Poppy, so it only contains the holdingsRecordId of the bw children. To me, this means that we should add that missing data to the table to fix the problem, since she thinks it is already there.

My testing showed that adding an admin note didn't resolve the problem (I think, I re-read my comments and am certain that my adding the note didn't do anything; I'll try again to be certain).

ahafele commented 2 months ago

I tested adding the admin note in Nolana and it does not resolve the issue. It does resolve the issue in Poppy. I'm concerned that if we added the relationship in Nolana then something not understood happens in Poppy where the relationships "are already there".

shelleydoljack commented 2 months ago

I used bulk edit to add a note to the bw parent item record and the process did not add the bw parent to the boundWithTitles array in the item record. See https://folio-test.stanford.edu/inventory/view/11bce934-49ff-56d4-b58b-62028e8cc8af/0e6b496a-5cb0-501c-850c-1e2429bc864d/269857c4-2543-5da5-adf9-173e35f1326c

and the item data:

{
  "id" : "269857c4-2543-5da5-adf9-173e35f1326c",
  "_version" : "4",
  "status" : {
    "name" : "Available",
    "date" : "2023-08-21T13:19:45.921+00:00"
  },
  "administrativeNotes" : [ "SUL/DLSS/LibrarySystems/BWcreatedby/ahafele/20231206", "SUL/DLSS/LibrarySystems/BWcreatedby/ahafele/20231206", "test add note to see if bw parent item shows up in bwTitles array" ],
  "title" : "\" Tokkō  \" keikensha to shite tsutaetai koto / Igata Masatoshi.",
  "callNumber" : "HV8083 .I43 A3 2011",
  "hrid" : "ai9252566_1_1",
  "contributorNames" : [ {
    "name" : "Igata, Masatoshi"
  }, {
    "name" : "Tokubetsu Kōtō Keisatsu"
  }, {
    "name" : "井形正寿"
  }, {
    "name" : "特別高等警察"
  } ],
  "formerIds" : [ ],
  "discoverySuppress" : false,
  "holdingsRecordId" : "0e6b496a-5cb0-501c-850c-1e2429bc864d",
  "barcode" : "36105219529380",
  "copyNumber" : "1",
  "notes" : [ ],
  "circulationNotes" : [ ],
  "numberOfPieces" : "1",
  "tags" : {
    "tagList" : [ ]
  },
  "yearCaption" : [ ],
  "electronicAccess" : [ ],
  "statisticalCodeIds" : [ ],
  "purchaseOrderLineIdentifier" : null,
  "materialType" : {
    "id" : "1a54b431-2e4f-452d-9cae-9cee66c9a892",
    "name" : "book"
  },
  "permanentLoanType" : {
    "id" : "2b94c631-fca9-4892-a730-03ee529ffe27",
    "name" : "Can circulate"
  },
  "metadata" : {
    "createdDate" : "2023-08-21T13:27:52.656+00:00",
    "createdByUserId" : "58d0aaf6-dcda-4d5e-92da-012e6b7dd766",
    "updatedDate" : "2024-04-10T16:20:22.248+00:00",
    "updatedByUserId" : "7c22a2c8-c90f-41b1-bb75-c24190c8a69f"
  },
  "effectiveCallNumberComponents" : {
    "callNumber" : "HV8083 .I43 A3 2011",
    "prefix" : null,
    "suffix" : null,
    "typeId" : "95467209-6d7b-468b-94df-0f5d7ad2747d"
  },
  "effectiveShelvingOrder" : "HV 48083 I43 A3 42011 11",
  "isBoundWith" : true,
  "boundWithTitles" : [ {
    "briefHoldingsRecord" : {
      "id" : "fe93854d-eb1f-5a3c-9498-78385b0c5791",
      "hrid" : "ah4769069_1"
    },
    "briefInstance" : {
      "id" : "4cc915f5-6d97-5fc2-a67c-7255f4f1b109",
      "title" : "\"'Ie no hikari' mokuji sōran\" kaidai, sakuin / kanshū Yoshida Hiroshi.",
      "hrid" : "a4769069"
    }
  }, {
    "briefHoldingsRecord" : {
      "id" : "3c564526-4a76-5a8e-ae2e-6e837c3cf4be",
      "hrid" : "ah9177510_1"
    },
    "briefInstance" : {
      "id" : "4c54def8-6207-579a-b4f9-7d3ff23ab37a",
      "title" : "\"1Q84\" hihan to gendai sakkaron / Kuroko Kazuo.",
      "hrid" : "a9177510"
    }
  } ],
  "effectiveLocation" : {
    "id" : "9f085820-08a3-43bd-a080-44f65fb67b1e",
    "name" : "East Asia Japanese"
  }
}
ahafele commented 2 months ago

That is strange because when I add an admin note in the UI, the bw parent appears in the UI and (presumably in the boundWithTitles array?)

Here is a migrated record that I have not edited - 36105039040733. Shelley, could you see what is in the bw table for this record?

shelleydoljack commented 2 months ago

Great, so bulk edit and editing in the UI probably use different endpoints or maybe the logic that does the filling out of boudWithTitles array is not triggered with bulk edit somehow. 🤷 How annoying.

Here is the data in bound-with-parts for barcode 36105039040733:

curl -i -X GET \
   -H "Content-Type:application/json" \
   -H "X-Okapi-Tenant:sul" \
   -H "x-okapi-token:" \
 'https://okapi-test.stanford.edu/inventory-storage/bound-with-parts?query=itemId%3D%3D6f789556-a817-5272-8aea-792a173530b4'

{
    "boundWithParts": [
        {
            "id": "4545464a-6441-470b-aea2-a190747048ba",
            "holdingsRecordId": "16b6f234-1a69-599a-9882-78bf54ad3ae2",
            "itemId": "6f789556-a817-5272-8aea-792a173530b4",
            "metadata": {
                "createdDate": "2023-08-23T20:11:25.487+00:00",
                "createdByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766",
                "updatedDate": "2023-08-23T20:11:25.487+00:00",
                "updatedByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766"
            }
        }
    ],
    "totalRecords": 1
}
ahafele commented 2 months ago

And after I added an admin note to 36105039040733

{
    "boundWithParts": [
        {
            "id": "4545464a-6441-470b-aea2-a190747048ba",
            "holdingsRecordId": "16b6f234-1a69-599a-9882-78bf54ad3ae2",
            "itemId": "6f789556-a817-5272-8aea-792a173530b4",
            "metadata": {
                "createdDate": "2023-08-23T20:11:25.487+00:00",
                "createdByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766",
                "updatedDate": "2023-08-23T20:11:25.487+00:00",
                "updatedByUserId": "58d0aaf6-dcda-4d5e-92da-012e6b7dd766"
            }
        },
        {
            "id": "7c395b3e-bc6f-4a08-a269-ddec9a83879f",
            "holdingsRecordId": "37b0b953-dbb9-5d1a-a45e-8136f460af9c",
            "itemId": "6f789556-a817-5272-8aea-792a173530b4",
            "metadata": {
                "createdDate": "2024-04-10T20:59:39.038+00:00",
                "updatedDate": "2024-04-10T20:59:39.038+00:00"
            }
        }
    ],
    "totalRecords": 2
}
ahafele commented 2 months ago

Charlotte is going to investigate a bit with Corrie and Charles ahead of scheduling a meeting. So I've provided some example records for them here.

ahafele commented 2 months ago

Charlotte's response

Here my notes: ID internal jira ticket SUP-51800 Stanford. Issue with migrated records being bound-with connections Charles has checked some of the records provided in the list with item HRIDs. Charles was able to see what the problem is. There is no bound-with-part object for the actual item and holdings. Charles says, that this should be easily fixed via the API. Charles does not have no access to your FOLIO UI. Hi IP changed since the migration work happened, he do though have access to the APIs from one of ID's bastion hosts [8:10 AM] @alissa

  • should we do a quick meeting where Charles maybe can show you, how you can fix this by using the API?

Shelley confirmed we don't need a meeting with Charles and Charlotte followed up with

I'll recommend to do a couple of small scale test first, so you know this is working as expected. But I guess you always do that :cherry_blossom:

@shelleydoljack do you want a separate ticket for this work?

shelleydoljack commented 2 months ago

Yes, separate ticket. I'm guessing we want to update in test and stage before prod, yes?

ahafele commented 2 months ago

I think that depends on whether you want to update production data on Nolana or Poppy - do you have a preference?

ahafele commented 2 months ago

new ticket for work to update relationships #folio-tasks/304

shelleydoljack commented 2 months ago

Closing for now since we determined that our data is wrong.