Skip to content

Ethica Surveys

spillihp edited this page Feb 17, 2022 · 1 revision

Ethica EMA Surveys

The EMA surveys allows the research team to gather information such as participant mood in real-time, by periodically sending short questionnaires while the study is taking place. The questions asked and corresponding variable names and potential answers can be found in INTERACT’s data dictionary. The process_emas.py script is able to load all EMA surveys in a single study and summarize all questionnaires into a single flat CSV file. This script is located at https://github.com/TeamINTERACT/process_emas.

Collection

Participant responses are uploaded by the individual phones and cached on Ethica Data's servers until the end of the study.

Migration

Once the study has ended for all participants, a coordinator can download all responses for the study via Ethica’s study dashboard. The result will be a single zip file, with a sub-directory labelled as ‘responses’ containing a single csv file for each questionnaire during the study. (Note that the same questionnaire could be sent multiple times to the same participant) This file must then be moved to the Cedar cluster on Compute Canada and decompressed into any directory the individual running the process_emas.py script would have permission to access.

Ingest Preparation

Before the process_emas script can be executed, INTERACT’s linkage table in the PostgreSQL must be be updated with the corresponding identifiers of each participant in the study for that study. For more information on the linkage table, see: LINK.

In addition, a csv linkage file must be manually prepared, with one row for each question that are to be included in the study. This file must contain the following columns:

  • City: The three-letter code identifying which city the study took place in.
  • EthicaStudyID: The integer identifier for the entire study.
  • SurveyID: Ethica’s integer identifier for a single questionnaire (which may contain multiple questions)
  • HasData: Either “yes” or “no” (or True or False). Represents whether or not this question has any data for this study. If “no”, the question will be skipped, regardless of whether it actually has data or not.
  • QID: Ethica’s integer identifier for the question.
  • QuestionLabel: The string identifier INTERACT uses for the question, as it appears in the data dictionary.
  • QuestionText: The text of the question asked to the participant for this particular question.

Running the Script

The script’s dependencies can be found in the requirements.txt file, and installed with the following command: pip install -r requirements.txt

The script can be run with python version 3.6 or higher with the following command: python process_emas.py full/path/to/DATA_DIRECTORY full/path/to/SURVEY_CODE_FILE.csv

Output

The script will summarize all questionnaires into a single csv file in the directory the script was run from, with the following naming scheme: ema_survey_[3-letter city code]_[EthicaStudyID].csv

Clone this wiki locally