Skip to content
/ procus Public

Code for deploying an system for collecting data from respondents through SMS messages.

License

Notifications You must be signed in to change notification settings

epiben/procus

Repository files navigation

PROCUS: Patient-reported outcome collection using short messages

A full-fledged system for collecting patient-reported outcome data from respondents via short messages (text messages, SMS). For now, it uses only CPSMS (cpsms.dk) as the SMS gateway.

The system requires three secrets, stored in three separate files:

  • secrets/cpsms_api_token.txt: a single-line plain-text file with the API token generated by CPSMS for sending short messages
  • secrets/cpsms_webhook_token.txt: a single-line plain-text file with a token (of your choice) that CPSMS includes in its webhook GET request as a query parameter named token, to verify that requests come from CPSMS. This is also used by tests to mimic webhook calls from CPSMS
  • secrets/ngrok_config.yaml: a configuration file for ngrok to establish a secure tunnel, see example below
  • secrets/postgres_password.txt: a single-lined plain-text file with the password for the postgres database

Because procus uses secrets, you need to spin up the services in swarm mode and, so, may first need to run docker swarm init. Otherwise, running docker-compose up will fail and close down gracefully.

Ngrok configuration file

The secrets/ngrok_config.yaml file should contain the following information (at least, see https://ngrok.com/docs/ngrok-agent/config/):

version: "2"
authtoken: <token>
tunnels:
  fastapi:
    proto: http
    addr: fastapi:5000
    domain: <ngrok_subdomain>.ngrok-free.app

Sending CPSMS-like requests

The file curl_requests.http contains cURL requests that mimic those of CPSMS through the webhook. The requests in the file use a dummy respondent (Test McUrl), created at the end of postgres/init_dml.sql. Because the phone number isn't valid, one can't test this with an actual phone.

Contributing

We welcome contributions directly to the code to improve performance as well as new functionality. For the latter, please first explain and motivate it in an issue. All development work happens in the dev branch.

Changes to the code base should follow these steps:

  • Fork the repository
  • Make a branch from the dev branch with an appropriate name, in your fork
  • Implement changes in your fork, make sure to install pre-commit and activate the pre-commit hook with pre-commit install (check_code.sh runs black, flake8 and isort for your convienence)
  • Create a pull request into the dev branch of procus

About

Code for deploying an system for collecting data from respondents through SMS messages.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published