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 messagessecrets/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 namedtoken
, to verify that requests come from CPSMS. This is also used by tests to mimic webhook calls from CPSMSsecrets/ngrok_config.yaml
: a configuration file for ngrok to establish a secure tunnel, see example belowsecrets/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.
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
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.
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 withpre-commit install
(check_code.sh
runs black, flake8 and isort for your convienence) - Create a pull request into the
dev
branch ofprocus