Skip to content

Instantly share code, notes, and snippets.

View ninadicara's full-sized avatar

Nina ninadicara

View GitHub Profile
graph TD
subgraph 1. Starting EMA Session
A[Initiate EMA session from scheduler] -->B(Send hello message and first question to all participants via API)
B -->|Error recieved| D1[Log Error]
B -->|Sent successfully| D2[Increment question counter for each participant]
end
subgraph 2. Fielding Incoming Messages
D2 --> D3[Incoming message received. Log number, message body, datetime.]
D3 --> D4{{Load contains Twilio signature?}}
D4 -->|No| D5[Return 403]
@ninadicara
ninadicara / EMA_Schedule.md
Last active October 23, 2020 15:02
Generate a semi-randomised EMA schedule

EMA Scheduler

The ema_schedule module defines a class that produces a schedule for EMA 'beeps' (survey time points). This version does not contain 'sense-checking' for the arguments inputs.

It expects start_time and end_time as floats that represent 24 hour time (i.e. 4.30pm would be entered as 16.5)

Algorithm Attribution

The algorithm implemented here was based on pseudo-code from George MacKerron's PhD thesis [page 89], originally used as part of the 'Mappiness' project.

@ninadicara
ninadicara / installed_packages.py
Created August 19, 2020 10:24
Get a list of all currently installed python packages by date
# Taken and modified from 'jof' on https://stackoverflow.com/questions/24736316/see-when-packages-were-installed-updated-using-pip
# Modification is to use pkg_resources.working_set instead of pip.get_installed_distributions()
from __future__ import print_function
from datetime import datetime
import os
import pkg_resources
if __name__ == "__main__":
install.packages(c("purrr", "dplyr"))
library(purrr)
library(dplyr)
#Import and label your files
A <- #import A, B, C and D as dataframes
B <-
C <-
D <-