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.
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.
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)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 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) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
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:
- Gemini 2.5 Flash β Primary (structured JSON output, 1-3s response)
- Ollama Cloud (LLaMA) β Secondary (OpenAI-compatible)
- Custom Healthcare AI β Tertiary (self-hosted ML backend)
- Degraded Response β Graceful fallback (raw OCR text with warning)
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
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 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
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
| 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) |
10 Prisma models powering the ecosystem:
User βββ¬ββ Document ββββ AccessLog
βββ Prescription β
βββ Notification β
βββ Medicine AISummary
βββ Session
βββ Account
Verification
Roles: PATIENT Β· DOCTOR Β· HOSPITAL Β· PHARMACY Β· VENDOR
- Node.js 18+
- Python 3.9+ (for DeepFace service)
- PostgreSQL database (or Supabase)
git clone https://github.com/your-repo/infinitycare.git
cd infinitycare
npm installCreate 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"npx prisma generate
npx prisma db pushnpm run devcd src/python_service
python -m venv venv
.\venv\Scripts\activate # Windows
pip install -r requirements.txt
python app.pyThe app will be available at http://localhost:3000
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
| Service | Platform |
|---|---|
| Frontend | Vercel |
| Python/DeepFace | Render |
| Database | Supabase (PostgreSQL) |
| File CDN | Cloudinary |
Built with β€οΈ for Hacktropica
InfinityCare β Because your health data should belong to you.
