NHS Business Intelligence Platform

Overview

NHS Business Intelligence Platform

Cloud deployment of a Business Intelligence Application Suite, including modules for Population Health Management

Overview

The Digital Intelligence Unit @ NHS Blackpool CCG have created a cloud-deployed Business Intelligence application suite with a primary focus on Population Health Management. We have developed this as a small team and this is currently being utilised by Public Sector staff across Lancashire & South Cumbria. Information on our deployment of the platform can be found at the following links:

We have built this platform entirely on open-source technology so there is absolutely no licence costs for using it, only running costs which vary depending on usage.

Given the advances we have been able to make by using open-source technology, we have decided to open-source our code in order for others to benefit. We have migrated from closed git repositories to public Github and welcome others to collaborate, contribute and use for the benefit of public service.

We will be actively maintaining these repositories, so if you identify an issue or would like new functionality please feel free to create an issue in Github or message a contributor directly.

Architecture

Diagram

Pre-requisites

  • An AWS Account, with an IAM with required permissions to use CDK
  • Locally stored AWS Credentials which grant programmatic access, created in AWS IAM
  • Typescript v2.7 or later installed
  • Node.js v10.13.0 or later installed

Deployment Steps

Step One - Setup Local Environment

  • Download this repository to your local machine
  • run the command npm i to install the node_modules folder and libraries
  • In the terminal, run npm run watch to watch and compile changes
  • Update lib/_config.ts file to customise the configuration or add new files to the Stack

Step Two - Generate Secrets

  • Run the command npm run generate-secrets to add the required secrets and passwords to your AWS Secrets Manager

Step Three - Setup AWS Cloudformation

  • Run cdk bootstrap to bootstrap your AWS account (One time setup only)

Step Four - Deploy Infrastructure

  • Run cdk deploy to deploy all the resources

Step Five - Deploy Datasets

  • Run the command npm run deploy-data to save the initial datasets to the newly deployed cloud databases.

Step Six - Test Deployment

  • Run the command npm run test-deployment to start the automated test scripts. This will run through a series of tests to ensure all services are operational.

Resources Deployed

Once fully deployed, you will have the following AWS resources in your AWS account:

  • AWS Secret's Manager with secrets & passwords for your platform to operate
  • AWS Cloudformation containing all the Stacks created as part of the deployment, here you will find useful outputs like how to access the platform
  • A VPC, with a private and a public subnet. Relevant Security Groups to manage VPC traffic and data flows.
  • IAM roles and users with specific permissions in order to carry out service tasks for maintaining the platform
  • Fargate service for deploying any created containers, including task definitions and services for those applications.
  • Elastic Load Balancer to flow traffic between the Internet and the deployed containers, routed through a WAF (Firewall)
  • DynamoDB tables containing transactional data, accessed via API Gateway using a Lambda to handle authorized requests
  • RDS (PostgreSQL) database with multi-az failover, accesed via API Gateway using a Lambda to handle authorized requests
  • A WAF (Firewall) for the API Gateway endpoints
  • Authorizer Lambda for securing the API Gateway endpoints
  • CodeBuild, CodePipeline, Elastic Container Registry and S3 buckets for managing application deployment. The applications will be pulled from other GitHub repositiories as desribed in the configuration file.
  • Cloudfront Distribution for Applications hosted in S3
  • (Optional) DNS Records in AWS Route 53 for accessing website/apis

The data deployment stage will also ensure that the minimum datasets required to run the platform and applications are also deployed. If you wish to substitute the example data with your own local data please follow the instructions in the datasets folder.

Notes on Authentication

The platform operates using custom JWT authentication with a user database held in DynamoDB. If you wish to configure custom authentication to connect to a local/online user registry please follow the configuration guide in the authentication folder. We have included an example of how we connect to our local Active Directory instances.

Notes on Testing

Step six of the deployment carries out automated test scripts to ensure that your platform is online and fully usable. It will go through a series of tests including logging in, using all of the endpoints to create/update/delete data (where appropriate), and ensuring the role based access & security is working correctly. If there are no errors in the previous steps and there are failed tests please consult the testing folder for in-depth documentation.

