Take device ID into consideration for grouping sessions.

communication
junos 2021-06-07 16:44:42 +02:00
parent 8306e99392
commit 35a7fa0bbc
1 changed files with 6 additions and 4 deletions

View File

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