Skip to content

Patient data management solution built on Hyperledger Fabric provides a highly secure and scalable platform for sharing patient data across healthcare providers.

Notifications You must be signed in to change notification settings

salaimuniselvam-s/patient-data-management-using-hyperledger-fabric

Repository files navigation

Patient Data Management using Hyperledger Fabric

Patient data management solution built on Hyperledger Fabric provides a highly secure and scalable platform for sharing patient data across healthcare providers.

With advanced features such as smart contracts, access control, and consent management, we ensure that patient data is accessed only by authorized parties and in a transparent manner

Our solution is designed to integrate seamlessly with existing healthcare systems, allowing healthcare providers to access patient data without disrupting their workflows. With a focus on patient privacy and security, our solution empowers healthcare providers to make informed decisions and deliver the best possible care to their patients..

Fabric Network configuration

Prerequisite

Follow the instructions given in the link to install necessary tools and to configure the system: https://hyperledger-fabric.readthedocs.io/en/latest/prereqs.html

Bring up the network

Follow the instructions to successfully setup the hospital network.

  1. Clone / Download the repository
$ git clone https://github.com/salaimuniselvam-s/patient-data-management-using-hyperledger-fabric
  1. Before starting with the network is set-up start the docker.

  2. Run the following command to pull the docker images.

$ curl -sSL https://bit.ly/2ysbOFE | bash -s --  2.0.1 1.5.5 -s -b

It will pull the respective fabric docker images for the binaries.

  1. Change the working directory to hospital-network
$ cd ./hospital-network
  1. Use the following command to start the network, with 2 organization hospital1 and hospital2 with one peer each (peer0) and an Orderer node & then create an hospital-channel & deploy & Instantiate the hospital Contract on two peers.
$ ./hospitalNetwork.sh up
  1. Use the Following Command to test the Chaincode is Successfully Installed & Instantiated on Two Peers
$ ./hospitalNetwork.sh validate
  1. Use the Following Command to Pause the hospital network (it will stop all the containers but does not remove the ledger details)
$ ./hospitalNetwork.sh pause
  1. Use the Following Command to Start the paused network
$ ./hospitalNetwork.sh start
  1. Use this command to bring the network down
    (Note: this will remove all the ledger details )
$ ./hospitalNetwork.sh down

Hospital Node Server

Hospital Node Server is a Node.js server for connecting Client apps to hospital fabric network for interacting with hospital chaincode using http api endpoints.

Installation

  1. Change the working directory to /hospital-sdk/fabric-network
$ cd ./hospital-sdk/fabric-network
  1. Install dependencies
$ npm install

this will install the packages used for connecting fabric-client to the fabric network

  1. Change the working directory to /hospital-sdk/node-server
$ cd ./hospital-sdk/node-server
  1. Install dependencies
$ npm install
  1. Set up environment variables
$ cp .env.example .env

It will set the admin credentials for the mongodb containers into the .env file.
(Note: Modification of the credientials in the .env file will lead to connection error with the mongodb container.)

Usage

  1. Start the server
$ npm start

This will start the server on port 3001.

  1. Register and Enroll the Users. In Another Terminal, run the following command.
$ npm enroll

This will register,enroll and Create Wallet for Test users.

  1. Access the Swagger documentation
$ http://localhost:3001/api-docs/

This will open the Swagger UI, which provides an easy way to explore and test the API.

Hospital Client

This is a web application for a hospital client to interact with the hospital chaincode deployed on hospital Fabric Network for managing Patient Data. It is built with Next.js, React, Redux, and other popular libraries.

Installation

To get started with this project, you will need to have Node.js installed on your computer.

  1. Change the working directory to /hospital-client
$ cd ./hospital-client
  1. Install dependencies
$ yarn
  1. After installing the dependencies, you can start the development server with the following command:
$ npm run dev

The development server will start at http://localhost:3000 by default. Open this URL in your web browser to view the application.

Test User Credentials

Below Test User Credentials are Created When running npm enroll in the hospital Node Server.

username password role
hosp1admin hosp1adminpw admin
hosp2admin hosp2adminpw admin
Raj Kumar temp-password patient
Deepan Raj temp-password patient
Mahesh Kumar temp-password patient
Viki temp-password patient
Ramesh temp-password patient
Rajesh Kumar temp-password doctor
Kailash Balaji temp-password doctor
Deepak temp-password doctor
Mahesh Babu temp-password doctor
hosp2doctor temp-password doctor

QuickStart Network

  1. To start the network with hospital-client and hospital-sdk as a docker container, you can use the following command.
$ cd ./hospital-network
$ ./hospitalNetwork.sh quickstart

It will setup the hospital-fabric-network, and also start the hospital-client web app in a container.

You can access the hospital-web-app in localhost:3000

  1. Use the follwing command to bring down the hospital-network, hospital-client and sdk containers
$ ./hospitalNetwork.sh shutdown

Troubleshooting

Incase if any of the commands fail due to configurations or the network was not brought down properly use the following commands to clear the corrupted docker images and fix the issue.

  1. Stop the containers.
$docker stop $(docker ps -a -q)
  1. Remove the containers
$docker rm -f $(docker ps -aq)
  1. Remove all unused images not just dangling ones
$docker system prune -a
  1. Remove all unused local volumes
$docker volume prune
  1. Restart the docker.

  2. Once the docker is up ,open a new terminal and download the images. (same as Step 3 in Bring up the network section)

$ curl -sSL https://bit.ly/2ysbOFE | bash -s --  2.0.1 1.5.5 -s -b

Acknowledgments

We would like to express our gratitude to the following individuals and organizations for their contributions and support to our Fabric project:

Note

  • This project is not yet production-ready and is intended for learning purposes only.

  • This project is a Hyperledger Fabric network implementation that showcases the basic features of Fabric and demonstrates how to interact with the network using chaincodes.

  • We created this project as a learning exercise to help us understand the basics of Fabric and how to build decentralized applications using the platform. We hope that it can serve as a starting point for others who are also interested in learning more about Fabric.

  • Please keep in mind that this project is a work in progress and may contain bugs or other issues. We welcome feedback and contributions from the community to help improve the project.

About

Patient data management solution built on Hyperledger Fabric provides a highly secure and scalable platform for sharing patient data across healthcare providers.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published