Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

28 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŽ₯ InfinityCare Demo

InfinityCare Demo Video

▢️ Watch Demo Video on Youtube

♾️ InfinityCare

A zero-trust, AI-powered healthcare ecosystem where patients own their data, doctors work with AI intelligence, and medicines are verified on-chain.

Built for Hacktropica β€” Privacy-first healthcare for the modern world.


🧬 The Problem

Healthcare data is fragmented, siloed, and controlled by institutions β€” not patients. Counterfeit medicines kill over 1 million people annually. Doctors are buried under cognitive overload from unstructured records. Emergency patients can't be identified without ID cards.

πŸ’‘ The Solution

InfinityCare is a unified, multi-role healthcare platform built on zero-trust principles:

  • πŸ” Patients own and control who sees their medical records
  • πŸ€– AI extracts structured clinical intelligence from raw prescriptions
  • 🧬 Biometric Face ID identifies unconscious patients in emergencies
  • ⛓️ Blockchain verifies medicine authenticity end-to-end
  • πŸ“‘ Contactless vitals via Presage camera-based monitoring (no wearables)

πŸ›οΈ Architecture Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      FRONTEND (Next.js 16)                      β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”           β”‚
β”‚  β”‚ Patient  β”‚ β”‚  Doctor  β”‚ β”‚ Hospital β”‚ β”‚  Nurse   β”‚           β”‚
β”‚  β”‚Dashboard β”‚ β”‚Dashboard β”‚ β”‚Dashboard β”‚ β”‚Dashboard β”‚           β”‚
β”‚  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜           β”‚
β”‚  β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”                                     β”‚
β”‚  β”‚ Pharmacy β”‚ β”‚  Vendor  β”‚                                      β”‚
β”‚  β”‚Dashboard β”‚ β”‚Dashboard β”‚                                      β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                     API LAYER (Next.js Routes)                  β”‚
β”‚  /api/ai/summarize  Β·  /api/ai/predict  Β·  /api/auth/*          β”‚
β”‚  /api/hospital/*  Β·  /api/patient/*  Β·  /api/doctor/*           β”‚
β”‚  /api/my-documents  Β·  /api/verify-medicine  Β·  /api/pharmacy/* β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  PostgreSQL  β”‚  β”‚  Cloudinary  β”‚  β”‚  Algorand Blockchain β”‚   β”‚
β”‚  β”‚   (Prisma)   β”‚  β”‚  (File CDN)  β”‚  β”‚  (Medicine Ledger)   β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚              PYTHON MICROSERVICE (Flask)                         β”‚
β”‚  DeepFace Biometric Engine  Β·  Face ID Matching                 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚              EXTERNAL AI SERVICES                               β”‚
β”‚  Gemini 2.5 Flash  Β·  Ollama  Β·  Disease Prediction API        β”‚
β”‚  Presage SmartSpectra  Β·  Tesseract.js (Browser OCR)            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🎯 Features by Role

πŸ§‘β€βš•οΈ Patient Dashboard β€” "Your Medical Vault"

Feature Description
Upload Documents Encrypt and store lab reports, prescriptions, insurance docs in your personal vault (Cloudinary CDN)
Access Control Grant/revoke per-file access to hospitals β€” toggle at any time
AI Prescription Scan Upload a prescription photo β†’ Tesseract.js OCR β†’ Gemini AI structured summary (symptoms, medicines, dosage)
Disease Prediction Extracted symptoms are fed to an ML model that returns ranked disease probabilities
Save & Share Summaries Save AI-generated summaries and selectively share them with your treating doctor
Medicine Verification Scan a medicine QR to verify authenticity against the Algorand blockchain
Real-time Notifications Get instant alerts when a hospital accesses your documents
View Prescriptions See digital prescriptions written by registered doctors in the network

πŸ‘¨β€βš•οΈ Doctor Dashboard β€” "Clinical Workspace"

Feature Description
Type Prescription Create structured digital prescriptions that go directly to the patient's vault
Prescription QR Generate scannable QR codes for pharmacies to instantly verify prescriptions
AI Patient Summaries View Gemini-generated clinical summaries shared by patients β€” structured, not raw
Previous Prescriptions Review your authored prescription history for continuity of care

πŸ₯ Hospital Dashboard β€” "Hospital Workspace"

Feature Description
Search Patient Find patients and request decryption access to their shared medical records
Access Logs View immutable audit trails of every document access for HIPAA compliance
Write Prescription Author prescriptions directly into a patient's decentralized vault

πŸ‘©β€βš•οΈ Nurse Dashboard β€” "Care Operations"

Feature Description
Emergency Face ID Match Capture a face via camera β†’ DeepFace CNN matches against the patient database instantly
Biometric Identification Identify unconscious/unresponsive patients without ID cards in emergency situations
Instant Record Access Once identified, immediately access the patient's permitted medical vault

πŸ’Š Pharmacy Dashboard β€” "Dispensing Desk"

Feature Description
Scan Prescription QR Scan doctor-issued QR codes to receive structured, authorized dispensing instructions
Medicine Details Look up medicine records and safe dosage instructions
Verify Authenticity Scan a medicine QR to check if it's genuine on the blockchain ledger
Dispensing History Track every prescription dispensed for compliance and safety

🏭 Vendor Dashboard β€” "Supply Chain Registry"

Feature Description
Register Medicine Add medicine batches with manufacturer, expiry, and quantity details onto Algorand
Cryptographic Hash Generate tamper-proof SHA-256 hashes from medicine payload for mathematical verification
Verification QR Create scannable QR codes containing blockchain-backed authenticity proofs
Authenticity Registry View all registered batches and their current verification status on the public ledger

πŸ€– AI & ML Pipeline

Gemini AI β€” Clinical Summarization

InfinityCare uses Google Gemini 2.5 Flash as the primary AI engine for transforming raw medical text into structured clinical intelligence.

Prescription Image β†’ Tesseract.js OCR β†’ Gemini 2.5 Flash β†’ Structured JSON
                                                              β”œβ”€ patientOverview
                                                              β”œβ”€ symptoms[]
                                                              β”œβ”€ medicines[]
                                                              β”œβ”€ dosage
                                                              └─ notes

Resilient fallback chain ensures zero downtime:

  1. Gemini 2.5 Flash β€” Primary (structured JSON output, 1-3s response)
  2. Ollama Cloud (LLaMA) β€” Secondary (OpenAI-compatible)
  3. Custom Healthcare AI β€” Tertiary (self-hosted ML backend)
  4. Degraded Response β€” Graceful fallback (raw OCR text with warning)

DeepFace β€” Biometric Patient Identification

A Flask microservice running DeepFace (VGG-Face CNN) enables contactless biometric identification:

  • Patient face images are synced from PostgreSQL to a local cache
  • Nurse captures a photo β†’ DeepFace runs multi-layer CNN cosine similarity matching
  • Returns patient ID + match confidence in under 2 seconds
  • Zero wearable/hardware dependency β€” any webcam or phone camera works

Disease Prediction

Extracted symptoms from Gemini are forwarded to a separate ML API that returns ranked disease probabilities with confidence scores β€” giving patients and doctors a preliminary diagnostic signal.

Presage SmartSpectra β€” Contactless Vitals

Presage Technologies' SmartSpectra SDK extends InfinityCare's camera-first infrastructure for contactless vital sign monitoring:

Vital Method
Heart Rate (BPM) Remote photoplethysmography (rPPG)
Heart Rate Variability (HRV) Autonomic nervous system analysis
Breathing Rate Respiratory cycle detection
Blood Pressure (Relative) Pulse waveform analysis
Apnea Detection Breathing pause identification

Key integration points:

  • Nurse Station β€” Extends the existing DeepFace camera flow to simultaneously capture vitals alongside patient identification (one scan = identity + vitals)
  • Patient Self-Monitoring β€” At-home vitals via phone camera, stored in the encrypted medical vault
  • Doctor AI Summaries β€” Presage vitals feed into the Gemini summary pipeline

⛓️ Blockchain β€” Algorand

InfinityCare uses the Algorand blockchain for medicine supply chain integrity:

  • Vendors register medicine batches β†’ cryptographic hash is generated and stored on-chain
  • Pharmacies scan QR codes β†’ hash is verified against the immutable ledger
  • Patients can independently verify any medicine's authenticity
  • Verification statuses: GENUINE Β· NOT_FOUND Β· EXPIRED Β· TAMPERED Β· SUSPICIOUS

πŸ› οΈ Tech Stack

Layer Technology
Frontend Next.js 16, React 19, TypeScript 5
Styling Tailwind CSS 4, Framer Motion, Glassmorphism UI
Database PostgreSQL (Supabase), Prisma ORM 7
Auth Better Auth (session-based, role-gated)
File Storage Cloudinary CDN
AI/LLM Google Gemini 2.5 Flash, Ollama Cloud
OCR Tesseract.js 7 (browser-side)
Biometrics DeepFace (VGG-Face CNN), Flask/Python
Vitals Presage SmartSpectra SDK
Blockchain Algorand (algosdk)
QR Codes qrcode + html5-qrcode
Forms React Hook Form + Zod validation
Deployment Vercel (frontend), Render (Python service)

πŸ“Š Database Schema

10 Prisma models powering the ecosystem:

User ──┬── Document ──── AccessLog
       β”œβ”€β”€ Prescription      β”‚
       β”œβ”€β”€ Notification       β”‚
       β”œβ”€β”€ Medicine       AISummary
       β”œβ”€β”€ Session
       └── Account
              Verification

Roles: PATIENT Β· DOCTOR Β· HOSPITAL Β· PHARMACY Β· VENDOR


πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • Python 3.9+ (for DeepFace service)
  • PostgreSQL database (or Supabase)

1. Clone & Install

git clone https://github.com/your-repo/infinitycare.git
cd infinitycare
npm install

2. Environment Variables

Create a .env file in the project root:

# Database
DATABASE_URL="postgresql://user:password@host:5432/dbname"

# Auth
BETTER_AUTH_SECRET="your-auth-secret"
BETTER_AUTH_URL="http://localhost:3000"

# AI Services
GEMINI_API_KEY="your-gemini-api-key"
OLLAMA_API_KEY="your-ollama-key"          # Optional fallback
OLLAMA_BASE_URL="https://ollama.com/v1"   # Optional
OLLAMA_MODEL="llama3.2"                   # Optional

# File Storage
CLOUDINARY_CLOUD_NAME="your-cloud-name"
CLOUDINARY_API_KEY="your-api-key"
CLOUDINARY_API_SECRET="your-api-secret"

# Blockchain
NEXT_PUBLIC_ALGORAND_APP_ID="your-app-id"

# Python Service
NEXT_PUBLIC_FACE_MATCH_URL="http://localhost:5000"

# Disease Prediction
PREDICTION_API_BASE_URL="https://your-prediction-api.com"

3. Database Setup

npx prisma generate
npx prisma db push

4. Run Frontend

npm run dev

5. Run Python Service (DeepFace)

cd src/python_service
python -m venv venv
.\venv\Scripts\activate      # Windows
pip install -r requirements.txt
python app.py

The app will be available at http://localhost:3000


πŸ“ Project Structure

healix-app/
β”œβ”€β”€ prisma/
β”‚   └── schema.prisma              # 10 models, 5 roles, 4 enums
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/                   # 14 API route groups
β”‚   β”‚   β”‚   β”œβ”€β”€ ai/                # Gemini summarize + Disease predict
β”‚   β”‚   β”‚   β”œβ”€β”€ auth/              # Better Auth endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ doctor/            # Prescription & summary APIs
β”‚   β”‚   β”‚   β”œβ”€β”€ hospital/          # Patient search & access logs
β”‚   β”‚   β”‚   β”œβ”€β”€ patient/           # Notifications, save summaries
β”‚   β”‚   β”‚   β”œβ”€β”€ pharmacy/          # QR scan & dispensing
β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   β”œβ”€β”€ patient/               # Patient dashboard page
β”‚   β”‚   β”œβ”€β”€ doctor/                # Doctor dashboard page
β”‚   β”‚   β”œβ”€β”€ hospital/              # Hospital dashboard page
β”‚   β”‚   β”œβ”€β”€ nurse/                 # Nurse dashboard page
β”‚   β”‚   β”œβ”€β”€ pharmacy/              # Pharmacy dashboard page
β”‚   β”‚   β”œβ”€β”€ vendor/                # Vendor dashboard page
β”‚   β”‚   β”œβ”€β”€ verify/[hash]/         # Public medicine verification
β”‚   β”‚   └── page.tsx               # Landing page
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ patient/               # 7 modals (Upload, Docs, Verify, etc.)
β”‚   β”‚   β”œβ”€β”€ doctor/                # 3 modals (AI Summaries, QR, History)
β”‚   β”‚   β”œβ”€β”€ hospital/              # 3 modals (Search, Logs, Prescribe)
β”‚   β”‚   β”œβ”€β”€ nurse/                 # 1 modal (Face ID Match)
β”‚   β”‚   β”œβ”€β”€ pharmacy/              # 3 modals (Scan QR, Medicine, History)
β”‚   β”‚   β”œβ”€β”€ vendor/                # 4 modals (Register, Hash, QR, Registry)
β”‚   β”‚   β”œβ”€β”€ auth/                  # FaceCapture component
β”‚   β”‚   β”œβ”€β”€ layout/                # Shared dashboard layout
β”‚   β”‚   └── ui/                    # Shadcn UI primitives
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”œβ”€β”€ auth.ts                # Better Auth server config
β”‚   β”‚   β”œβ”€β”€ auth-client.ts         # Client-side auth
β”‚   β”‚   └── services/
β”‚   β”‚       └── analysisService.ts # AI summary + prediction client
β”‚   └── python_service/
β”‚       β”œβ”€β”€ app.py                 # Flask + DeepFace biometric engine
β”‚       β”œβ”€β”€ requirements.txt
β”‚       └── Procfile               # Render deployment
└── package.json

🌐 Deployment

Service Platform
Frontend Vercel
Python/DeepFace Render
Database Supabase (PostgreSQL)
File CDN Cloudinary

πŸ‘₯ Team

Built with ❀️ for Hacktropica


InfinityCare β€” Because your health data should belong to you.

About

A zero-trust, AI-powered healthcare ecosystem where patients own their data, doctors work with AI intelligence, and medicines are verified on-chain.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages