Skip to content

Commit

Permalink
Field method refactor for OaiDc and SpringshareOaiDc transforms (#177)
Browse files Browse the repository at this point in the history
Why these changes are being introduced:
* These updates are required to implement the architecture described
in the following ADR: https://github.com/MITLibraries/transmogrifier/blob/main/docs/adrs/0005-field-methods.md

How this addresses that need:
* Refactor base transform class OaiDc to contain get_*
methods for optional fields
* Make 'source_record' the first argument in OaiDc field methods
* Move 'or None' to the return statements of field methods
* Remove 'source_record_id' as param, replace with call inside field method instead
* Raise SkippedRecordEvent
  * OaiDc.get_source_record_id
  * SpringshareOaiDc.get_source_link
* Update unit tests
  * Remove OaiDc and SpringshareOaiDc record_* fixtures

Side effects of this change:
* None

Relevant ticket(s):
* https://mitlibraries.atlassian.net/browse/TIMX-283
  • Loading branch information
jonavellecuerdo authored May 28, 2024
1 parent 526705e commit e351409
Show file tree
Hide file tree
Showing 7 changed files with 757 additions and 226 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ ipython_config.py
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# asdf
.tool-versions

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
Expand Down
6 changes: 0 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,11 @@ def marc_content_type_crosswalk():
return load_external_config("config/marc_content_type_crosswalk.json", "json")


# oaidc ##########################


@pytest.fixture
def oai_pmh_records():
return XMLTransformer.parse_source_file("tests/fixtures/oai_pmh_records.xml")


# timdex ##########################


@pytest.fixture
def timdex_record_required_fields():
return timdex.TimdexRecord(
Expand Down
26 changes: 0 additions & 26 deletions tests/fixtures/oai_dc/oaidc_record_valid_generic_date.xml

This file was deleted.

Loading

0 comments on commit e351409

Please sign in to comment.