TIMX 655 - handle deletes for researchdatabases - #276
Closed
ghukill wants to merge 4 commits into
Closed
Conversation
Why these changes are being introduced: With the proposed introduction of a new ReseaarchDatabases transformation class that may also use the LibGuides API, it makes sense to have it refactored out of libguides.py. How this addresses that need: The LibGuidesAPIClient is refactored to helpers.py. Side effects of this change: * None Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/TIMX-655
Why these changes are being introduced: It turns out that the Springshare OAI endpoint that we harvest AZ items (research databases) has *never* produced deletes. Without those deleted records / tombstones in OAI, we were not successfully removing records from TIMDEX. Transmogrifier is currently the place in the TIMDEX ETL ecosystem where records are first written to the dataset, and most commonly, if they are records to index or delete. There may come a time when explicit pre-transform work is performed to establish source records in the TIMDEX dataset, then we transform them, but Transmogrifier has historically been responsible for that double duty and continues to be at this time. Ultimately, we need to identify AZ items that are no longer publicly available and establish `action=delete` records in the TIMDEX dataset to have them removed. The OAI harvester is less per-source opinionated than Transmogrifier, making it a poor choice for this. How this addresses that need: A new ResearchDatabases transformer class has been created. Formerly, the TIMDEX source `researchdatabases` used the Springshare transformer class as a naive OAIDC XML transformation. This new class changes nothing about the metadata transformation, but allows for a place to identify records that were formerly indexed in TIMDEX but are no longer publicly accessible. There is precedence here in the libguides source, which also performs some additional work via the Springshare API. With that scaffolding already present, it was a relatively simple addition to have researchdatabases do a bit of extra work beyond the OAI XML records provided. The ResearchDatabases transformer does something unique: while yielding the OAI XML records provided by the harvester like normal, it also queries the Springshare API and identifies records we've seen before but are no longer public. For these a *synthetic* OAI XML record is injected into the records yielded by this class for transformation. Those are handled by pre-existing logic and ultimately get written to the TIMDEX dataset with `action=delete`. Side effects of this change: * The researchdatabase source now requires the Springshare API credentials that formerly only the libguides source required. * If AZ items are deleted or hidden, they should get removed from TIMDEX now. Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/TIMX-655
Why these changes are being introduced: There were some edge cases with the reliance on the env var LAST_AZ_IDENTIFIERS_PATH for identifying deletes in researchdatabases: - env var is not set - file does not exist - desire to NOT check for deletes How this addresses that need: Now, ResearchDatabases transformer only queries the Springshare API if the env var LAST_AZ_IDENTIFIERS_PATH is set. If the file does not exist it will create it. This keeps the source fully backwards compatible, but when the env var is set, it is utilized and deletes are detected. Side effects of this change: * researchdatabases source remains fully backwards compatbile until env var LAST_AZ_IDENTIFIERS_PATH is set. Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/TIMX-655
Contributor
Author
|
Will keep the branch, but pivoting on approach. This was writing a text file to S3 with a list of identifiers. Instead, we can query the TIMDEX dataset directly for what it thinks are current records, then ensure that matches Springshare's OAI/API results. All without juggling text files. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose and background context
Describe the overall purpose of the PR changes and any useful background context.
How can a reviewer manually see the effects of these changes?
Explain how to see the proposed changes in the application if possible.
Delete this section if it isn't applicable to the PR.
Includes new or updated dependencies?
YES | NO
Changes expectations for external applications?
YES | NO
What are the relevant tickets?
Code review