From ae38a826ec21c1298b515498a69a67c5b40adf4f Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Tue, 25 Jun 2024 11:48:45 +0300 Subject: [PATCH] csv_metadata_quality/fix.py: minor update to DOI fix Normalize www.doi.org to doi.org in DOI field. --- csv_metadata_quality/fix.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/csv_metadata_quality/fix.py b/csv_metadata_quality/fix.py index ae17f7e..59e0b14 100755 --- a/csv_metadata_quality/fix.py +++ b/csv_metadata_quality/fix.py @@ -441,6 +441,13 @@ def normalize_dois(field): pattern = re.compile(r"dx\.doi\.org") match = re.findall(pattern, new_value) + if match: + new_value = re.sub(pattern, "doi.org", new_value) + + # Convert www.doi.org to doi.org + pattern = re.compile(r"www\.doi\.org") + match = re.findall(pattern, new_value) + if match: new_value = re.sub(pattern, "doi.org", new_value)