Commit 730fdeed authored by Christophe Benz's avatar Christophe Benz

Follow dbnomics-converters changes about JSON Schema

parent 3dbebe18
......@@ -35,11 +35,7 @@ import sys
from slugify import slugify
from dbnomics_converters.base import assert_no_error
from dbnomics_converters.categories import validate_category
from dbnomics_converters.datasets import validate_dataset
from dbnomics_converters.providers import validate_provider
from dbnomics_converters.series import validate_series
from dbnomics_converters import validators
provider = dict(
......@@ -390,7 +386,7 @@ def main():
def save_node(dir, node):
if node.get('category_code') is None and node.get('dataset_code') is None and node.get('key') is None:
node = assert_no_error(validate_provider(node, format='json'))
validators.validate_provider(node)
filename = 'provider.json'
title = 'Provider {}'.format(node['name'])
elif node.get('category_code') is not None:
......@@ -398,21 +394,21 @@ def save_node(dir, node):
assert node.get('key') is None
node['code'] = node['category_code']
del node['category_code']
node = assert_no_error(validate_category(node, format='json', used_categories_code=used_categories_code))
validators.validate_category(node)
filename = 'category.json'
title = 'Category {} {}'.format(node['code'], node['name'])
elif node.get('dataset_code') is not None:
assert node.get('key') is None
node['code'] = node['dataset_code']
del node['dataset_code']
node = assert_no_error(validate_dataset(node, format='json'))
validators.validate_dataset(node)
filename = 'dataset.json'
title = 'Dataset {} {}'.format(node['code'], node['name'])
else:
assert node.get('key') is not None
node['code'] = node['key']
del node['key']
node = assert_no_error(validate_series(node, format='json'))
validators.validate_series(node)
filename = 'series.json'
title = 'Series {} {}'.format(node['code'], node['name'])
......
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