Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TIMX-234 Update aspace identifiers logic #102

Merged
merged 1 commit into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 35 additions & 39 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
<unitid>
<emph>Data enclosed in subelement</emph>
</unitid>
<unitid type="aspace_uri">
<emph>unitid-that-should-not-be-identifier</emph>
</unitid>
<abstract>
<emph>Data enclosed in subelement</emph>
</abstract>
Expand Down
9 changes: 9 additions & 0 deletions tests/test_ead.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,15 @@ def test_ead_record_invalid_date_and_date_range_are_omitted(caplog):
) in caplog.text


def test_ead_record_correct_identifiers_from_multiple_unitid(caplog):
ead_xml_records = parse_xml_records(
"tests/fixtures/ead/ead_record_attribute_and_subfield_variations.xml"
)
output_record = next(Ead("aspace", ead_xml_records))
for identifier in output_record.identifiers:
assert identifier.value != "unitid-that-should-not-be-identifier"


def test_ead_record_with_missing_optional_fields_transforms_correctly():
ead_xml_records = parse_xml_records(
"tests/fixtures/ead/ead_record_missing_optional_fields.xml"
Expand Down
2 changes: 2 additions & 0 deletions transmogrifier/sources/ead.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ def get_optional_fields(self, xml: Tag) -> Optional[dict]:
for id_element in collection_description_did.find_all(
"unitid", recursive=False
):
if id_element.get("type") == "aspace_uri":
continue
if id_value := self.create_string_from_mixed_value(
id_element,
" ",
Expand Down