Begin with stress events in the ERS script.
parent
0b3e9226b3
commit
f3c6a66da9
|
@ -259,7 +259,8 @@ rule extract_event_information_from_esm:
|
||||||
stage = "extract",
|
stage = "extract",
|
||||||
pid = "{pid}"
|
pid = "{pid}"
|
||||||
output:
|
output:
|
||||||
"data/raw/ers/{pid}_ers.csv"
|
"data/raw/ers/{pid}_ers.csv",
|
||||||
|
"data/raw/ers/{pid}_stress_event_targets.csv"
|
||||||
script:
|
script:
|
||||||
"../src/features/phone_esm/straw/process_user_event_related_segments.py"
|
"../src/features/phone_esm/straw/process_user_event_related_segments.py"
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,9 @@ def extract_ers_from_file(esm_df, device_id):
|
||||||
config = yaml.load(stream, Loader=yaml.FullLoader)
|
config = yaml.load(stream, Loader=yaml.FullLoader)
|
||||||
|
|
||||||
|
|
||||||
|
pd.DataFrame().to_csv(snakemake.output[1]) # Create an empty stress event file either way
|
||||||
|
|
||||||
|
|
||||||
esm_preprocessed = clean_up_esm(preprocess_esm(esm_df))
|
esm_preprocessed = clean_up_esm(preprocess_esm(esm_df))
|
||||||
|
|
||||||
# Take only ema_completed sessions responses
|
# Take only ema_completed sessions responses
|
||||||
|
@ -69,13 +72,19 @@ def extract_ers_from_file(esm_df, device_id):
|
||||||
extracted_ers["shift"] = extracted_ers["diffs"].apply(lambda x: format_timestamp(x))
|
extracted_ers["shift"] = extracted_ers["diffs"].apply(lambda x: format_timestamp(x))
|
||||||
|
|
||||||
elif targets_method == "stress_event":
|
elif targets_method == "stress_event":
|
||||||
pass
|
|
||||||
|
pd.DataFrame().to_csv(snakemake.output[1])
|
||||||
|
|
||||||
|
# TODO: generiranje ERS datoteke za stress_events
|
||||||
# VV Testiranje različnih povpraševanj za VV
|
# VV Testiranje različnih povpraševanj za VV
|
||||||
# print(esm_df[esm_df.questionnaire_id == 87])
|
# print(esm_df[esm_df.questionnaire_id == 87])
|
||||||
# filter_esm = esm_df[(esm_df.esm_type == 7) & ((esm_df.questionnaire_id == 90.) | (esm_df.questionnaire_id == 91.))][['questionnaire_id', 'esm_user_answer', 'esm_session']]
|
# filter_esm = esm_df[(esm_df.esm_type == 7) & ((esm_df.questionnaire_id == 90.) | (esm_df.questionnaire_id == 91.))][['questionnaire_id', 'esm_user_answer', 'esm_session']]
|
||||||
# print(filter_esm[filter_esm.esm_user_answer == "1 - Še vedno traja"].shape)
|
# print(filter_esm[filter_esm.esm_user_answer == "1 - Še vedno traja"].shape)
|
||||||
# print(filter_esm.shape)
|
# print(filter_esm.shape)
|
||||||
|
|
||||||
|
# TODO: generiranje stress_events_targets datoteke (dodaj tudi stolpec s pid) + dodati moraš merge metodo, ki bo združila te datoteke
|
||||||
|
# TODO: na koncu se mora v čistilni skripti ustrezno odstraniti vse targete in prilepiti nove targete zraven ustreznih segmentov (zna se zgoditi, da bodo overlap)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise Exception("Please select correct target method for the event-related segments.")
|
raise Exception("Please select correct target method for the event-related segments.")
|
||||||
extracted_ers = pd.DataFrame(columns=["label", "event_timestamp", "length", "shift", "shift_direction", "device_id"])
|
extracted_ers = pd.DataFrame(columns=["label", "event_timestamp", "length", "shift", "shift_direction", "device_id"])
|
||||||
|
|
Loading…
Reference in New Issue