Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

DPHRS - Decentralised Patient Health Records System

🏥 Project Overview

DPHRS (Decentralised Patient Health Records System) is a secure, blockchain-based web application designed to give patients complete ownership and control over their medical data.

By leveraging Ethereum smart contracts, medical records are immutably stored on the blockchain. Instead of relying on a centralized hospital database that can be breached or compromised, DPHRS guarantees that patient data is decentralized, tamper-proof, and solely accessible via cryptographic keys. Healthcare institutions can securely write and read from a verifiable ledger while patients retain oversight via transparent access logs.

✨ Key Features

  • Decentralized Storage: Patient basic information and medical records are stored directly on the blockchain, eliminating single points of failure.
  • Role-Based Access Control: Distinct, secure dashboard interfaces for Patients and Hospitals.
  • Cryptographic Ownership: Patients manage their identity using MetaMask wallet public/private key pairs.
  • Medical History Interoperability: Any registered hospital can fetch a patient's historical medical records seamlessly via their public wallet address.
  • Transparent Audit Trails: Every time a hospital queries a patient's data or adds a record, an immutable access log is generated on the blockchain that the patient can review.
  • Zero Third-Party Tracking: Records are tied strictly to wallet addresses without intermediaries.

🛠️ Technology Stack

  • Frontend: Next.js 16 (App Router), React 19, TypeScript
  • Styling: CSS-in-JS (Tailwind support included)
  • Blockchain Framework: Hardhat 3 (with Hardhat Ignition for deployments)
  • Web3 Interface: viem (Type-safe Ethereum interactions)
  • Smart Contracts: Solidity ^0.8.31
  • Wallet Integration: MetaMask

📋 Prerequisites

Before running the application locally, ensure you have the following installed:

🚀 Installation & Local Setup

1. Clone the Repository

git clone https://github.com/iamkazbrekker/dphrs.git
cd dphrs

2. Setup the Blockchain Environment

Navigate to the blockchain directory to install dependencies and deploy the local network.

cd blockchain
npm install

Start the local Hardhat node in a separate terminal:

npx hardhat node

Open a new terminal, navigate back to the blockchain directory, and deploy the smart contract:

npm run deploy 

(This deployment script will automatically compile the contract, deploy it via Hardhat Ignition, and export the generated ABI configuration directly to the frontend directory!)

3. Connect MetaMask to Localhost

  1. Open your MetaMask extension.
  2. Go to Settings > Networks > Add Network > Add a network manually.
  3. Enter the following details:
    • Network Name: Hardhat Localhost
    • New RPC URL: http://127.0.0.1:8545/
    • Chain ID: 31337
    • Currency Symbol: ETH
  4. Import one of the private test keys generated by your npx hardhat node terminal into MetaMask so you have test ETH.

4. Run the Next.js Web App

Navigate to the frontend directory:

cd ../frontend
npm install
npm run dev

Open http://localhost:3000 in your browser. (Hint: You can use the "Dev: Change Active Account" button on the home screen to quickly request permission updates via MetaMask to switch between patient/hospital accounts!)

🔮 Future Scope

While the current version of DPHRS provides a robust proof-of-concept for decentralized healthcare, future iterations plan to implement:

  1. Providing data for researchers: Providing abstract data for research purposes.
  2. IPFS Integration: Currently, simple strings are stored on-chain. Future versions will use IPFS (InterPlanetary File System) to securely store heavy files like X-Rays, MRI scans, and full PDFs off-chain while anchoring only the content hashes on-chain.
  3. Granular Data Permissions: Allowing patients to selectively decrypt/approve access to specific files rather than granting blanket access to an institution.
  4. ZK-Rollups for Privacy: Integrating Zero-Knowledge Proofs to allow hospitals to verify certain patient conditions (e.g., "Is patient vaccinated?") without actually revealing the underlying private data.
  5. Multi-signature Security: For sensitive operations and account recovery mechanisms.

📄 License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages