From feb8d09126cf614bb35f1019c1f2ff721720cfaa Mon Sep 17 00:00:00 2001 From: "Gerber, Mike" Date: Tue, 5 Aug 2025 20:53:43 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20MODS:=20Filter=20UUID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mods4pandas/mods4pandas.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mods4pandas/mods4pandas.py b/src/mods4pandas/mods4pandas.py index 5a05cc3..fa18c18 100755 --- a/src/mods4pandas/mods4pandas.py +++ b/src/mods4pandas/mods4pandas.py @@ -162,12 +162,16 @@ def mods_to_dict(mods, raise_errors=True): .descend(raise_errors) ) elif tag == "{http://www.loc.gov/mods/v3}recordIdentifier": + def no_uuid(record_identifier): + return record_identifier.attrib.get("type") != "uuid" + # By default we assume source="gbv-ppn" mods:recordIdentifiers (= PPNs), # however, in mods:relatedItems, there may be source="dnb-ppns", # which we need to distinguish by using a separate field name. try: value["recordIdentifier"] = ( TagGroup(tag, group) + .filter(no_uuid) .is_singleton() .has_attributes({"source": "gbv-ppn"}) .text()