IBM / Medical-Blockchain

A healthcare data management platform built on blockchain that stores medical data off-chain
https://developer.ibm.com/patterns/storing-private-data-off-chain-using-blockchain-think-healthcare-use-case/
Apache License 2.0
192 stars 85 forks source link
blockchain docker ibm-cloud kubernetes redis vuejs

Store private healthcare data off-chain and manage medical data using blockchain

Electronic medical records and data craves the need for innovation. The way patient health records are stored and secured today do not showcase our technological advancement in this area in the past decade, and hospitals continue to use age-old data management systems for patient data. This is partly due to strict regulations around privacy and security of medical data, which has stifled the use of latest technology to make medical data management more transparent and useful for both patients as well as doctors.

This code pattern showcases a medical data/access management platform built using blockchain. The application shows the platform from the point of view of 4 stakeholders -

This code pattern is for developers who want to integrate with the Blockchain Solution Manager, Blockchain Document Store and the IBM Blockchain Platform. When you have completed it, you will understand how to:

Architecture flow

Architecture flow

Login flow

  1. All the stakeholders of the application (solution admin, hospital admin, doctor and patient) begin the user flow by logging into their respective dashboards.
  2. Clicking the login button leads to the login portal of the Blockchain Solution Manager, hosted on the IBM cloud.
  3. The login portal uses OpenAPI Connect and allows the user the login through any onboarded identity provider (in our example, we have on-boarded IBMID ad GoogleID). Successful authentication leads to the JWT credentials for the user.

Admin dashboard

  1. The solution admin flow begins at the admin component, and requires the user to authenticate themselves through the login flow described above.
  2. After successful authentication, the user can access the solution admin dashboard. They are able to view the solution, and add/remove hospitals from the solution using the Admin API's.
  3. All the admin API's connect with the Blockchain Solution Manager through REST to process the user queries.
  4. The Blockchain Solution Manager connects with the IBM Blockchain Platform and updates the ledger appropriately.

Organization dashboard

  1. The hospital admin flow begins at the organization component, and requires the user to authenticate themselves through the login flow described above.
  2. After successful authentication, the user can access the hospital admin dashboard. They are able to add/remove any user in their respective hospital with the on-boarded roles (patient/doctor in our case) using the organization API's.
  3. All the organization API's connect with the Blockchain Solution Manager through REST to process the user queries.
  4. The Blockchain Solution Manager connects with the IBM Blockchain Platform and updates the ledger appropriately.

Doctor dashboard

  1. The doctor flow begins at the doctor component, and requires the user to authenticate themselves through the login flow described above.
  2. After successful authentication, the user can access the doctor dashboard. They are able to upload a medical record for a patient who is part of their hospital and download any medical record associated with a patient to which they have access to, using the Doctor API's. The ACL's for all the patient documents is application level and is maintained through the Document ACL flow described below.
  3. All the doctor API's connect with the Blockchain Document Store through REST to process the user queries.
  4. The Blockchain Document Store connects with the IBM Blockchain Platform and updates the ledger appropriately.

Patient dashboard

  1. The patient flow begins at the patient component, and requires the user to authenticate themselves through the login flow described above.
  2. After successful authentication, the user can access the patient dashboard. They are able to upload a medical record for themselves, download any of their medical records, view the access logs of their documents, and view/manage permissions to their documents, using the Patient API's. The ACL's for all the documents is application level and is maintained through the document ACL flow described below.
  3. All the patient API's connect with the Blockchain Document Store through REST to process the user queries.
  4. The Blockchain Document Store connects with the IBM Blockchain Platform and updates the ledger appropriately.

Document access control list (ACL) flow

  1. The doctor and patient component are connected with the Redis API's that invoke methods to manage the document level access control across hospitals.
  2. The Redis API's talk to a NodeJS server deployed in a Docker container in a Kubernetes cluster on the IBM Cloud.
  3. The server talks to two Redis databases which hold the access-per-document and access-per-user permissions.

Included components

Featured technologies

Prerequisites

We find that Blockchain can be finicky when it comes to installing Node. We want to share this StackOverflow response - because many times the errors you see with Compose are derived in having installed either the wrong Node version or took an approach that is not supported by Compose:

Running the application

Manually deploy to local machine

  1. Set up your machine
  2. Create IBM cloud services
  3. Create a solution
  4. Clone the repository
  5. Modify the configuration files
  6. Run the application

1. Set up your machine

Install the following dependencies -

2. Create IBM cloud services





Note: You can use just one instance of Redis as well. Modify the code in the server repository to allow for this.





3. Create a solution

{
  "onboardingdata": {
    "solution": {
      "id": "medrec_demo",
      "name": "demo for medrec pattern"
    },
    "roles": [
      {
        "id": "role_patient",
        "name": "Patient",
        "solutionId": "medrec_demo",
        "isBlockchainRole": true
      },
      {
        "id": "role_doctor",
        "name": "Doctor",
        "solutionId": "medrec_demo",
        "isBlockchainRole": true
      }
    ]
  }
}





4. Clone the repository

git clone https://github.com/IBM/Medical-Blockchain.git
cd Medical-Blockchain

5. Modify the configuration files





6. Run the application



docker build -t medrec-vue .
docker run -d --restart always --name medrec-vue -p 8080:8080 medrec-vue

Note: You can also deploy the Vue App to Kubernetes, by modifying the manifest.yml to support two pods.

License

This code pattern is licensed under the Apache Software License, Version 2. Separate third-party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the Developer Certificate of Origin, Version 1.1 (DCO) and the Apache Software License, Version 2.

Apache Software License (ASL) FAQ