Terms of Use

This project and all code within is © Crown copyright and available under the terms of the Open Government 3.0 licence.

The code has been developed and is maintained by the NHS and where possible we will try to adhere to the NHS Open Source Policy (https://github.com/nhsx/open-source-policy/blob/main/open-source-policy.md).

It shall remain free to the NHS and all UK public services.

Contributions

This code has been authored by Stewart Morgan ([email protected]) whilst working for NHS Blackpoool CCG.

Contributions to the platform have also been made by colleagues in the Digital Intelligence Unit @ NHS Blackpool CCG, Health Informatics @ NHS Blackpool Teaching Hospitals, and Paul Bradley @ NHS ICS Lancs & South Cumbria.

Useful CDK commands

  • npm run build compile typescript to js
  • npm run watch watch for changes and compile
  • npm run test perform the jest unit tests
  • cdk deploy deploy this stack to your default AWS account/region
  • cdk diff compare deployed stack with current state
  • cdk synth emits the synthesized CloudFormation template
  • Add the app flag to select a specific app file from the bin folder, like cdk --app "node bin/filename.js" diff

Common Issues (Troubleshooting)

Multiple locally stored AWS credentials

If you have multiple locally stored AWS credentials, or if you are not sure that you have a key stored with progammatic access, you should check your local machine:

  • Linux and macOS: ~/.aws/config or ~/.aws/credentials
  • Windows: %USERPROFILE%\.aws\config or %USERPROFILE%\.aws\credentials

To select a non-default account, run the cdk commands with the profile flag on the end like so cdk bootstrap --profile myprofilename

This project and all code within is © Crown copyright and available under the terms of the Open Government 3.0 licence.

Comments
  • Observability CDK

    Observability CDK

    To comply with the observability pillar for best practice, we have collaborated with AWS Professional Services to include the following Dashboards and Alarms for our services. Adding these to the IaC:

    • [X] ECS Cluster and Services Dashboard
    • [x] MSTeams Webhook in Settings and Config
    • [x] Cloudfront Dashboard
    • [x] RDS Dashboard
    • [x] Lambda Dashboard
    • [x] WAF Dashboard
    opened by morgans3 1
  • Add Infrastructure as Code

    Add Infrastructure as Code

    Add CDK code for the following:

    • [x] InfraStack: VPC, Public Subnet, Private Subnet, Security Groups
    • [x] WAFStack: Rules based on Config and Best Practice
    • [x] ContainerStack: Fargate, Load Balancer + WAF (WAFStack), Task Definitions, Services, Route53 DNS Record*
    • [x] DynamoDBStack: Tables, Lambda, ApiGateway + WAF (WAFStack), Route53 DNS Record*
    • [x] SQLStack: RDS (Postgresql), Lambda, ApiGateway + WAF (WAFStack), Route53 DNS Record*
    • [x] AppStack**: Codebuild, CodePipeline, S3, Cloudfront, WAF (WAFStack), Route53 DNS Record*
    • [x] ApiStack**: Codebuild, CodePipeline, ECR, Endpoint
    • [x] IAMStack: Role for codebuild

    note: individual services marked * are optional based on Config file note: Stack marked ** will be run minimum once for platform application, however additional Stacks will be created for each micro-service selected in the configuration file

    opened by morgans3 1
  • Post deployment bugs to iron out

    Post deployment bugs to iron out

    • [x] Codebuilds for containers fail on ECR push: "no basic auth"
    • [x] Codepipeline fails to deploy: role issue
    • [x] ECS deploy action: name doesn't match ECS service container name
    • [x] ECS: Instances not part of Cluster, unable to deploy containers
    • [x] Update env variables for Containers
    opened by morgans3 0
  • Bug Fixes

    Bug Fixes

    • [x] Resolve circular dependencies between stacks
    • [x] Change Code to reduce Stack #s
    • [x] Add App and Stack for Global resources (WAF for Cloudfront)
    • [x] Update deployment steps to include global resource deployment stage
    opened by morgans3 0
  • Config for IaC

    Config for IaC

    • [x] ContainerStack: // TODO: Add Route 53 DNS records for each container/loadbalancer listener rule
    • [x] LBStack: // TODO: add remaining containers as targets
    • [x] LBStack: // TODO: WAFSTACK
    • [x] Config: // TODO: Add port, min, max and desired capacity for each API
    opened by morgans3 0
  • CDK Destroy does not clean up Stacks

    CDK Destroy does not clean up Stacks

    • [ ] ContainerStack: does not destroy LB (deletion protection), Log Groups, ECR repos
    • [ ] PlatformStack: does not destroy S3 bucket
    • [ ] DynamoDBStack: does not destroy Back Up Vaults

    Need to write a clean up command to remove these resources so that cdk destroy works as intended

    opened by morgans3 0
  • Codebuild can't assume self on initial deployment of IAMStack

    Codebuild can't assume self on initial deployment of IAMStack

    Doesn't work for ContainerStack:

    this.codebuildRole = new Role(this, "CodeBuildRole", {
          roleName: "BI_CodeBuildRole",
          assumedBy: new CompositePrincipal(new ServicePrincipal("codebuild.amazonaws.com"), new ServicePrincipal("codepipeline.amazonaws.com")),
          description: "Role for building code bases",
        });
    

    works for ContainerStack but can't be deployed on first deployment of IAMStack (can only work on second deployment):

    this.codebuildRole = new Role(this, "CodeBuildRole", {
         roleName: "BI_CodeBuildRole",
         assumedBy: new CompositePrincipal(new ServicePrincipal("codebuild.amazonaws.com"), new ServicePrincipal("codepipeline.amazonaws.com"), new ArnPrincipal(`arn:aws:iam::${this.account}:role/BI_CodeBuildRole`)),
         description: "Role for building code bases",
       });
    
    opened by morgans3 0
  • Change deployment order so that codepipelines deploy first

    Change deployment order so that codepipelines deploy first

    On deployment, Container stack hangs because it can't start up the containers successfully (not in ECR because codepipeline hasn't run, because it hasn't been built)

    opened by morgans3 0
  • Test Scripts and Documentation

    Test Scripts and Documentation

    • [x] Install Cypress for local device testing
    • [x] Add cypress documentation to /cypress/README.md
    • [x] Add IAC test library: @aws-cdk/apptest
    • [ ] Add tests
    opened by morgans3 0
  • Datasets and Documentation

    Datasets and Documentation

    • [x] Add example datasets
    • [x] Add data dictionary and update /datasets/README.md
    • [x] Add geographical datasets (for UK only)
    • [ ] Create method for command npm run deploy-data
    • [ ] Create method for command npm run deploy-data-dynamodb
    • [ ] Create method for command npm run deploy-data-postgresql
    • [ ] Create method to clear data (npm run remove-data)
    • [ ] Create method to clear data (npm run remove-tables)
    opened by morgans3 1
Owner
Stewart Morgan
Developer with strong interest in Healthcare and Cloud
Stewart Morgan
Infoooze is an Open-source intelligence (OSINT) tool in NodeJs.

Infoooze is an Open-source intelligence (OSINT) tool in NodeJs. It provides various modules that allow efficient searches.

Prateek Singh 259 Jan 4, 2023
A CLI tool to generate barrels with ease, efficiency, and intelligence

JS-Barrels A CLI tool to generate barrels with ease, efficiency, and intelligence Usage npx js-barrels -d ./folder/to/generate/barrels/for Options -d,

Snehil K 6 Aug 17, 2022
RTAA-72, is CVCIO's real-time intelligence dashboard for Twitter

RTAA—72 Target Audience Analysis (TAA), as described by many field manuals such as FM 33-1-1, is the transitional phase where PSYOP planning moves tow

Civic Information Office 9 Nov 29, 2022
A curated list of projects, research initiatives, videoconferences and articles on artificial intelligence (AI) in Chile.

Artificial Intelligence Chile A curated list of projects, research initiatives, videoconferences and articles on artificial intelligence (AI) in Chile

Juan Francisco 12 Nov 2, 2022
Google-reviews-crawler - A simple Playwright crawler that stores Google Maps Place/Business reviews to a JSON file.

google-reviews-crawler A simple Playwright crawler that stores Google Maps Place/Business reviews to a JSON file. Usage Clone the repo, install the de

￸A￸l￸e￸x D￸o￸m￸a￸k￸i￸d￸i￸s 6 Oct 26, 2022
NewsStation is a news app which can be used to grab daily news bites. If you are interested in news whether politics, business, entertainment, general, health, science, sports and technology news NewsStation is for you!

This is a NewsStation WebApp Project Using News API NewsStation is a news app which can be used to grab daily news bites. If you are interested in new

Ravi Chauhan 2 Feb 7, 2022
Keep your Business Logic appart from your actions/loaders plumbing

Remix Domains Remix Domains helps you to keep your Business Logic appart from your actions/loaders plumbing. It does this by enforcing the parameters'

Seasoned 290 Jan 2, 2023
A calculation and tracker tool for one-person business operations

?? Taxemu This is the alpha version of Taxemu. A tracker tool for one-person business operations. The live project can be found here. Development Clon

John Raptis 7 Nov 30, 2022
An E-commerce website that allows to Buy/Sell products, designed to strengthen small vendors to enhance their business

Developed using MERN Stack, an E-commerce website that allows to Buy/Sell products, designed to strengthen small vendors to enhance their business, fu

Inderjit Shahi 5 Jun 25, 2022
Application for self-testing before exams covering some of the subject taught at the Prague University of Economics and Business

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: ya

Jiří Vrba 2 Jun 13, 2022
The project integrates workflow engine, report engine and organization authority management background, which can be applied to the development of OA, HR, CRM, PM and other systems. With tlv8 IDE, business system development, testing and deployment can be realized quickly.

介绍 项目集成了工作流引擎、报表引擎和组织机构权限管理后台,可以应用于OA、HR、CRM、PM等系统开发。配合使用tlv8 ide可以快速实现业务系统开发、测试、部署。 后台采用Spring MVC架构简单方便,前端使用流行的layui界面美观大方。 采用组件开发技术,提高系统的灵活性和可扩展性;采

Qian Chen 38 Dec 27, 2022
Full Stack MERN website for local small business "Daisy's Cakes"

Daisys-Cakes Full Stack MERN website for local small business "Daisy's Cakes" Contribution Info This section will be deleted later when the project is

PreDevz 8 Nov 13, 2022
🛠 Building a Headless CMS with all the essential features for business representative websites to make 🚀

Isomera - headless CMS for business representative websites SaaS that is hosted on the cloud and built by community. To make developer life easy. ⚠️ A

Cortip 8 Dec 3, 2022
GetOsLocalesCrossPlatform - A cross platform alternative to get locales used on the platform. Works on Node, Electron, NW.js and Browsers

getOsLocalesCrossPlatform A cross platform alternative to get locales used on the platform. Works on Node, Electron, NW.js and Browsers This script is

null 1 Jan 2, 2022
:fireworks:Interactive Online Platform that Visualizes Algorithms from Code

Algorithm Visualizer Algorithm Visualizer is an interactive online platform that visualizes algorithms from code. Learning an algorithm gets much easi

Algorithm Visualizer 42k Jan 4, 2023
📗 How to write cross-platform Node.js code

How to write cross-platform Node.js code. Why you should care: according to the 2018 Node.js user survey, 24% of Node.js developers use Windows locall

ehmicky 1.3k Jan 3, 2023
a tunisian platform made to share knowledge. :dizzy:

⭐ tha9fni.tn a tunisian platform made to share knowledge. ?? What's tha9fni will be like? We're still tweaking the wireframes but this is How its goin

التوانسة إلي يحبوا البـرمجة 18 Nov 17, 2021
Bringing an all Open-Source Platform to study Data Structures and Algorithms ⚡

NeoAlgo-Docs Bringing an all Open-Source Platform to study Data Structures and Algorithms ⚡ ?? Installation You will need to have NodeJS and Yarn inst

Tesseract Coding 24 Jun 2, 2022