Commit 628d2872 authored by Willem ter Berg's avatar Willem ter Berg

Merge branch 'data.overheid.nl' into public.version

parents 1fe8f984 2af305a3
......@@ -52,6 +52,7 @@ class DONLPlugin(plugins.SingletonPlugin, tk.DefaultDatasetForm):
"""
schema = super(DONLPlugin, self).create_package_schema()
schema = schema_factory.get_schema('DCAT-AP-DONL').create_schema(schema)
schema = schema_factory.get_schema('Data.Overheid').create_schema(schema)
return schema
......@@ -63,6 +64,7 @@ class DONLPlugin(plugins.SingletonPlugin, tk.DefaultDatasetForm):
"""
schema = super(DONLPlugin, self).update_package_schema()
schema = schema_factory.get_schema('DCAT-AP-DONL').update_schema(schema)
schema = schema_factory.get_schema('Data.Overheid').update_schema(schema)
return schema
......@@ -74,6 +76,7 @@ class DONLPlugin(plugins.SingletonPlugin, tk.DefaultDatasetForm):
"""
schema = super(DONLPlugin, self).show_package_schema()
schema = schema_factory.get_schema('DCAT-AP-DONL').show_schema(schema)
schema = schema_factory.get_schema('Data.Overheid').show_schema(schema)
return schema
......
......@@ -13,14 +13,14 @@
"en-UK": "Planned"
}
},
"http://data.overheid.nl/status/in onderzoek": {
"http://data.overheid.nl/status/in_onderzoek": {
"code": "in onderzoek",
"labels": {
"nl-NL": "In onderzoek",
"en-UK": "Being researched"
}
},
"http://data.overheid.nl/status/niet beschikbaar": {
"http://data.overheid.nl/status/niet_beschikbaar": {
"code": "niet beschikbaar",
"labels": {
"nl-NL": "Niet schikbaar",
......
# encoding: utf-8
"""
Module that applies the system properties of data.overheid.nl to the CKAN schema.
"""
import ckan.plugins.toolkit as tk
def create_schema(schema):
"""
Modifies the CKAN package_create schema to include the data.overheid system properties.
:param schema: dict, the current CKAN schema
:return: dict, the updated schema
"""
optional = tk.get_validator('ignore_missing')
to_extras = tk.get_converter('convert_to_extras')
is_date = tk.get_validator('is_date')
is_bool = tk.get_validator('boolean_validator')
schema.update({
'restriction_statement': [optional, to_extras],
'referentiedata': [optional, is_bool, to_extras],
'high_value': [optional, is_bool, to_extras],
'basisregister': [optional, is_bool, to_extras],
'duplicate_resources': [optional, to_extras]
})
schema['resources'].update({
'link_status': [optional, is_bool],
'link_last_checked_date': [optional, is_date],
'is_duplicate_of': [optional]
})
return schema
def update_schema(schema):
"""
Modifies the CKAN package_update schema to include the data.overheid system properties.
:param schema: dict, the current CKAN schema
:return: dict, the updated schema
"""
optional = tk.get_validator('ignore_missing')
to_extras = tk.get_converter('convert_to_extras')
is_date = tk.get_validator('is_date')
is_bool = tk.get_validator('boolean_validator')
schema.update({
'restriction_statement': [optional, to_extras],
'referentiedata': [optional, is_bool, to_extras],
'high_value': [optional, is_bool, to_extras],
'basisregister': [optional, is_bool, to_extras],
'duplicate_resources': [optional, to_extras]
})
schema['resources'].update({
'link_status': [optional, is_bool],
'link_last_checked_date': [optional, is_date],
'is_duplicate_of': [optional]
})
return schema
def show_schema(schema):
"""
Modifies the CKAN package_show schema to include the data.overheid system properties.
:param schema: dict, the current CKAN schema
:return: dict, the updated schema
"""
optional = tk.get_validator('ignore_missing')
from_extras = tk.get_converter('convert_from_extras')
schema.update({
'restriction_statement': [from_extras, optional],
'referentiedata': [from_extras, optional],
'high_value': [from_extras, optional],
'basisregister': [from_extras, optional],
'duplicate_resources': [from_extras, optional]
})
schema['resources'].update({
'link_status': [optional],
'link_last_checked_date': [optional],
'is_duplicate_of': [optional]
})
return schema
......@@ -5,6 +5,7 @@ Factory module that exposes modules which modify the CKAN schema.
"""
import ckanext.dcatdonl.schema.dcat_ap_donl_schema as dcat_ap_donl_schema
import ckanext.dcatdonl.schema.data_overheid_schema as data_overheid_schema
class SchemaException(Exception):
......@@ -12,7 +13,8 @@ class SchemaException(Exception):
_SCHEMAS = {
'DCAT-AP-DONL': dcat_ap_donl_schema
'DCAT-AP-DONL': dcat_ap_donl_schema,
'Data.Overheid': data_overheid_schema
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment