Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

🧬 Decentralized MedCal: A Web3 Healthcare Platform

A modern, decentralized medical record management platform designed to revolutionize healthcare through secure blockchain technology, AI, and patient-centric data control. This system connects patients and doctors, ensuring privacy, security, and transparency, all facilitated by the custom HTK token.

Prototype notice: This repository is an application prototype, not a production medical system. Feature descriptions include project goals and do not imply that the software has been clinically validated, security-audited, or certified for healthcare privacy compliance. Do not enter real patient data. Solidity contract sources and deployment scripts are not included.


🩺 Overview

Decentralized MedCal (also referred to as the Decentralized Clinic App) is a cutting-edge Web3 platform that aims to overcome the inherent challenges of traditional healthcare systems, such as:

  • Data Privacy Concerns: Centralized medical records are vulnerable to breaches, identity theft, and unauthorized access, leaving patients with little control over their sensitive health information.
  • Centralization of Patient Records: Fragmented and siloed records across different providers lead to inefficiencies, errors, and delays in treatment.
  • High Transaction Fees: Intermediaries like insurance companies inflate administrative costs, making healthcare less affordable.
  • Limited Accessibility: Geographic, economic, and infrastructural constraints limit access to quality care, especially in remote areas.

Our solution leverages blockchain technology and machine learning (ML) to address these critical issues, creating a more secure, efficient, and accessible healthcare experience. The platform promotes:

  • βœ… Medical record ownership and fine-grained access control.
  • βœ… Immutable activity tracking and tamper-proof data.
  • βœ… Decentralized patient-doctor communication with full anonymity options.
  • βœ… Reduced transaction costs through tokenized payments.
  • βœ… Automated processes and intelligent recommendations via AI integration.

🌐 Live Demo

