Skip to content

Commit

Permalink
Fixes #83. Extract emailsf from Geoportal datasets
Browse files Browse the repository at this point in the history
  • Loading branch information
amercader committed Oct 8, 2018
1 parent b18ca6f commit 4d188df
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ckanext/lacounts/harvest/harvesters/esri.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import json

from rdflib.namespace import Namespace

from ckanext.dcat.harvesters import DCATRDFHarvester
from ckanext.dcat.profiles import EuropeanDCATAPProfile
from ckanext.lacounts.helpers import toolkit
Expand All @@ -11,6 +13,10 @@
log = logging.getLogger(__name__)


VCARD = Namespace("http://www.w3.org/2006/vcard/ns#")
DCAT = Namespace("http://www.w3.org/ns/dcat#")


class LacountsESRIGeoportalHarvester(DCATRDFHarvester):
'''
A CKAN Harvester for ESRI Geoportals.
Expand Down Expand Up @@ -73,4 +79,12 @@ def _remove_pkg_dict_extra(pkg_dict, key):
if val:
dataset_dict[name] = val

# See project-open-data/project-open-data.github.io#621
for agent in self.g.objects(dataset_ref, DCAT.contactPoint):
email = self._without_mailto(
self._object_value(agent, VCARD.email)
)
if email:
dataset_dict['contact_email'] = email

return dataset_dict

0 comments on commit 4d188df

Please sign in to comment.