Export SAM data.

master
junos 2023-07-03 18:25:40 +02:00
parent 51201c2bc9
commit 5c0e2e2621
2 changed files with 37 additions and 0 deletions

1
.gitignore vendored
View File

@ -12,6 +12,7 @@ __pycache__/
/data/*input*.csv
/data/daily*
/data/intradaily*
/data/raw
/data/stressfulness_event*
/data/30min*
/presentation/*scores.csv

View File

@ -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