From 97c350ec62e03d34f1d39129258b598b3ba57ab8 Mon Sep 17 00:00:00 2001 From: JHogenboom Date: Wed, 5 Jun 2024 19:33:27 +0200 Subject: [PATCH] change format of central result --- triplestore-collaboration-descriptives/central.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/triplestore-collaboration-descriptives/central.py b/triplestore-collaboration-descriptives/central.py index f4cf546..febd9bd 100644 --- a/triplestore-collaboration-descriptives/central.py +++ b/triplestore-collaboration-descriptives/central.py @@ -58,12 +58,14 @@ def central(client: AlgorithmClient) -> Any: return "All partial results returned empty and partial tasks might have failed, check node logs." try: - # Create a dictionary with the organisation name, sample size, and FAIRification information - results = {res['organisation']: {"sample_size": res['sample_size'], "variable_info": res['variable_info']} - for res in _results} + # Fetch the results for every organisation + org_names_set = set(org_names) + results = [org_info for org_info in _results if org_info['organisation'] in org_names_set] + + # Add missing organisations to the results + missing_orgs = org_names_set - {org_info['organisation'] for org_info in results} + results.extend({"organisation": org_name} for org_name in missing_orgs) - # Add any missing organisations to the results dictionary - results = {org_name: results.get(org_name, "missing") for org_name in org_names} except Exception as e: error(f"Unknown error occurred when combining results, error: {e}.") return f"Unknown error occurred when combining results, error: {e}."