From 35a7fa0bbc19dc7361e1aebd881b05e7370b7827 Mon Sep 17 00:00:00 2001 From: junos Date: Mon, 7 Jun 2021 16:44:42 +0200 Subject: [PATCH] Take device ID into consideration for grouping sessions. --- exploration/expl_esm.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/exploration/expl_esm.py b/exploration/expl_esm.py index 6e332c2..72bf376 100644 --- a/exploration/expl_esm.py +++ b/exploration/expl_esm.py @@ -13,8 +13,6 @@ # name: straw2analysis # --- -import datetime - # %% import os import sys @@ -129,12 +127,16 @@ df_esm_preprocessed.query("participant_id == 31 & esm_session == 77")[[ "esm_tri df_session_counts[(df_session_counts["esm_session_count"] > 40)] # %% -df_esm_preprocessed.query("participant_id == 83").sort_values("_id")[[ "esm_trigger","datetime_lj", "_id", "username"]] +df_esm_preprocessed.query("participant_id == 83").sort_values("_id")[[ "esm_trigger","datetime_lj", "_id", "username", "device_id"]] # %% [markdown] # Both, session ID and \_ID (and others) reset on application reinstall. Here, it can be seen that the application was reinstalled on 2 April (actually, the phone was replaced as reported by the participant). # -# Session IDs should therefore be grouped while taking the timestamp into account (e.g. by sorting first). +# Session IDs should therefore be grouped while taking the device ID into account. + +# %% +session_counts_device = df_esm_preprocessed.groupby(["participant_id", "device_id", "esm_session"]).count()["id"] +sns.displot(session_counts_device.to_numpy(), binwidth=1, height=8) # %% [markdown] # ## Other possibilities