Coming soon on Vercel (Live deployment link: https://veil-app.vercel.app/)


🎯 Target Audience

The Decentralized MedCal platform is designed for a diverse range of users:

  • High-Profile Patients: Those who prioritize keeping their medical history and identity anonymous from the public and even their doctors due to personal reasons or terminal illnesses.
  • Tech-Savvy Patients: Individuals who value privacy and full control over their personal medical data in a digital environment.
  • Doctors: Healthcare professionals seeking a transparent, secure, and efficient method for managing their practices, issuing prescriptions, and interacting with patients.
  • Web3 Enthusiasts: Individuals interested in decentralized applications (dApps) and innovations in blockchain-based healthcare.
  • Healthcare Providers: Organizations and professionals operating in regions with limited access to efficient, secure, or transparent healthcare systems.
  • General Public: Anyone who wishes to keep their identity and profile secret from their healthcare providers, ensuring maximum privacy and data security.

πŸ’‘ Why Blockchain?

Blockchain technology is fundamental to the Decentralized MedCal platform, providing core functionalities that traditional systems cannot:

  • Privacy and Anonymity: Blockchain enables decentralized identity (DID), allowing patients and doctors to register and interact anonymously, keeping personal data private and secure. Users control their digital credentials and identifiers without relying on centralized authorities.
  • Immutable Records: By storing prescriptions and medical data on the blockchain, we ensure that patient records are immutable and transparent. This prevents tampering and fraud, enhancing trust and accountability. Patient history, diagnoses, and treatment plans are always up-to-date and accessible to authorized parties.
  • Tokenized Payments: Payments between patients and doctors are made using HTK tokens (100 HTK = 1 ETH), ensuring fast, secure, and trustless transactions. The tokenized system eliminates intermediaries, offering a lower-cost solution for both parties and streamlining cross-border payments.

🧠 Key Features

Our platform boasts a comprehensive set of features designed to enhance the healthcare experience:

  1. Decentralized Identity Management:

    • Blockchain-based Decentralized Identities (DID) allow secure, privacy-preserving registration for patients and doctors.
    • Sensitive data remains under user control, not on a centralized server.
    • Patients can interact with healthcare providers without revealing their personal identities.
  2. Secure Data Flow:

    • Medical records are encrypted, permissioned, and logged on the blockchain.
    • Patients control who can view or modify their data, ensuring patient-owned records.
  3. Appointment Booking and Payments:

    • Patients can easily book appointments with verified doctors through the app.
    • Payments are securely processed in HTK tokens, providing a transparent and efficient financial transaction method within the ecosystem.
  4. Immutable Prescriptions:

    • Doctors can issue tamper-proof prescriptions stored directly on the blockchain.
    • This prevents fraud and ensures that prescriptions are secure, transparent, and accessible at any time by the patient or authorized medical professionals.
  5. AI-Driven Search & Insights:

    • The app integrates AI-driven search capabilities, allowing patients to find doctors based on specific needs and health concerns using text-based queries.
    • GenAI integration helps patients gain valuable insights into diseases and symptoms, providing personalized recommendations and improving overall health literacy.
  6. Doctor Collaboration:

    • Seamless connection and secure communication channels with verified healthcare providers.
  7. Blazing Fast Performance:

    • Built on Next.js and TailwindCSS for optimal user experience and rapid load times.

βš™οΈ Tech Stack

Layer Tools / Frameworks
Frontend Next.js 14, React, Tailwind CSS, TypeScript, ethers.js
Backend Next.js API routes, NextAuth.js, Google OAuth, Prisma, Google Generative AI
Blockchain Ethereum contract interaction through ethers.js; Solidity sources and deployment scripts are not included
Database MongoDB through Prisma and the MongoDB driver
Dev Tools ESLint, Prettier, Husky, Commitlint, Vercel

πŸ“Š System Architecture

The application combines a Next.js frontend and API routes with MongoDB, external AI and authentication services, and Ethereum contract integrations. The repository does not include Solidity contract sources or deployment scripts.

graph TD
    A[Patient / Doctor] --> B[Next.js application]
    B --> C[MongoDB via Prisma]
    B --> D[NextAuth.js / Google OAuth]
    B --> E[Google Generative AI]
    B --> F[Ethereum contracts]
Loading

πŸ”§ Project Structure

decentralized_medical/
β”œβ”€β”€ prisma/                  # Prisma schema (MongoDB)
β”œβ”€β”€ public/                  # Static assets
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                 # Next.js App Router pages and API routes
β”‚   β”œβ”€β”€ components/          # Reusable UI components
β”‚   β”œβ”€β”€ lib/                 # Application utilities and integrations
β”‚   └── styles/              # Global and component styles
β”œβ”€β”€ .env.example             # Environment variable template
β”œβ”€β”€ README.md                # Project documentation
└── package.json             # Dependencies and scripts

πŸš€ Getting Started

The local application requires Node.js 18 or later, npm, a MongoDB replica-set deployment, Google OAuth credentials, and deployed contract addresses.

1. Clone the repository

git clone https://github.com/Nitin192005/decentralized_medical.git
cd decentralized_medical

2. Install dependencies

npm ci

The install runs Prisma Client generation through the package's postinstall script.

3. Configure environment variables

Copy .env.example to .env (PowerShell: Copy-Item .env.example .env; macOS/Linux: cp .env.example .env) and replace every placeholder with your own values. The example file contains no real credentials.

The application requires:

  • DATABASE_URL: MongoDB URL used by Prisma. Prisma's MongoDB connector requires a replica set.
  • MONGODB_URI: MongoDB URL used by the MongoDB driver.
  • GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET: Google OAuth credentials.
  • NEXTAUTH_SECRET: a random secret; generate one with openssl rand -base64 32.
  • STRIPE_API_KEY and STRIPE_WEBHOOK_SECRET: Stripe credentials for billing and webhook handling.
  • STRIPE_PRO_MONTHLY_PLAN_ID: the Stripe price ID for the PRO subscription.
  • NEXT_PUBLIC_CONTRACT_ADDRESS and NEXT_PUBLIC_TOKEN_ADDRESS: deployed contract addresses.
  • NEXT_PUBLIC_APP_URL: the application URL. NEXTAUTH_URL is optional for local development and should match the deployed URL in production.
  • GOOGLE_API_KEY: needed to use the AI API routes.

Never put private credentials in variables prefixed with NEXT_PUBLIC_.

4. Generate the Prisma client and sync the MongoDB schema

npx prisma generate
npx prisma db push

5. Run the development server

npm run dev

The application is available at http://localhost:3000.

Checks

Run the configured lint command with npm run lint. There is currently no test script in package.json.


πŸ“Έ Screenshots (Coming Soon)

We are working on capturing key user interface flows to showcase the application's functionality.

  • Patient View: (e.g., image1.png) - Illustrates patient dashboard, record access, and appointment booking.
  • Doctor View: (e.g., image2.png) - Illustrates doctor's management panel, prescription issuance, and patient interaction.

🀝 Contribution Guide

We welcome contributions to the Decentralized MedCal project! Please adhere to the following guidelines:

Code Quality

  • Lint code:
    npm run lint
  • Format code:
    npx prettier --check .

Git Commit Convention

We use Conventional Commits with Husky + Commitlint to ensure consistent and meaningful commit messages.

  • feat: A new feature
  • fix: A bug fix
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)
  • refactor: A code change that neither fixes a bug nor adds a feature
  • perf: A code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to our CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit

