Enable all flaggs for use in flagging app and display them in order according to their ranking (see app/flags/ebas_dict.yaml)

This commit is contained in:
2025-05-19 17:10:16 +02:00
parent ccd4740dba
commit e4d87080bc
3 changed files with 23 additions and 17 deletions

View File

@ -32,18 +32,24 @@ def save_file(name, content):
def filter_flags_by_label(flags_dict, label):
"""
Filters the flags dictionary by the specified label.
If label is 'all', returns all flags without filtering.
Parameters:
-----------
flags_dict (dict): The dictionary containing flags.
label (str): The label to filter by ('I' or 'V').
label (str): The label to filter by ('I', 'V', or 'all').
Returns:
--------
list: A list of dictionaries with 'label' and 'value' for the specified label.
list: A list of dictionaries with 'label' and 'value' for the specified label,
or all flags if label is 'all'.
"""
return [{'label': value['description'], 'value': code}
for code, value in flags_dict.items() if value['validity'] == label]
return [
{'label': value['description'], 'value': code}
for code, value in flags_dict.items()
if label == 'all' or value['validity'] == label
]
def create_loaded_file_figure(file_path, instFolder, dataset_name, datetime_var, datetime_var_format, variables):