Skip to content

Commit

Permalink
Fix some issues with push_dcat.py
Browse files Browse the repository at this point in the history
  • Loading branch information
lbam committed Oct 10, 2022
1 parent 57922d8 commit f1f2006
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion utils/data.overheid.nl/push_dcat.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ def _convert_to_ckan(dcat: dict) -> dict:

# Remove duplicates and sort for easy comparison
themes = sorted(list(set([MAP_THEMES[theme] for theme in dcat["dcat:theme"]])))
if not themes:
# Having at least one theme is mandatory.
# Use the most generic one if we have none.
themes = ['http://standaarden.overheid.nl/owms/terms/Bestuur']

tags = [{"name": keyword} for keyword in sorted(list(set(dcat["dcat:keyword"])))]

if dcat["ams:license"] == "other-not-open":
Expand Down Expand Up @@ -192,7 +197,6 @@ def _convert_to_ckan(dcat: dict) -> dict:
),
"language": [language],
"contact_point_name": dcat["dcat:contactPoint"]["vcard:fn"],
"contact_point_email": dcat["dcat:contactPoint"]["vcard:hasEmail"],
"publisher": "http://standaarden.overheid.nl/owms/terms/Amsterdam",
"theme": themes,
"tags": tags,
Expand All @@ -203,6 +207,11 @@ def _convert_to_ckan(dcat: dict) -> dict:
"source_catalog": "https://data.amsterdam.nl/",
"access_rights": access_rights,
}

email = dcat["dcat:contactPoint"].get("vcard:hasEmail")
if email:
ckan["contact_point_email"] = email

return ckan


Expand Down

0 comments on commit f1f2006

Please sign in to comment.