lehigh-university-libraries / folio-oclc-holdings

Set and withdraw holdings in OCLC based on recently updated FOLIO records.
Apache License 2.0
4 stars 1 forks source link

Folio Holdings to OCLC

Set and withdraw holdings in OCLC based on recently updated FOLIO records. The tool utilizes the FOLIO and OCLC APIs and is intended to run daily via a scheduled task / cron. It has no UI but emails out a report when complete.

The specific FOLIO records to review are loaded via the GET /inventory/instances API with a query on a specific statusUpdatedDate. By default, yesterday's date is used. Another date may be specified as a command line argument.

The OCLC records are updated via the WorldCat Metadata API v2.

Basic Operation

flowchart TD

    FTO[FOLIO Holdings to OCLC]

    FTO -- Step 1 --> Query>Query Updated Instances:<br/>statusUpdatedDate =<br/>Yesterday]
        --> FOLIO[(FOLIO)]

    FTO -- Step 2: For Each Instance --> Status{Instance<br/> Status?}
    OCLC[(OCLC)]
    Status -- Set --> Set>Set Holdings] --> OCLC
    Status -- Withdraw --> Withdraw>Withdraw Holdings] 
        --> OCLC

    FTO -- Step 3 --> Email>Email Report]
        --> Recipieints[/Recipients/]

    Cron["Task Scheduler:<br/>Run Daily"] --> FTO

Dependencies

The tool requires Python 3.x+.

Install from PIP

Additional Dependencies

Configuration

Copy/rename example.properties and configure its parameters. Not all parameters are defined below.

Folio Section

For connecting to and using the FOLIO APIs. All properties are required. Notes:

Oclc Section

Properties to connect to the OCLC API. Both properties are required.

Email Section

For sending a report email after operation. All properties are required.

Logging Section

Program output is written to the specified log_file. All properties are optional.

Testing Section

For testing OCLC operations against specific records (see details). All properties are optional.

How to Run

Basic Operation

py .\folio_to_oclc\folio_holdings_to_oclc.py --config=CONFIG_FILE

Command Line Arguments

usage: folio_holdings_to_oclc.py [-h] -c, CONFIG_FILE [-d QUERY_DATE]

Set or delete FOLIO holdings in OCLC.

options:
  -h, --help            show this help message and exit
  -c, CONFIG_FILE, --config CONFIG_FILE
                        Path to the properties file
  -d QUERY_DATE, --date QUERY_DATE
                        Date of FOLIO updates to query, format YYYY-MM-DD.
                        Default is yesterday.