Inspire and motivate people to stay well.
Clone or download
Simon
Latest commit becff6f Jun 22, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.deliver update ip address to the staging2 ip address in edeliver config as ot… Mar 7, 2018
config Revert "Merge pull request #1102 from healthlocker/error-logging" Sep 28, 2017
lib Display email in message body if present #1115 Nov 29, 2017
priv Add migration for creating unique index on tracker #1109 Nov 22, 2017
rel update rel/config #1027 Aug 25, 2017
test update test Mar 21, 2018
web remove margin to style text #901 Apr 4, 2018
.credo.exs Added generated credo config file. Apr 13, 2017
.gitignore update .travis.yml to test ssh into Azure box Aug 2, 2017
.hound.yml Update hound.yml to point to credo config. Apr 13, 2017
.travis.yml update permissions on version.sh script to a+x attempting to fix http… Aug 2, 2017
Procfile Added Procfile with web process. Feb 7, 2017
README.md adds build command to readme #841 Jul 13, 2017
SLaM-interoperability-notes.md Adds notes for SLaM interoperability meeting Mar 16, 2017
Vagrantfile hard-code port 4000 in prod.exs for #841 Jun 30, 2017
app.json postdeploy hook to migrate db. Feb 7, 2017
brunch-config.js initial commit Jan 21, 2017
continuous-deployment.md set both vm_args and sys_config to nil in rel/config.exs dwyl/learn-d… Aug 2, 2017
demos.md Adds demo run-through for today's demo #72 Feb 7, 2017
deploy_key.enc adds encrypted deployment key to project for #841 Aug 2, 2017
deployment_and_ssl.md Add instructions for configuring app signal on staging and live #1106 Oct 3, 2017
editing-select-options.md Documentation updates (#760) May 31, 2017
elixir_buildpack.config Elixir buildpack config settings. Feb 7, 2017
healthlocker.service remove line that is not needed Feb 14, 2018
healthlocker_service_script.md add examples of description and working directory to docs #1157 Mar 14, 2018
markdown-syntax.md Documentation updates (#760) May 31, 2017
mix.exs Add dependency to applications #1116 Nov 29, 2017
mix.lock Add phoenix_html_sanitizer to project #1116 Nov 29, 2017
nginx.config nginx config - fix location of Let's Encrypt private key Dec 15, 2017
package.json initial commit Jan 21, 2017
proposed-demo-walkthrough.md Adds notes on demo walkthrough, closes #524 Apr 28, 2017
tracking-feature.md Documentation updates (#760) May 31, 2017
vm.args create ./vm.args file in root of project for #959 (comment) Aug 2, 2017

README.md

Healthlocker Build Status Deps Status

Healthlocker is a secure platform powered by the South London and Maudsley NHS Foundation Trust (the trust) that promotes supported self-management and opportunities to improve communication between service users, carers and clinicians. A full list of features can be found here.

Getting started (Using Vagrant)

  • Clone the repo
  • cd in the repo
  • Update the line in the Vagrantfile that says "Your path to Healthlocker here" with the path to where you cloned the repo
  • Run the command vagrant up in the terminal

This will take a few minutes to set up but once it is complete you will be able to visit localhost:4000 from your browser and checkout the styleguide.

You will not be able to access any data from the ePJS database

More instructions on how to use vagrant can be found here

Ready to run in production? Please check the deployment guides.

Testing

We use ExUnit and wallaby for testing. Wallaby has a dependency on phantomjs. You can follow their instructions to install it.

After that you should be able to run mix test and see lots of green!

Routes

You can view all of the routes by running mix phoenix.routes in your terminal.

Learn more

Updating select input options

The dropdown options for security questions, hours slept and wake count from the sleep tracker, and symptom scale from the symptom tracker can be updated by following the instructions in this document.

Writing tips & stories

The stories and tips can be written using markdown. This will allow you to style the text as you write it.

You can find a guide to common things you may want to do with markdown in this repository.

In addition to formatting the text with markdown, be sure to include #story or #tip (with an additional category tag) so the story or tip displays on the correct page.

Current features

style-guide

DevOps

Application Architecture

The Healthlocker App is deployed to "Production" in the following configuration:

healthlocker-architecture-diagram-2

To edit this diagram, open:
https://docs.google.com/drawings/d/1VwpBVKzqSX0q81KsKSKAOS7wtYcqZqARKAFTKJUaowg

The cluster of Web Servers is two or more Linux VMs behind a load balancer.

Infrastructure Overview

There are 4 pieces to the puzzle:

  • Azure Load Balancer: https://azure.microsoft.com/en-gb/services/load-balancer - All web traffic is handled through the load balancer which performs continous health checks on the application server(s) and routes requests in a "round-robin" to balance load.

    • There is no "specification" for Load Balancers on Azure and pricing is FREE!
  • Linux Virtual Machines (VMs): https://azure.microsoft.com/en-gb/services/virtual-machines - these run our Phoenix Web Application. The Application is compiled as an executable which runs on "BEAM" (the Erlang Virtual Machine). The VMs are actively monitored and can be scaled up dynamically dependent on request volume.

    • Production Application Servers: Linux VM Cost
    • Staging Application Server: staging-vm
  • Azure PostgreSQL Database-as-a-Service: https://azure.microsoft.com/en-us/services/postgresql - all application data is stored in an Azure Database instance which is encrypted at rest, scales dynamically/transparently ("built-in high availability") and backed up transparently. Data is Only accessible from the Production VMs

    • Production Database: PostgreSQL Pricing
    • Staging (Test) Database: staging-database-price
  • Azure SQL Server (Database-as-a-Service): https://azure.microsoft.com/en-gb/services/sql-database - Stores a read-only snapshot of the "Care Notes" (ePJS) Database. This contains the patients personal health information and is controlled by the "SLaM" IT team. Access is restricted to the Production Healthlocker VMs and patient (personal) data is only viewable by the patient and authorized healthcare professionals.

  • Specification for ePJS SQL Server: epjs-database

  • Tips can be added in, and can be viewed either in full or filtered by tag
  • Story content can be input by users, and are displayed in cards with a story preview
  • Stories can be expanded to view the full individual story
  • Support page is available in full
  • Three-step sign up process
  • Login
  • Users can only post content when logged in
  • Users can create, view, update and delete coping strategies they have made
  • Users can create, view, update, and delete goals they have made
  • Goals can be marked as important and are displayed at the top of the goals page
  • Users can visit their account page where they can update their name, email, or phone number
  • Users can update their consent for sharing data with researchers in their account
  • Users can update their password and security Q&A in their account
  • Terms of service can be accessed from the footer and is linked in sign up
  • Privacy statement can be accessed from the footer and is linked in sign up
  • Feedback can be sent about the site from a form. This is done using Bamboo and Amazon SES
  • Logged in users can track their sleep over time using the sleep tracker in toolkit
  • Users who have tracked sleep can view:
    • hours slept each night over the past week
    • average number of hours slept over the past week
    • times they woke up each night for the past week
    • notes they made about their sleep from the past week
  • Users can view the previous 7 days sleep data, or go forward once they've gone back.
  • Styleguide

DevOps

Application Architecture

The Healthlocker App is deployed to "Production" in the following configuration:

healthlocker-architecture-diagram-2

To edit this diagram, open:
https://docs.google.com/drawings/d/1VwpBVKzqSX0q81KsKSKAOS7wtYcqZqARKAFTKJUaowg

The cluster of Web Servers is two or more Linux VMs behind a load balancer.

Infrastructure Details

There are 4 pieces to the puzzle

  • Azure Load Balancer: https://azure.microsoft.com/en-gb/services/load-balancer - All web traffic is handled through the load balancer which performs continous health checks on the application server(s) and routes requests in a "round-robin" to balance load.
  • Linux Virtual Machines (VMs): https://azure.microsoft.com/en-gb/services/virtual-machines - these run our Phoenix Web Application. The Application is compiled as an executable which runs on "BEAM" (the Erlang Virtual Machine). The VMs are actively monitored and can be scaled up dynamically dependent on request volume.
  • Azure PostgreSQL Database-as-a-Service: https://azure.microsoft.com/en-us/services/postgresql - all application data is stored in an Azure Database instance which is encrypted at rest, scales dynamically/transparently ("built-in high availability") and backed up transparently. Data is Only accessible from the Production VMs
  • Azure SQL Server (Database-as-a-Service): https://azure.microsoft.com/en-gb/services/sql-database - Stores a read-only snapshot of the "Care Notes" (ePJS) Database. This contains the patients personal health information and is controlled by the "SLaM" IT team. Access is restricted to the Production Healthlocker VMs and patient (personal) data is only viewable by the patient and authorized healthcare professionals.

Exact Infrastructure Requirements for (Production) Azure Deployment

Resource Description Exact Specification Resource Quantity Estimated Monthly Cost
Linux VM (Prod) "Azure D1 V2" Linux VM: 3.5Gb RAM, 1CPU Core, 50GB Hard disk 2 £75.41
PostgreSQL Database (Prod) "Standard Tier" Servers ("100 Compute Units") with 125GB SSD 2 £128.42
Load Balancer configured to proxy to Prod VMs Azure Standard HTTP Load Balancer 1 FREE
Linux VM (Build/Staging) "Azure A0" Linux VM: 0.75Gb RAM, 1CPU Core, 20GB Hard disk 1 £11.09
PostgreSQL Database (Prod) "Basic Tier" Server ("50 Compute Units") with 50GB SSD 1 £13.36
Load Balancer (Staging) Azure Standard HTTP Load Balancer 1 FREE
ePJS Snapshot MS SQL Server 100 eDTUs, 100 GB Storage per pool, 200 DBs per pool 1 £166.35

Continuous Integration/Testing and Deployment Pipeline

We use Travis-CI for our continuous integration. see: https://github.com/dwyl/learn-travis

Release build command:

mix edeliver upgrade production --verbose --auto-version=revision

Deployment Guide

In the interest of reproducibility we have produced a step-by-step guide to deploying a Phoenix Web Application to Microsoft Azure:
https://github.com/dwyl/learn-microsoft-azure

Capacity Building Through Documentation & Learning Resources

Unlike most application development Agencies, that attempt to "Lock-in" clients, the team building Healthlocker are focussed on building capacity within the NHS to support and extend Healthlocker.

The following learning resources are community-maintained and 100% free/open: