sul-dlss / libsys-airflow

Airflow DAGS for migrating and managing ILS data into FOLIO along with other LibSys workflows
Apache License 2.0
5 stars 0 forks source link

Instance paid on 2 bookplate funds got one 979 #1365

Open shelleydoljack opened 2 days ago

shelleydoljack commented 2 days ago

From this ticket https://github.com/sul-dlss/libsys-airflow/issues/1322 there is an instance ID that should have 2 979 for WHITEHEAD and STEINMETZ but it got 1. https://folio-test.stanford.edu/inventory/viewsource/b6e80385-3be3-4e84-a530-d89d072af46b?qindex=id&query=b6e80385-3be3-4e84-a530-d89d072af46b&sort=title

Need to find the dag run from digital_bookplate_instances that triggered digital_bookplate_979 to find out what happened.

shelleydoljack commented 1 day ago

Here is the XCOM for this one at task bookplate_fund_polines with po line ID ccee2e77-6c14-40b6-9e77-192b54576e34 https://sul-libsys-airflow-dev.stanford.edu/xcom?dag_id=digital_bookplate_instances&task_id=process-new-funds.bookplate_funds_polines&execution_date=2024-10-25T23:07:02%2B00:00&map_index=121

And here is hte XCOM for this one at the task instance_from_po_lines: https://sul-libsys-airflow-dev.stanford.edu/dags/digital_bookplate_instances/grid?root=&execution_date=2024-10-25T23%3A07%3A02%2B00%3A00&tab=xcom&dag_run_id=manual__2024-10-25T23%3A07%3A02%2B00%3A00&task_id=process-new-funds.instances_from_po_lines&map_index=121

There might be a bug in triggering the digital_bookplate_979. The return for that tasks is just the list of dag run ids so we can't see what the data looked like that was sent. If the dag run for this one is the 121st index in the list of dag run IDs, it is dag run ID manual2024-10-25T23:11:40.380475+00:00, then it is this one: https://sul-libsys-airflow-dev.stanford.edu/dags/digital_bookplate_979/grid?run_id=manual__2024-10-25T23%3A11%3A40.380475%2B00%3A00&execution_date=2024-10-25+23%3A11%3A40.380475%2B00%3A00&dag_run_id=manual2024-10-25T23%3A11%3A40.380475%2B00%3A00

It shows it was triggered with the two bookplate funds and one instance ID:

{
    "druids_for_instance_id": {
        "b6e80385-3be3-4e84-a530-d89d072af46b": [
            {
                "druid": "nc092rd1979",
                "fund_name": "STEINMETZ",
                "image_filename": "nc092rd1979_00_0001.jp2",
                "title": "Verna Pace Steinmetz Endowed Book Fund in History"
            },
            {
                "druid": "ph944pq1002",
                "fund_name": "WHITEHEAD",
                "image_filename": "ph944pq1002_00_0001.jp2",
                "title": "Barry Whitehead Memorial Book Fund"
            }
        ]
    }
}

The return value for add_979_marc_tags looks correct:

{'979': [{'ind1': ' ', 'ind2': ' ', 'subfields': [{'f': 'STEINMETZ'}, {'b': 'druid:nc092rd1979'}, {'c': 'nc092rd1979_00_0001.jp2'}, {'d': 'Verna Pace Steinmetz Endowed Book Fund in History'}]}, {'ind1': ' ', 'ind2': ' ', 'subfields': [{'f': 'WHITEHEAD'}, {'b': 'druid:ph944pq1002'}, {'c': 'ph944pq1002_00_0001.jp2'}, {'d': 'Barry Whitehead Memorial Book Fund'}]}]}

Here is the log for add_marc_tags_to_record:

