Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ckanext-odsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open-Data
ckanext-odsh
Commits
08922f0e
Commit
08922f0e
authored
6 years ago
by
anonymous
Browse files
Options
Downloads
Patches
Plain Diff
corrects name of organizastion
parent
e82bc07d
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
ckanext/odsh/commands/initialization.py
+1
-1
1 addition, 1 deletion
ckanext/odsh/commands/initialization.py
ckanext/odsh/harvesters/statistikamtnordharvester.py
+9
-5
9 additions, 5 deletions
ckanext/odsh/harvesters/statistikamtnordharvester.py
with
10 additions
and
6 deletions
ckanext/odsh/commands/initialization.py
+
1
−
1
View file @
08922f0e
...
@@ -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
'
:
"
Statistik
amt
Nord
"
,
'
active
'
:
True
,
'
active
'
:
True
,
'
owner_org
'
:
"
statistikamt-nord
"
,
'
owner_org
'
:
"
statistikamt-nord
"
,
'
frequency
'
:
"
MANUAL
"
'
frequency
'
:
"
MANUAL
"
...
...
This diff is collapsed.
Click to expand it.
ckanext/odsh/harvesters/statistikamtnordharvester.py
+
9
−
5
View file @
08922f0e
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
'
:
'
statistik
amt
-nord
'
,
'
title
'
:
'
Statistik Nord
'
,
'
title
'
:
'
Statistik
amt
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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment