NASA-PDS / doi-service

Service and tools for generating DOIs for PDS bundles, collections, and data sets
https://nasa-pds.github.io/doi-service
Other
2 stars 3 forks source link

Transaction Database Cron Sync Support #315

Closed collinss-jpl closed 2 years ago

collinss-jpl commented 2 years ago

🗒️ Summary

This PR makes a number of modifications to the handling of DOI transactions within both the sqlite3 database and the transaction history on disk to better accommodate scheduled synchronizations with DataCite via cron.

The DOI service now checks to see if there are any changes between a current transaction and the last available record from the transaction history/database before committing. If there have been no changes, including in the stored DataCite JSON label, the transaction is ignored to avoid clogging the database with redundant transactions:

INFO __main__:perform_import_to_database Record for DOI 10.26007/xbsh-x639 (urn:nasa:pds:compil-comet:halebopp::1.0) has not changed, skipping...
INFO __main__:perform_import_to_database Record for DOI 10.26007/yr7t-1378 (DS1-C-IDS-3-RDR-BORRELLY-V1.0) has not changed, skipping...
INFO __main__:perform_import_to_database Record for DOI 10.26007/mwyz-6q32 (DS1-C-MICAS-5-BORRELLY-DEM-V1.0) has not changed, skipping...
INFO __main__:perform_import_to_database Record for DOI 10.26007/9dtm-ym89 (EAR-C-5-DDR-PCC-V1.0) has not changed, skipping...

Some updates have also been made to better accommodate DOI records submitted by SBN with their own prefixes.

This PR also address several bugs discovered in the service since the last release, including:

⚙️ Test Data and/or Report

Unit tests have been updated to account for changes to transaction classes. Unit tests for transaction classes have been updated to test the new duplicate entry checks. tox.log

♻️ Related Issues

Partially resolves #312 (cron script still to be developed and installed)