2024-10-25, 23:13:48 UTC] {utils.py:68} INFO - Constructing MARC tag 979
[2024-10-25, 23:13:48 UTC] {utils.py:117} INFO - Skip adding duplicated 979 field
[2024-10-25, 23:13:48 UTC] {utils.py:82} INFO - Constructing MARC record: {"leader": "00985cam a22003017  4500", "fields": [{"001": "in00000029302"}, {"008": "991209s1907    enk           000 0 eng d"}, {"005": "20231129185408.4"}, {"035": {"ind1": " ", "ind2": " ", "subfields": [{"a": "(OCoLC)ocm42964914 "}]}}, {"040": {"ind1": " ", "ind2": " ", "subfields": [{"a": "IUL"}, {"b": "eng"}, {"c": "IUL"}, {"d": "UKMGB"}, {"d": "OCLCQ"}]}}, {"016": {"ind1": "7", "ind2": " ", "subfields": [{"a": "002263097"}, {"2": "Uk"}]}}, {"035": {"ind1": " ", "ind2": " ", "subfields": [{"a": "(OCoLC)42964914"}]}}, {"050": {"ind1": " ", "ind2": "4", "subfields": [{"a": "PR6023.O7"}, {"b": "C15"}]}}, {"100": {"ind1": "1", "ind2": " ", "subfields": [{"a": "Lorrimer, Charlotte."}]}}, {"245": {"ind1": "1", "ind2": "4", "subfields": [{"a": "The call of the East."}]}}, {"260": {"ind1": " ", "ind2": " ", "subfields": [{"a": "London,"}, {"b": "Gay and Bird,"}, {"c": "1907."}]}}, {"300": {"ind1": " ", "ind2": " ", "subfields": [{"a": "265 pages"}]}}, {"336": {"ind1": " ", "ind2": " ", "subfields": [{"a": "text"}, {"b": "txt"}, {"2": "rdacontent"}]}}, {"337": {"ind1": " ", "ind2": " ", "subfields": [{"a": "unmediated"}, {"b": "n"}, {"2": "rdamedia"}]}}, {"338": {"ind1": " ", "ind2": " ", "subfields": [{"a": "volume"}, {"b": "nc"}, {"2": "rdacarrier"}]}}, {"340": {"ind1": " ", "ind2": " ", "subfields": [{"m": "8vo."}, {"2": "rdabf"}]}}, {"776": {"ind1": "0", "ind2": "8", "subfields": [{"i": "Online version:"}, {"a": "Lorrimer, Charlotte."}, {"t": "Call of the East."}, {"d": "London, Gay and Bird, 1907"}, {"w": "(OCoLC)890949848"}]}}, {"029": {"ind1": "1", "ind2": " ", "subfields": [{"a": "DEBBG"}, {"b": "BV017144610"}]}}, {"029": {"ind1": "1", "ind2": " ", "subfields": [{"a": "NZ1"}, {"b": "6760284"}]}}, {"029": {"ind1": "1", "ind2": " ", "subfields": [{"a": "UKMGB"}, {"b": "002263097"}]}}, {"979": {"ind1": " ", "ind2": " ", "subfields": [{"f": "WHITEHEAD"}, {"b": "druid:ph944pq1002"}, {"c": "ph944pq1002_00_0001.jp2"}, {"d": "Barry Whitehead Memorial Book Fund"}]}}, {"994": {"ind1": " ", "ind2": " ", "subfields": [{"a": "Z0"}, {"b": "STF"}]}}, {"948": {"ind1": " ", "ind2": " ", "subfields": [{"h": "NO HOLDINGS IN STF - 11 OTHER HOLDINGS"}]}}, {"999": {"ind1": "f", "ind2": "f", "subfields": [{"s": "63416ec0-32a1-418f-80dd-973c9028cdd3"}, {"i": "b6e80385-3be3-4e84-a530-d89d072af46b"}]}}]}
[2024-10-25, 23:13:49 UTC] {_client.py:1038} INFO - HTTP Request: PUT https://okapi-test.stanford.edu/change-manager/parsedRecords/63416ec0-32a1-418f-80dd-973c9028cdd3 "HTTP/1.1 202 Accepted"
[2024-10-25, 23:13:49 UTC] {utils.py:59} INFO - Successfully updated FOLIO Instance b6e80385-3be3-4e84-a530-d89d072af46b with SRS 63416ec0-32a1-418f-80dd-973c9028cdd3

It skipped adding a duplicated field (was there already a 979 for this record or did it interpret the STEINMETZ 979 as a duplicate?). Maybe the new_tag we are constructing isn't appending the second 979 but rather overwriting the first 979?