Pass scale names to Snakemake correctly.
parent
99245afca3
commit
751b04f3f4
|
@ -329,7 +329,8 @@ rule preprocess_esm:
|
||||||
params:
|
params:
|
||||||
provider=lambda wildcards: config["PHONE_ESM"]["PROVIDERS"][wildcards.provider_key.upper()],
|
provider=lambda wildcards: config["PHONE_ESM"]["PROVIDERS"][wildcards.provider_key.upper()],
|
||||||
provider_key="{provider_key}",
|
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"
|
output: "data/interim/{pid}/phone_esm_features/phone_esm_clean_{provider_key}.csv"
|
||||||
script:
|
script:
|
||||||
"../src/features/phone_esm/straw/preprocess.py"
|
"../src/features/phone_esm/straw/preprocess.py"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from esm_preprocess import *
|
from esm_preprocess import *
|
||||||
from esm_JCQ import reverse_jcq_demand_control_scoring
|
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 = pd.read_csv(snakemake.input[0])
|
||||||
df_esm_preprocessed = preprocess_esm(df_esm)
|
df_esm_preprocessed = preprocess_esm(df_esm)
|
||||||
|
@ -20,5 +20,6 @@ for scale in requested_scales:
|
||||||
mask = df_esm_clean["questionnaire_id"] == questionnaire_id
|
mask = df_esm_clean["questionnaire_id"] == questionnaire_id
|
||||||
if scale.startswith("JCQ"):
|
if scale.startswith("JCQ"):
|
||||||
df_esm_clean.loc[mask] = reverse_jcq_demand_control_scoring(df_esm_clean.loc[mask])
|
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)
|
||||||
|
|
Loading…
Reference in New Issue