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

Fix: duplicates series names (Closes #219)

parent 608bf316
......@@ -159,12 +159,18 @@ def treat_dataset(dataset_dict, appendix_path, appendix_dict):
def get_series_name(observation_dict, series_dimensions, dimensions_values_labels, dataset_dict, dataset_source_file_info):
"""Get or compute series name"""
if 'LineDescription' in observation_dict:
# Series name is given by provider
basename = observation_dict['LineDescription']
if "LineNumber" in observation_dict:
# If a line number (in corresponding XLS file) is given, let's add it to avoid duplicates series names (bug #219)
basename += " (line {})".format(observation_dict['LineNumber'])
if dataset_dict.get('dimension_code') == 'FREQ' and len(dataset_dict['files']) > 1:
return observation_dict['LineDescription'] + ' - ' + dimensions_values_labels['FREQ'][dataset_source_file_info["dimension_value_code"]]
# More than one frequency
return basename + ' - ' + dimensions_values_labels['FREQ'][dataset_source_file_info["dimension_value_code"]]
return observation_dict['LineDescription']
return basename
# Compute series name
# Series name is given by provider, let compute it from dimensions values
if 'FREQ' in series_dimensions.keys():
# - make FREQ dimension to be at the end
ordered_series_dimensions = list((k,v) for k,v in series_dimensions.items() if k != 'FREQ')
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