screensmart is the working title for the CATja project.
First, obtain the OpenCPU staging password (needed to access screensmart-r) by running this command: ssh -qt stag-screensmart-web1 'sudo cat /var/www/catja.roqua-staging.nl/current/.env | grep OPENCPU_PASSWORD' Add a file .env.local, containing the output of the last command:
# .env.local
OPENCPU_PASSWORD=<OPENCPU_PASSWORD found in above command>`
Then, as usual:
bundle
rails server
git clone [email protected]:roqua/deployer.git
cd deployer
bin/app-release screensmart staging
bin/app-deploy screensmart staging
bin/app-release screensmart production
bin/app-deploy screensmart production
When a new screensmart-r version is released which changes the API / schema,
screensmart needs to be adapted to match this schema.
spec/support/mock_all_calls_to_r.rb
contains instructions and helpers to do this
+--------------+ +-------------+
| | | |
- Stores events as JSON | PostgreSQL | | Sparkpost | - Service for e-mails
| | | |
+--------------+ +-------------+
^ ^
| |
| |
| |
| |
| |
| |
| |
| |
+---------------------+ +-----------+
- authorizes browser requests | |<---------+ | - user interface
- makes authenticated API requests | screensmart | | Browser |
| +--------->| |
+---------------------+ +-----------+
| ^
| |
| |
| |
| |
| |
v |
+--------------------------+
| OpenCPU |
| |
| +---------------------+ | - determines next question based on answer
| | | | - source of questions & domains
| | screensmart-r | |
| | | |
| +---------------------+ |
+--------------------------+
Screensmart has the requirement that researchers are able to determine how long someone took to think of an answer, and see all the steps someone took to finish their response.
Because of this, Screensmart uses Event Sourcing to model responses. Every Response has a unique UUID, which can have various events happen to it:
invitation_sent
: a doctor requested that someone makes a response for a given domain and an e-mail is sentresponse_started
: the respondent opened the invitation link in the e-mailanswer_set
: the respondent set (created or changed) their answer to a given question
By sequencing all the events that happened to a response, projections can be derived. In event sourcing, a projection represents the current state of a model (e.g. a Response or an Answer) based on all the events that happened to it.
The browser code is based on the Redux state container and React for view components.