Skip to content
Snippets Groups Projects
Commit 064dbece authored by Fanna Lautenbach's avatar Fanna Lautenbach
Browse files

Merge branch 'hotfix/additional-meta-data' into 'main'

update dataproduct information generation to include additional meta data

See merge request !52
parents ec196eb5 9b719ca7
No related branches found
No related tags found
1 merge request!52update dataproduct information generation to include additional meta data
Pipeline #41550 passed
......@@ -8,3 +8,4 @@ integration/*.html
# Integration logs
integration/*.log
*.env
\ No newline at end of file
......@@ -151,15 +151,27 @@ def retrieve_general_dataproduct_information(sas_id):
"dataproduct_type",
"project",
"location",
"activity").distinct()
combined_data_products_on_key = {}
"activity",
"additional_meta").distinct()
combined_data_products_on_key = combine_dataproducts_on_key(data_products, {})
return combined_data_products_on_key
def combine_dataproducts_on_key(data_products, combined_data_products):
for data_product in data_products:
for key, value in data_product.items():
if combined_data_products_on_key.get(key) and value not in combined_data_products_on_key.get(key):
combined_data_products_on_key[key].append(value)
else:
combined_data_products_on_key[key] = [value]
combined_data_products = fill_unique_nested_dict(data_product, combined_data_products)
return combined_data_products
def fill_unique_nested_dict(data_product, combined_data_products_on_key):
for key, value in data_product.items():
if isinstance(value, dict):
combined_data_products_on_key = fill_unique_nested_dict(value, combined_data_products_on_key)
elif combined_data_products_on_key.get(key) and value not in combined_data_products_on_key.get(key):
combined_data_products_on_key[key].append(value)
else:
combined_data_products_on_key[key] = [value]
return combined_data_products_on_key
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment