From b12973adb16da72704d9b5d60c9d5aa9218ddf64 Mon Sep 17 00:00:00 2001 From: "Gerber, Mike" Date: Fri, 13 Jun 2025 20:29:12 +0200 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=90=9B=20Fix=20alto4pandas=20CLI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mods4pandas/alto4pandas.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mods4pandas/alto4pandas.py b/src/mods4pandas/alto4pandas.py index 2e9f6cb..500ac31 100755 --- a/src/mods4pandas/alto4pandas.py +++ b/src/mods4pandas/alto4pandas.py @@ -252,7 +252,7 @@ def main(): for prefix, uri in ns.items(): ET.register_namespace(prefix, uri) - process() + process_command() if __name__ == "__main__": From 814bc57401baaef06b0b18cf34d98583ccc8e058 Mon Sep 17 00:00:00 2001 From: "Gerber, Mike" Date: Wed, 30 Jul 2025 13:03:50 +0200 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=A7=B9=20Fix=20recordIdentifier=20att?= =?UTF-8?q?ribute=20'type'=20'zdb'=20=20to=20the=20correct=20'source'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mods4pandas/lib.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/mods4pandas/lib.py b/src/mods4pandas/lib.py index 0cf0407..4bf182f 100644 --- a/src/mods4pandas/lib.py +++ b/src/mods4pandas/lib.py @@ -269,6 +269,14 @@ class TagGroup: counts = {f"{xpath_expr}-count": len(values)} return counts + def fix_recordIdentifier_source_zdb(self) -> TagGroup: + for e in self.group: + if e.get("type") == "zdb": + e.attrib["source"] = "zdb" + del e.attrib["type"] + warnings.warn("Fixed recordIdentifier type 'zdb' to source") + return self + def sorted_groupby(iterable, key=None): """ From c25de380b41646b7591123ab66d629373f5ec719 Mon Sep 17 00:00:00 2001 From: "Gerber, Mike" Date: Wed, 30 Jul 2025 13:56:43 +0200 Subject: [PATCH 3/4] =?UTF-8?q?=E2=9C=A8=20mods:issuance?= 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 d1a3d4f..5a05cc3 100755 --- a/src/mods4pandas/mods4pandas.py +++ b/src/mods4pandas/mods4pandas.py @@ -320,6 +320,10 @@ def mods_to_dict(mods, raise_errors=True): elif tag == "{http://www.loc.gov/mods/v3}mods": # XXX Ignore nested mods:mods for now (used in mods:subject) pass + elif tag == "{http://www.loc.gov/mods/v3}issuance": + value["issuance"] = ( + TagGroup(tag, group).is_singleton().has_no_attributes().text() + ) else: if raise_errors: raise ValueError('Unknown tag "{}"'.format(tag)) From feb8d09126cf614bb35f1019c1f2ff721720cfaa Mon Sep 17 00:00:00 2001 From: "Gerber, Mike" Date: Tue, 5 Aug 2025 20:53:43 +0200 Subject: [PATCH 4/4] =?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()