diff --git a/exploration/expl_esm.py b/exploration/expl_esm.py new file mode 100644 index 0000000..c41780a --- /dev/null +++ b/exploration/expl_esm.py @@ -0,0 +1,37 @@ +# --- +# jupyter: +# jupytext: +# formats: ipynb,py:percent +# text_representation: +# extension: .py +# format_name: percent +# format_version: '1.3' +# jupytext_version: 1.11.2 +# kernelspec: +# display_name: straw2analysis +# language: python +# name: straw2analysis +# --- + +# %% +import os +import sys + +nb_dir = os.path.split(os.getcwd())[0] +if nb_dir not in sys.path: + sys.path.append(nb_dir) +import participants.query_db +from features.esm import * + +# %% +df_esm_nokia = get_esm_data(["nokia_0000003"]) +print(df_esm_nokia) + +# %% +df_esm_nokia_json = pd.json_normalize(df_esm_nokia["esm_json"]).drop(columns=["esm_trigger"]) +df_esm_nokia_full = df_esm_nokia.join(df_esm_nokia_json) + +# %% +df_esm_nokia_full.loc[df_esm_nokia_full["esm_user_answer"].str.contains("Remove"),"esm_user_answer"].value_counts() + +# %% diff --git a/features/esm.py b/features/esm.py index 1783c20..b3e0fc4 100644 --- a/features/esm.py +++ b/features/esm.py @@ -22,7 +22,7 @@ def get_esm_data(usernames: Collection) -> pd.DataFrame: Returns ------- df_esm: pd.DataFrame - A dataframe of call data. + A dataframe of esm data. """ query_esm = ( session.query(ESM, Participant.username)