A collection of scripts used to identify available electronic resources and reconcile data between NYPL & BPL Sierra and OverDrive's Discovery APIs.
The reconciliation requires an export of data from Sierra and access to the OverDrive Discovery APIs. OverDrive API credentials should be in a YAML file and include the following keys:
---
CLIENT_KEY: overdrive_client_key
CLIENT_SECRET: overdrive_client_secret
LIBRARY_ID: library_idTo begin the reconciliation process, verify with staff responsible for loading OverDrive records that there are no outstanding files in the OverDrive Marketplace and all available records have been loaded into both BPL and NYPL Sierra. Only after receving a confirmation all OverDrive Reserve IDs are in Sierra should one begin creating lists in Sierra for export.
Use following the searches in Sierra to create a list. If large list files are unavailable use Sierra bib IDs to track extracted data and combine partial reports into one file.
Because of the large number of OverDrive records in NYPL Sierra (over 300,000) attempting to create one large list in tends to fail. It's a good strategy to use smaller (ie. 10,000 records) lists before running a large one (ie. 100,000 records). It is also recommended to limit the start and end bib ID number to the smallest slice of the database possible.
The BPL query can be retrieved from Sierra as the 2022-Overdrive ALL bibs-tak saved search, or loaded from this JSON file.
The NYPL query can be loaded from this JSON file
Store Record Type: BIBLIOGRAPHIC b
Start: b170902584
Stop: b*
| Operator | Type | Field | Condition | Value A |
|---|---|---|---|---|
| BIBLIOGRAPHIC | MARC Tag 037|a | not equal to | "" | |
| AND | BIBLIOGRAPHIC | MARC Tag 037|b | has | "overdrive" |
| AND | BIBLIOGRAPHIC | MARC Tag 856|u | All Fields don't have | "serialssolutions" |
| AND | BIBLIOGRAPHIC | Call No. | starts with | "enypl" |
| AND | BIBLIOGRAPHIC | Bib Level | not equal to | "s" |
Store Record Type: BIBLIOGRAPHIC b
Start: b112402306
Stop: b*
| Operator | Type | Field | Condition | Value A |
|---|---|---|---|---|
| BIBLIOGRAPHIC | MARC Tag 003 | not equal to | "wasess" | |
| AND | BIBLIOGRAPHIC | MARC Tag 037|a | not equal to | "" |
| AND | BIBLIOGRAPHIC | MARC Tag 037|b | has | "overdrive" |
| AND | BIBLIOGRAPHIC | MARC Tag 856|u | All Fields don't have | "serialssolutions" |
| AND | BIBLIOGRAPHIC | Bib Level | not equal to | "s" |
Export the following fields from the list:
| Type | Field |
|---|---|
| BIBLIOGRAPHIC | Record Number |
| BIBLIOGRAPHIC | MARC Tag 037|a |
Use default export values:
Field delimiter: ,
Text qualifier: "
Repeated field delimiter: `;
Maximum field length: <none>
- Activate virtual environment
- Change working directory to the main repo directory
- In the command line run the following:
$ python run.py reconcile {library} {path-to-sierra-export-file}BPL example:
$ python run.py reconcile BPL "./temp/overdrive-all-sierra-export.txt"The above routine verifies a resource's availability by scraping the OverDrive website for the resource. This webscraping is prone to timeouts on the OverDrive server.
CLI shows traceback to a timeout error (last resource processed was number 626):

If that happens, simply note the number of the next resource to be checked and restart the process utilizing the following command:
$ python run.py webscrape {library} {path to csv} {row to start from} {path to csv} is the path to the appropriate {library}-for-deletion-verification-required.csv file created by the previous steps in the script. If restarting the process on the same day the command can be simplified by entering default instead of providing the full path to the csv:
$ python run.py webscrape BPL default 627The reconciliation script creates a designated directory where all reports are saved: overdrive-reconcile/files/{library}/{YYYY-MM-DD}/.
The scripts generate the following reports (actionable reports have the FINAL prefix in the filename):
{library}-FINAL-available-resources.csv{library}-FINAL-duplicate-reserveid-sierra.csv{library}-FINAL-for-deletion-verified-resources.csv{library}-FINAL-for-import-missing-resources.csv{library}-false-positive-for-deletion.csv{library}-for-deletion-verification-required.csv(temp, work file){library}-for-import-verification-required.csv(temp, work file){library}-overdrive-api-reserve-ids.csv(temp, work file){library}-sierra-prepped-reserve-ids.csv(temp, work file){library}-sierra-rejected-not-overdrive-ids.csv(work file){library}-unique-reserveid-sierra.csv(temp, work file)
This report contains a list of duplicate resources discovered in the ILS based on OverDrive Reserve ID. The csv contains Bib IDs and reserve IDs.
This report provides a list of records that can be deleted from Sierra because the library no longer has access to the resource or because OverDrive removed the resource from their catalog. Please take extra precautions deleting records from Sierra. It is possible that occasionally an item record belonging to a print version of the resource is attached to electronic resource bib in Sierra. In such cases a new record for print must be first brought from WorldCat, then the item should be transfered to it before the bib for the electronic resource can be deleted.
This report contains a list of reserve IDs that can be used to create a MARC file in OverDrive Marketplace to then load into Sierra.
This report includes resources that were not present in the inventory retrieved from the OverDrive Digital Inventory API, but were discovered in the ILS and the verification routine (webscraping of OverDrive catalog - see details below) found that in fact they are available to our patrons.
The script analyzes OverDrive data pulled from the ILS (Sierra) and compares it with data pulled from the OverDrive Digital Inventory API. These two sets acquire information from two different sources: OverDrive Marketplace MARC records and the OverDrive Discovery APIs. Resources found in both sets are considered to be available and are left alone. Resources identified as only being found in the OverDrive Digital Inventory API can be used to create a MARC file in the OverDrive Marketplace so that MARC records for those resources can be ingested into the ILS. Resources found only in Sierra may indicate they are no longer available from OverDrive. Deletion verification though webscraping of OverDrive catalog is needed.
After identifying resources that can be deleted from Sierra the list is verified via web scraping the OverDrive catalog.
1.2.2 - (10/26/2026)
- updated github actions to use uv and setup-uv
- updated dependencies:
beautifulsoup44.13.4 -> 4.15.0certifi2025.8.3 -> 2026.10.23charset-normalizer3.4.2 -> 3.5.2idna3.10 -> 3.20numpy2.3.2 -> 2.5.4pandas-stubs2.3.0.250703 -> 3.0.5.260914pandas3.0.2 -> 3.1.0python-dateutil2.9.0post0 -> 3.0.0pyyaml6.0.2 -> 6.0.3requests2.32.4 -> 2.34.2soupsieve2.7 -> 3.0.4types-html5lib1.1.11.2025.07.08 -> 1.1.11.20260518types-pyyaml6.0.12.20250516 -> 6.0.12.20260906types-requests2.32.4.20250611 -> 2.33.0.20261006typing-extensions4.14.1 -> 4.16.0tzdata2025.2 -> 2026.5urllib32.5.0 -> 2.8.0 - updated dev dependencies:
pytest8.4.2 -> 9.1.1pytest-cov6.2.1 -> 7.1.0pytest-mock3.15.0 -> 3.17.0
1.2.1 - (5/21/2026)
jsonquery used in sierra to exclude serial records
1.1.0 - (2/14/2024)
- step in the instruction to confirm all Overdrive MarcExpress records have been loaded to the ILS
- information about credentials format
- added requests (2.31.0) to dependencies
- local simplyE credentials moved to
~/.cred/.simplyE/directory - updated dependencies:
- beautifulsoup4 (4.12.3)
- pandas (2.2.0)
- pymarc (4.2.2)
- SQLAlchemy (2.0.27)
- psycopg2 (2.9.9)
- updated dev dependencies:
- black (22.12.0)
- pytest (7.4.4)
- refactored tests based on updated dependencies
- removed unused dependencies