🚧 Challenges We Ran Into

During the development of Decentralized MedCal, we encountered several challenges that we successfully addressed:

  • Scalability: Initially, we faced issues with blockchain transaction speeds and high gas fees on Ethereum. We overcame this by optimizing smart contracts and exploring potential Layer 2 solutions for future implementation.
  • Data Privacy Compliance: Maintaining compliance with diverse healthcare data privacy regulations (e.g., HIPAA, GDPR) while ensuring the decentralized nature of the app was a significant hurdle. We addressed this through robust anonymization techniques and explicit user consent management protocols.
  • AI Integration: Ensuring high AI model accuracy for reliable health information and providing real-time AI recommendations for both patients and doctors was complex. We tackled this by implementing continuous learning mechanisms for the AI models and refining our data processing pipelines.

πŸš€ Roadmap

Our vision for Decentralized MedCal extends far beyond the current beta. Here's our projected roadmap:

Next 6 Months

  • Smart Contract Refinement and Deployment: Complete the audit and full deployment of all smart contracts, and further refine HTK tokenomics for optimal utility and user incentives.
  • Expanded Beta Testing: Roll out beta access to a larger pool of doctors and patients to gather extensive feedback and ensure robustness.
  • Enhanced AI Features: Fully implement advanced AI-driven disease insights, predictive analytics, and personalized treatment recommendation features.

Beyond 6 Months

  • Geographic Expansion: Expand the platform's availability to additional regions and integrate with more diverse healthcare providers.
  • Telemedicine Integration: Introduce comprehensive telemedicine features for secure remote consultations, video calls, and virtual diagnoses.
  • Advanced AI Analytics: Develop and integrate more sophisticated AI-powered analytics to predict healthcare conditions, optimize treatment plans, and enhance diagnostic accuracy.
  • Interoperability: Explore integration with other blockchain-based healthcare platforms and traditional EHR systems to enhance data exchange.

πŸ“ˆ Go-to-Market Strategy

Our strategy to introduce Decentralized MedCal to the wider healthcare and Web3 communities focuses on:

  • Strategic Partnerships: Collaborate with established blockchain-based healthcare platforms, medical institutions, and technology providers to enhance interoperability, build credibility, and expand our reach.
  • Community Building: Actively engage with the Web3 and healthcare communities through social media campaigns, online forums, and influencer collaborations to raise awareness and foster a strong user base.
  • Token Incentives: Implement HTK token rewards and airdrops for early adopters, active users, and contributors to the platform's ecosystem, encouraging engagement and network growth.
  • Educational Content: Develop comprehensive educational materials to demystify blockchain in healthcare, highlighting the benefits of decentralized identity, data ownership, and secure interactions.

πŸ†š Competitor Analysis

While the blockchain in healthcare space is growing, with notable platforms like Healthereum, Solve.Care, and Medicalchain, Decentralized MedCal differentiates itself through several key aspects:

  • Unwavering Focus on Anonymity and User Control: Our emphasis on decentralized identity (DID) ensures patients have unparalleled control over their data and can maintain full anonymity in interactions if desired.
  • Integrated AI for Enhanced Experience: The combination of AI for doctor search and disease insights provides a more personalized and intelligent healthcare experience, a feature not as deeply integrated or emphasized by competitors.
  • Streamlined Tokenized Payment System: Our dedicated HTK token system offers a more efficient, low-cost, and transparent payment mechanism compared to existing models, removing traditional intermediaries.
  • Holistic Ecosystem: We aim to provide a comprehensive solution that covers identity, appointments, prescriptions, payments, and intelligent insights within a single, trustless ecosystem.

πŸ“œ License

This project is licensed under the MIT License β€” see LICENSE.md for details.


πŸ‘¨β€πŸ’» Author

Nitin Pandey

For support or inquiries, please contact: nitin2005p@gmail.com


πŸ™ Acknowledgements

We extend our sincere gratitude to the following technologies and communities that made this project possible:

  • Auth0: For providing robust and secure authentication solutions.
  • GenAI: For powering our AI-driven healthcare insights and recommendations.
  • Ethereum: For the foundational blockchain technology that enables decentralization and immutability.
  • Next.js, React, TailwindCSS: For the cutting-edge frontend development experience.
  • Prisma & Drizzle ORM: For seamless and type-safe database interactions.
  • The open-source community for countless valuable tools and resources.

🌟 Star This Repo

If you found this project useful, learned something from it, or appreciate the effort, please consider giving it a ⭐ on GitHub! Your support motivates us to continue improving and innovating.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages