Commit c6489663 authored by Christophe Benz's avatar Christophe Benz

Do not generate children properties anymore...

following dbnomics-converters changes
parent 2c599e92
......@@ -242,7 +242,6 @@ def main():
)
datasets_code = set()
provider['categories'] = []
source_filenames = sorted(
(
source_filename
......@@ -252,10 +251,7 @@ def main():
key=lambda filename: int(source_filename_re.match(filename).group('number')),
)
for root_category, source_filename in zip(root_categories, source_filenames):
root_category['categories'] = []
root_category_directory_name = get_category_directory_name(root_category)
provider['categories'].append(root_category_directory_name)
root_category_dir = os.path.join(args.target_dir, root_category_directory_name)
root_category_dir = os.path.join(args.target_dir, get_category_directory_name(root_category))
if not os.path.exists(root_category_dir):
os.mkdir(root_category_dir)
......@@ -288,11 +284,8 @@ def main():
sub_category = dict(
category_code='.'.join([root_category['category_code'], sub_category_relative_code]),
name=sub_category_name,
datasets=[],
)
sub_category_directory_name = get_category_directory_name(sub_category)
root_category['categories'].append(sub_category_directory_name)
sub_category_dir = os.path.join(root_category_dir, sub_category_directory_name)
sub_category_dir = os.path.join(root_category_dir, get_category_directory_name(sub_category))
if not os.path.exists(sub_category_dir):
os.mkdir(sub_category_dir)
if dataset is None or entry['TITLE'] != dataset['name']:
......@@ -321,11 +314,8 @@ def main():
dataset_code=dataset_code, # Will be renamed to `code` in `save_node`.
dimensions_codes_order=['freq', 'unit', 'geo'],
name=entry['TITLE'],
series=[],
)
dataset_directory_name = get_dataset_directory_name(dataset)
sub_category['datasets'].append(dataset_directory_name)
dataset_dir = os.path.join(sub_category_dir, dataset_directory_name)
dataset_dir = os.path.join(sub_category_dir, get_dataset_directory_name(dataset))
if not os.path.exists(dataset_dir):
os.mkdir(dataset_dir)
else:
......@@ -359,9 +349,7 @@ def main():
)
for period, value in islice(entry.items(), 5, None)
]
series_directory_name = get_series_directory_name(series)
dataset['series'].append(series_directory_name)
series_dir = os.path.join(dataset_dir, series_directory_name)
series_dir = os.path.join(dataset_dir, get_series_directory_name(series))
if not os.path.exists(series_dir):
os.mkdir(series_dir)
save_node(series_dir, series)
......
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