Pass scale names to Snakemake correctly.

labels
junos 2022-04-05 18:14:37 +02:00
parent 99245afca3
commit 751b04f3f4
2 changed files with 5 additions and 3 deletions

View File

@ -329,7 +329,8 @@ rule preprocess_esm:
params:
provider=lambda wildcards: config["PHONE_ESM"]["PROVIDERS"][wildcards.provider_key.upper()],
provider_key="{provider_key}",
sensor_key="phone_esm"
sensor_key="phone_esm",
scales=lambda wildcards: config["PHONE_ESM"]["PROVIDERS"][wildcards.provider_key.upper()]["SCALES"]
output: "data/interim/{pid}/phone_esm_features/phone_esm_clean_{provider_key}.csv"
script:
"../src/features/phone_esm/straw/preprocess.py"

View File

@ -1,7 +1,7 @@
from esm_preprocess import *
from esm_JCQ import reverse_jcq_demand_control_scoring
requested_scales = provider["SCALES"]
requested_scales = snakemake.params["scales"]
df_esm = pd.read_csv(snakemake.input[0])
df_esm_preprocessed = preprocess_esm(df_esm)
@ -20,5 +20,6 @@ for scale in requested_scales:
mask = df_esm_clean["questionnaire_id"] == questionnaire_id
if scale.startswith("JCQ"):
df_esm_clean.loc[mask] = reverse_jcq_demand_control_scoring(df_esm_clean.loc[mask])
#TODO Reverse other questionnaires if needed and/or adapt esm_user_score to original scoring.
df_esm_clean.to_csv(snakemake.output[0])
df_esm_clean.to_csv(snakemake.output[0], index=False)