Compare commits

..

No commits in common. "bb1e1900a45f44e8ba6efbcd5d77a3140588780b" and "936324d234b6636366b1a569793452a4cca54847" have entirely different histories.

1 changed files with 1 additions and 3 deletions

View File

@ -46,15 +46,13 @@ def extract_ers_from_file(esm_df, device_id): # TODO: session_id groupby -> spre
# Extract time-relevant information
extracted_ers = esm_df.groupby(["device_id", "esm_session"])['timestamp'].apply(lambda x: math.ceil((x.max() - x.min()) / 1000)).reset_index() # in rounded up seconds
extracted_ers = extracted_ers[extracted_ers["timestamp"] <= 15 * 60].reset_index(drop=True) # ensure that the longest duration of the questionnaire anwsering is 15 min
# TODO: Rename "timestamp" column meaningfully.
extracted_ers = extracted_ers[extracted_ers["timestamp"] <= 15 * 60].reset_index(drop=True) # ensure that the longest duration of the questionnaire anwsering is 15 min
time_before_questionnaire = 30 * 60 # in seconds (30 minutes)
extracted_ers["label"] = "straw_event_" + snakemake.params["pid"] + "_" + extracted_ers.index.astype(str).str.zfill(3)
extracted_ers["event_timestamp"] = esm_df.groupby("esm_session")['timestamp'].min().reset_index()['timestamp']
extracted_ers["length"] = (extracted_ers["timestamp"] + time_before_questionnaire).apply(lambda x: format_timestamp(x))
# TODO: Think about adding questionnaire duration.
extracted_ers["shift"] = time_before_questionnaire
extracted_ers["shift"] = extracted_ers["shift"].apply(lambda x: format_timestamp(x))
extracted_ers["shift_direction"] = -1