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

create bookplate_fund_po_lines task #1243

Closed shelleydoljack closed 1 month ago

shelleydoljack commented 1 month ago

This task checks if fund Id from invoice lines data struct contains a bookplate fund. The input of this task is a data structure like this:

    [
      {
        "fadacf66-8813-4759-b4d3-7d506db38f48": {
          "fund_ids": [
            "0e8804ca-0190-4a98-a88d-83ae77a0f8e3"
          ],
          "poline_id": "b5ba6538-7e04-4be3-8a0e-c68306c355a2"
        }
      }
    ]

It is "invoice_line_uuid": with fund_ids and poline_id objects. This task needs to lookup in the digital bookplates table the fund_id and remove from the list objects that are not in the bookplates table. There could be mutliple fund_ids per invoice line. If at least 1 of them is a bookplate fund, we want to keep it for adding a 979 to the instance. We don't need to keep the invoice line in our output data at this point and we should use this to get the data we need to add 979 fields so the output should return po lines and the bookplate metadata, e.g.:

[
  {
    "bookplate_metadata": { "druid": "", "fund_name": "", "image_filename": "", "title": "" },
    "poline_id": [
      "798596da-12a6-4c6d-8d3a-3bb6c54cb2f1",
      "7a5888fe-689b-4cfe-a27d-c2675a235203"
    ]
  }
]
shelleydoljack commented 1 month ago

Just want to note this conversation on the PR that created the data structure that is the input of this task: https://github.com/sul-dlss/libsys-airflow/pull/1239#discussion_r1788032521