From 47e2d2e832e9735e873bd2a8a3f15cd2d6bd82b0 Mon Sep 17 00:00:00 2001 From: Vincent Emonet Date: Mon, 8 Apr 2024 10:09:12 +0200 Subject: [PATCH] add admin dq as dataowner of nodes too --- backend/src/decentriq.py | 7 ++++++- backend/src/upload.py | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/src/decentriq.py b/backend/src/decentriq.py index dae8703..231dd57 100644 --- a/backend/src/decentriq.py +++ b/backend/src/decentriq.py @@ -63,6 +63,10 @@ def create_provision_dcr(user: Any, cohort: Cohort) -> dict[str, Any]: user["email"], data_owner_of=[data_node_id], ) + builder.add_participant( + settings.decentriq_email, + data_owner_of=[data_node_id], + ) # Build and publish DCR dcr_definition = builder.build() dcr = client.publish_analytics_dcr(dcr_definition) @@ -114,7 +118,7 @@ async def create_compute_dcr( user: Any = Depends(get_current_user), ) -> dict[str, Any]: """Create a Data Clean Room for computing with the cohorts requested using Decentriq SDK""" - users = [user["email"]] + # users = [user["email"]] # TODO: cohorts_request could also be a dict of union of cohorts to merge # {"cohorts": {"cohort_id": ["var1", "var2"], "merged_cohort3": {"cohort1": ["weight", "sex"], "cohort2": ["gender", "patient weight"]}}} # We automatically merge the cohorts, figuring out which variables are the same thanks to mappings @@ -197,6 +201,7 @@ async def create_compute_dcr( # Add users permissions builder.add_participant(user["email"], data_owner_of=data_nodes, analyst_of=["prepare-data", *preview_nodes]) + builder.add_participant(settings.decentriq_email, data_owner_of=data_nodes, analyst_of=["prepare-data", *preview_nodes]) # Build and publish DCR dcr_definition = builder.build() diff --git a/backend/src/upload.py b/backend/src/upload.py index cba2c4a..c767f48 100644 --- a/backend/src/upload.py +++ b/backend/src/upload.py @@ -197,6 +197,7 @@ def load_cohort_dict_file(dict_path: str, cohort_id: str, user_email: str) -> Da ) try: df = pd.read_csv(dict_path) + # df = pd.read_csv(dict_path, encoding="utf-8") df = df.dropna(how="all") df = df.fillna("") df.columns = df.columns.str.strip()