From f5c17aa7ceb3624a7d218223548ff939c8bfe7e5 Mon Sep 17 00:00:00 2001 From: junos Date: Wed, 1 Dec 2021 18:14:27 +0100 Subject: [PATCH] Incorporate DB query for usernames into snakemake workflow. --- participants/prepare_usernames_file.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/participants/prepare_usernames_file.py b/participants/prepare_usernames_file.py index 5d1e5d1..8170af7 100644 --- a/participants/prepare_usernames_file.py +++ b/participants/prepare_usernames_file.py @@ -1,4 +1,10 @@ import datetime +import os +import sys + +nb_dir = os.path.split(os.getcwd())[0] +if nb_dir not in sys.path: + sys.path.append(nb_dir) import pandas as pd from features.timezone import get_timezone_data @@ -16,10 +22,10 @@ participants_inactive_usernames = participants.query_db.get_usernames( ) participants_overview_si = pd.read_csv( - "E:/STRAWbaseline/Participants_overview_Slovenia.csv", sep=";" + snakemake.params["baseline_folder"] + "Participants_overview_Slovenia.csv", sep=";" ) participants_overview_be = pd.read_csv( - "E:/STRAWbaseline/Participants_overview_Belgium.csv", sep=";" + snakemake.params["baseline_folder"]+ "Participants_overview_Belgium.csv", sep=";" ) participants_true_si = participants_overview_si[ @@ -47,7 +53,7 @@ participants_usernames_empatica["empatica_id"] = participants_usernames_empatica ].str.replace(",", ";") participants_usernames_empatica.to_csv( - here("rapids/data/external/main_study_participants.csv"), + snakemake.output["usernames_file"], header=True, index=False, line_terminator="\n", @@ -56,7 +62,7 @@ participants_usernames_empatica.to_csv( timezone_df = get_timezone_data(participants_inactive_usernames) timezone_df.to_csv( - here("rapids/data/external/timezone.csv"), + snakemake.output["timezone_file"], header=True, index=False, line_terminator="\n",