Prototype application that exposes a public API that accepts laboratory mesurements results for patient and presents the data on a web page as a timeline of events.
Sample JSON github.com/erikathea/health-app/blob/master/lib/assets/payload.json
When viewing the patient card in a browser, the patient’s data is displayed in an FB-like news feed, grouped in boxes per the registration date. The newest registration are shown first, from top to bottom.
The feed automatically refreshes with new data every 5 seconds.
If a medical data comes with a normal_range value and the measured value is outside the bounded range, then put a label “warning”, if within 10% of the bounds, or “critical”, if > 10% of the bounds.
For aesthetic purpose, present the data in a table per news feed entry.
-
Prereq:
virtual box&vagrant -
Run
vagrant up -
Access dev env via
vagrant ssh -
Run the script
./vagrant/setup.sh -
Add
127.0.0.1 api.health-app.devto/etc/hosts -
Open app in
http://127.0.0.1:3000/
If errors are encountered, check if all commands in setup.sh are successful. (github.com/erikathea/health-app/blob/master/setup.sh)
API Calls via api.health-app.dev:3000
-
\token- return a limited-time auth token for saving data;
** receives the following input parameters via a POST http request: * application_key - 24 character string to identify the API consumer, that is looked up against a global constant, declared in the application’s environment file. ** returns a 12 character randomly generated hexdigest with a 5 second expiry, that can be used by the consumer to submit data for a patient
-
\save** will receive the following input parameters via a POST http request:* payload - a JSON string (see sample https://github.com/erikathea/health-app/blob/master/lib/assets/payload.json) * token - 12 character string received from /token, and will be check if valid (exists and within the expiry time)
** return the text ‘OK’, with http response code 200 if success, and an ‘ERROR’, with code 500 if there’s a problem
-
\patient\:ssn - accessible via a browser, will show the patient’s medical card
Rake tasks
-
rake setup:bootstrap- bootstrap the app in development mode, with the built-in data for demo purposes. e.g. 10 sample patients in the database -
rake demo:load_data- load a set of sample laboratory data, calling the API provided by the app
Unicorn
-
sudo service unicorn start -
sudo service unicorn stop
Nginx
-
sudo service nginx start -
sudo service nginx stop -
sudo service nginx restart
-
Use ActiveModelSerializer instead of JBuilder
-
Add AngularJS related tests
-
Make Turbolink & AngularJS work with each other