Skip to content

TIMX 655 - handle deletes for researchdatabases - #276

Closed
ghukill wants to merge 4 commits into
mainfrom
TIMX-655-researchdatabases-deletes
Closed

TIMX 655 - handle deletes for researchdatabases#276
ghukill wants to merge 4 commits into
mainfrom
TIMX-655-researchdatabases-deletes

Conversation

@ghukill

@ghukill ghukill commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

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?

  • Include links to Jira Software and/or Jira Service Management tickets here.

Code review

  • Code review best practices are documented here and you are encouraged to have a constructive dialogue with your reviewers about their preferences and expectations.

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
@ghukill

ghukill commented Aug 11, 2026

Copy link
Copy Markdown
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.

@ghukill ghukill closed this Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant