From 4e3511cd551fd4bba7b4a2bbd918834539b5662e Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Tue, 30 Jul 2019 14:51:44 +0300 Subject: [PATCH] csv_metadata_quality/check.py: Fix AGROVOC lookup We actually only need to see if there are more than zero matches because a term like "Nigeria" will match in English, Spanish, etc, whereas terms that *really* don't match will have zero results. --- csv_metadata_quality/check.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/csv_metadata_quality/check.py b/csv_metadata_quality/check.py index f3b0e16..7be9f25 100755 --- a/csv_metadata_quality/check.py +++ b/csv_metadata_quality/check.py @@ -238,8 +238,8 @@ def agrovoc(field): if request.status_code == requests.codes.ok: data = request.json() - # check if there is 1 result, ie an exact subject term match - if len(data['results']) != 1: + # check if there are any results + if len(data['results']) == 0: print(f'Invalid AGROVOC subject: {value}') return field