diff --git a/.gitignore b/.gitignore index 1c6594d..46e0b5b 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ __pycache__/ /data/*input*.csv /data/daily* /data/intradaily* +/data/raw /data/stressfulness_event* /data/30min* /presentation/*scores.csv diff --git a/exploration/expl_esm_labels.py b/exploration/expl_esm_labels.py index 5f79ce9..086678d 100644 --- a/exploration/expl_esm_labels.py +++ b/exploration/expl_esm_labels.py @@ -33,6 +33,7 @@ from features.esm_SAM import extract_stressful_events # %% save_figs = False +export_data = True # %% participants_inactive_usernames = participants.query_db.get_usernames( @@ -278,6 +279,41 @@ df_esm_SAM_threat_challenge_summary_participant.groupby("event subscale").descri "std" ] +# %% +df_esm_SAM_clean.columns + +# %% +df_esm_SAM_clean.esm_status.value_counts() + +# %% +if export_data: + df_esm_SAM_for_export = df_esm_SAM_clean[ + [ + "participant_id", + "username", + "device_id", + "_id", + "esm_trigger", + "esm_session", + "esm_notification_id", + "question_id", + "questionnaire_id", + "double_esm_user_answer_timestamp", + "datetime_lj", + "date_lj", + "time", + "esm_user_answer", + "esm_user_answer_numeric", + ] + ] + df_esm_SAM_for_export.sort_values( + by=["participant_id", "datetime_lj", "_id"], ignore_index=True, inplace=True + ) + print(df_esm_SAM_for_export.head()) + df_esm_SAM_for_export.to_csv( + "../data/raw/df_esm_SAM_daily_threat_challenge.csv", index=False + ) + # %% [markdown] # ## Stressfulness of period