Skip to content
Snippets Groups Projects
Commit 08922f0e authored by anonymous's avatar anonymous
Browse files

corrects name of organizastion

parent e82bc07d
No related branches found
No related tags found
No related merge requests found
...@@ -102,7 +102,7 @@ class Initialization(CkanCommand): ...@@ -102,7 +102,7 @@ class Initialization(CkanCommand):
'name': "statistikamt-nord", 'name': "statistikamt-nord",
'url': "http://www.statistik-nord.de/index.php?eID=stan_xml&products=4,6&state=2", 'url': "http://www.statistik-nord.de/index.php?eID=stan_xml&products=4,6&state=2",
'source_type': "statistikamt-nord", 'source_type': "statistikamt-nord",
'title': "Statistik-Nord", 'title': "Statistikamt Nord",
'active': True, 'active': True,
'owner_org': "statistikamt-nord", 'owner_org': "statistikamt-nord",
'frequency': "MANUAL" 'frequency': "MANUAL"
......
import json
import urllib2 import urllib2
import traceback import traceback
from lxml import etree from lxml import etree
from ckan import model from ckan import model
from ckan.logic import get_action
from ckanext.harvest.model import HarvestObject from ckanext.harvest.model import HarvestObject
from ckanext.harvest.harvesters.base import HarvesterBase from ckanext.harvest.harvesters.base import HarvesterBase
...@@ -28,8 +31,8 @@ class StatistikamtNordHarvester(HarvesterBase): ...@@ -28,8 +31,8 @@ class StatistikamtNordHarvester(HarvesterBase):
@staticmethod @staticmethod
def info(): def info():
return { return {
'name': 'statistik-nord', 'name': 'statistikamt-nord',
'title': 'Statistik Nord', 'title': 'Statistikamt Nord',
'description': 'Harvests Statistikamt Nord', 'description': 'Harvests Statistikamt Nord',
'form_config_interface': 'Text' 'form_config_interface': 'Text'
} }
...@@ -206,17 +209,17 @@ class StatistikamtNordHarvester(HarvesterBase): ...@@ -206,17 +209,17 @@ class StatistikamtNordHarvester(HarvesterBase):
@staticmethod @staticmethod
def map_to_group(package_dict, values): def map_to_group(package_dict, values):
# open file with the mapping from numbers to DCAT-DE vocabulary: # open file with the mapping from numbers to DCAT-DE vocabulary:
with open('/usr/lib/ckan/default/src/ckanext-odsh/ckanext/odsh/harvesters/number_dcat_de.json') as f: with open('/usr/lib/ckan/default/src/ckanext-odsh/ckanext/odsh/harvesters/number_dcat_de_hamburg.json') as f:
dcat_theme = json.load(f) dcat_theme = json.load(f)
# get the code # get the code
code = values['StANKategorie'] code = values['StANKategorie']
authority_codes = ['agri', 'educ', 'envi', 'ener', 'tran', 'tech', all_authority_codes = ['agri', 'educ', 'envi', 'ener', 'tran', 'tech',
'econ', 'soci', 'heal', 'gove', 'regi', 'just', 'intr'] 'econ', 'soci', 'heal', 'gove', 'regi', 'just', 'intr']
# check, if StANProdukte has id 4 # check, if StANProdukte has id 4
if '4' in values['StANProdukte']: if '4' in values['StANProdukte']:
for item in authority_codes: for item in all_authority_codes:
package_dict['groups'].append({'name' : item}) package_dict['groups'].append({'name' : item})
# or if possible map it to a group # or if possible map it to a group
...@@ -224,6 +227,7 @@ class StatistikamtNordHarvester(HarvesterBase): ...@@ -224,6 +227,7 @@ class StatistikamtNordHarvester(HarvesterBase):
for item in dcat_theme[str(code)]: for item in dcat_theme[str(code)]:
package_dict['groups'].append({'name': item}) package_dict['groups'].append({'name': item})
else: else:
# put it in the na-group
package_dict['groups'].append({'name': 'na'}) package_dict['groups'].append({'name': 'na'})
log.error('Statistik-Nord-Harvester: No valid group code received: %s', code) log.error('Statistik-Nord-Harvester: No valid group code received: %s', code)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment