katbow / healthlocker

Inspire and motivate people to stay well.

Home Page:https://www.healthlocker.uk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

About

Inspire and motivate people to stay well.

https://www.healthlocker.uk


Languages

Language:Elixir 66.1%Language:HTML 31.0%Language:JavaScript 1.6%Language:CSS 1.0%Language:Shell 0.2%