Browse Source

[WIP] Start calculating concordance.

Note, workday and morning EMAs have not been properly dealt with, but assumed answered.
communication
junos 1 year ago
parent
commit
7177c8429f
  1. 1
      .gitignore
  2. 5
      features/esm.py
  3. 44
      statistical_analysis/concordance.py

1
.gitignore

@ -4,3 +4,4 @@ __pycache__/
*/__pycache__/
/exploration/*.ipynb
/config/*.ipynb
/statistical_analysis/*.ipynb

5
features/esm.py

@ -106,4 +106,7 @@ def classify_sessions_adherence(df_esm_preprocessed: pd.DataFrame) -> pd.DataFra
# TODO What can be done about workday EMA.
return sessions_grouped.count()
df_session_counts.loc[df_session_counts.session_response.isna(), "session_response"] = "esm_finished"
# TODO But for now, simply take all other ESMs as answered.
return df_session_counts

44
statistical_analysis/concordance.py

@ -0,0 +1,44 @@
# ---
# 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
import datetime
import seaborn as sns
import pandas as pd
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 *
# %%
baseline_si = pd.read_csv('E:/STRAWbaseline/results-survey637813.csv')
baseline_be_1 = pd.read_csv('E:/STRAWbaseline/results-survey358134.csv')
baseline_be_2 = pd.read_csv('E:/STRAWbaseline/results-survey413767.csv')
baseline = pd.concat([baseline_si, baseline_be_1, baseline_be_2], join="inner").reset_index().drop(columns="index")
# %%
participants_inactive_usernames = participants.query_db.get_usernames(collection_start=datetime.date.fromisoformat("2020-08-01"))
# %%
baseline_inactive = baseline[baseline["Gebruikersnaam"].isin(participants_inactive_usernames)]
# %%
df_esm_inactive = get_esm_data(participants_inactive_usernames)
df_esm_preprocessed = preprocess_esm(df_esm_inactive)
Loading…
Cancel
Save