1
0
mirror of https://github.com/ilri/csv-metadata-quality.git synced 2024-11-22 05:45:02 +01:00

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.
This commit is contained in:
Alan Orth 2019-07-30 14:51:44 +03:00
parent 1fd3d8bc2f
commit 4e3511cd55
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9

View File

@ -238,8 +238,8 @@ def agrovoc(field):
if request.status_code == requests.codes.ok: if request.status_code == requests.codes.ok:
data = request.json() data = request.json()
# check if there is 1 result, ie an exact subject term match # check if there are any results
if len(data['results']) != 1: if len(data['results']) == 0:
print(f'Invalid AGROVOC subject: {value}') print(f'Invalid AGROVOC subject: {value}')
return field return field