Commit cd9cec89 authored by Bruno Duyé's avatar Bruno Duyé

dataset.json: add dataset name

parent 6dd7b1a9
......@@ -109,6 +109,7 @@ def treat_dataset(dataset_dict, appendix_path):
# Create dataset dir
target_dataset_path = os.path.join(target_dir, dataset_code)
os.mkdir(target_dataset_path)
dataset_name = None
# Iterate through dataset source files
dataset_json_series_list = [] # to be written in dataset.json
for dataset_source_file_info in dataset_dict['files']:
......@@ -117,6 +118,8 @@ def treat_dataset(dataset_dict, appendix_path):
observations_source_json = None
with open(os.path.join(appendix_path, dataset_source_filename)) as dataset_file:
observations_source_json = json.load(dataset_file)
if not dataset_name:
dataset_name = next(note["NoteText"] for note in observations_source_json["Notes"] if note['NoteRef'] == dataset_code)
# Read each observation and create series files
current_series_code = None
current_observations_file = None
......@@ -149,7 +152,7 @@ def treat_dataset(dataset_dict, appendix_path):
# Write dataset.json
write_json_file(os.path.join(target_dataset_path, "dataset.json"), {
'code': dataset_code,
# 'name': , # TODO
'name': dataset_name,
'series': dataset_json_series_list,
# 'dimensions_codes_order': ,# TODO
# 'dimensions_labels': ,# TODO
......
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