From e88d35ace37a1ec7eb97c0ac8eff0fb2e32b73a9 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Sun, 28 Jul 2019 17:27:20 +0300 Subject: [PATCH] csv_metadata_quality/app.py: Use regex in column match Check for a column that has "issn" or "isbn" in the name rather than by its explicit name, as the column is dc.identifier.issn now, but will be cg.issn in the future if CG Core v2 happens. --- csv_metadata_quality/app.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/csv_metadata_quality/app.py b/csv_metadata_quality/app.py index 7b5f3e7..bb8a6c6 100644 --- a/csv_metadata_quality/app.py +++ b/csv_metadata_quality/app.py @@ -17,10 +17,14 @@ def main(): # Run invalid multi-value separator check on all columns df[column] = df[column].apply(check.separators) - if column == 'dc.identifier.issn': + # check if column is an issn column like dc.identifier.issn + match = re.match(r'^.*?issn.*$', column) + if match is not None: df[column] = df[column].apply(check.issn) - if column == 'dc.identifier.isbn': + # check if column is an isbn column like dc.identifier.isbn + match = re.match(r'^.*?isbn.*$', column) + if match is not None: df[column] = df[column].apply(check.isbn) # check if column is a date column like dc.date.issued