Skip to content
Draft
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
12 changes: 10 additions & 2 deletions metadata_mapper/mappers/ucd_json/ucd_json_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ def UCLDC_map(self) -> dict[str]:
}

def get_legacy_couch_id(self) -> str:
ark = [v for v in self.source_metadata.get("identifier", [])
identifier = self.source_metadata.get("identifier", [])
if isinstance(identifier, str):
identifier = [identifier]

ark = [v for v in identifier
if v.startswith("ark:")]

return f"{self.collection_id}--{ark[0]}"
Expand Down Expand Up @@ -104,8 +108,12 @@ def skip(self, record: UcdJsonRecord) -> bool:
if not thumbnail_url:
return True

identifier = record.get("identifier", [])
if isinstance(identifier, str):
identifier = [identifier]

return not any([v.startswith("ark:") for v
in record.get("identifier", [])])
in identifier])

def parse(self, api_response: str) -> list:
records = []
Expand Down
Loading