-
-
ML Architecture of MedAccess AI
-
Backend Architecture of MedAccess AI
-
Facility Registration
-
Policy Submission
-
Fund Allocation
-
Automatic AI PDF Parsing
-
Claim Submission
-
AI Claim Evaluation and Fraud Detection
-
Instant Claim Resolution
-
Claim Adjudication
-
AI Automated Decision Support
-
Multiple Grant Disbursement Methods
-
Instant Disbursement
-
Analytics Dashboard
-
Audit Logs
Inspiration
Every year, millions of individuals delay or avoid necessary medical treatment simply because they cannot afford immediate out-of-pocket expenses. An unexpected emergency room visit, an expensive diagnostic scan, or a vital prescription copay can instantly push an individual or family into acute financial distress.
Worse yet, traditional relief programs and insurance reimbursements are buried under a mountain of bureaucracy—forcing people in distress to wait 14 to 30 days for claims to be reviewed and checks to clear. At the same time, existing help desks operate as passive ticket logs: they fail to comfort patients experiencing severe emotional panic, while cloud-based AI solutions create serious privacy risks by uploading protected health information to third-party servers.
We built MedAccess AI on a simple, non-negotiable belief: when someone is facing a medical or mental health crisis, financial relief and compassionate care must arrive in seconds, not weeks—with total privacy guaranteed.
What it does
MedAccess AI is an edge-first clinical triage, document-verified medical invoice parsing, and emergency copay relief platform. It turns a weeks-long administrative ordeal into an autonomous, sub-60-second point-of-care workflow:
- 24/7 Psychological First Aid (PFA) & Clinical Advisor: Distressed patients converse with an empathetic local AI counselor trained in active listening, de-escalation, and medical triage.
- Deterministic Life-Safety Interception: Any detection of acute crisis, self-harm, or suicidal ideation instantly triggers hardcoded safety overrides, elevating the claim to ESI Level 1 (Critical) and rendering interactive, one-tap hotline cards (Tele-MANAS, Vandrevala Foundation, 988).
- Layout-Aware Medical Invoice Extraction: A spatial 2D parsing engine reads dense, multi-page hospital summaries, lab sheets, and pharmacy bills, extracting exact balances due across currencies without requiring manual data entry.
- Autonomous Emergency Severity Index (ESI) Scoring: An integrated DeepRank ML classifier analyzes symptom severity, clinical tokens, and bill amounts in milliseconds to categorize urgency from ESI Level 1 (Critical) to Routine.
- Fraud & Claim Duplicate Sentinel: Deterministic SHA-256 and perceptual visual hashing cross-reference incoming documents against historical records to prevent recycled or altered bills.
- Instant Emergency Micro-Grants & Closed-Loop Vouchers: Pre-allocated institutional health funds disburse emergency copays directly to the patient's bank account via instant payment rails (UPI/IMPS/ACH) or issue digital single-use pharmacy vouchers in under 60 seconds.
How we built it
MedAccess AI is architected as an offline-first, privacy-preserving full-stack ecosystem:
- Mobile & Patient Portal: Built with Flutter, designed around WCAG 2.1 AAA accessibility standards, real-time Socket.io bi-directional updates, voice note intake, and an intuitive Admin Health War Room.
- On-Premise AI & NLP Engine: Integrated
@xenova/transformersto run quantizedQwen2.5-0.5B-Instructand sentiment models locally on CPU inside our Node.js container. This achieves complete patient confidentiality with zero cloud API token fees. - Spatial Document Processing: Powered by Linux
poppler-utils(pdftotext -layout) for coordinate-preserving table extractions, coupled with a lightweight Tesseract.js OCR fallback for scanned images. - Backend & Asynchronous Queue: Built with Node.js, Express, TypeScript, and BullMQ / Redis to process document extraction and ML triage jobs asynchronously without blocking real-time chat interactions.
- Database & Vector Search: Powered by Supabase (PostgreSQL), using
pgvectorfor semantic clinical policy matching and atomic transactional locks for fund balances. - Financial Rails & Audit Engine: Automated disbursement pipelines integrated with RazorpayX and Stripe, alongside a dynamic PDFKit reporting service that compiles institutional compliance reports with cryptographic checksums.
Challenges we ran into
- Spatial Table Extraction on Unstandardized Bills: Hospital invoices are notoriously messy—columns are uneven, totals are often right-aligned, and many bills omit currency symbols entirely. Standard PDF scrapers scrambled the rows into unreadable text blocks. We solved this by developing a coordinate-aware layout extraction pipeline that anchors to financial table rows and extracts column numbers based on 2D whitespace boundaries.
- Running Real-Time LLMs on CPU Without Cloud APIs: Running a language model on-premise without GPU acceleration often leads to high latency and thread blocking. We resolved this by quantizing
Qwen2.5-0.5B-Instructto 4-bit ONNX weights, streaming tokens efficiently while maintaining warm memory singletons. - Deterministic Life-Safety Safeguards: Machine learning models are probabilistic, but medical life-safety cannot be left to chance. We designed a dual-layer architecture where hardcoded, deterministic regex interceptors execute before the ML inference pipeline, ensuring crisis hotlines and ESI Level 1 alerts trigger immediately without fail.
- Concurrency & Double-Spend Protection: When multiple emergency claims are submitted simultaneously against a limited health fund pool, standard database updates can lead to over-disbursement. We implemented atomic database transactions and strict balance verification locks to ensure absolute financial integrity.
Accomplishments that we're proud of
- Sub-60-Second End-to-End Resolution: Reduced an emergency copay approval and disbursement cycle that traditionally takes weeks down to under a minute.
- 100% On-Premise Privacy: Zero patient data or medical invoices ever touch external third-party AI APIs. Everything runs privately on the host server.
- 23/23 Passing Integration & Security Tests: Validated our entire platform across 23 rigorous test suites—including concurrent race conditions, corrupt attachment handling, prompt injection defense, multi-tenant isolation, and perceptual duplicate detection.
- Zero SaaS Overhead: High-throughput clinical triage and OCR document extraction at zero recurring per-token cost.
What we learned
- Layout Geometry Trumps Raw Text: When dealing with invoices and medical charge sheets, preserving spatial 2D coordinates is vastly more reliable than dumping raw OCR strings into a generic prompt.
- Edge Intelligence is Ready for Production: Compact, quantized open-source models running locally on standard CPUs can deliver compassionate, context-aware Psychological First Aid when paired with well-structured clinical system prompts.
- Safety Must Be Layered: Combining deterministic safety rails with probabilistic machine learning creates a secure, reliable foundation for high-stakes healthcare applications.
What's next for MedAccess AI
- Electronic Health Record (EHR) Integration: Building native FHIR and HL7 adapters to allow direct, verified synchronization with hospital management systems.
- Expanded Pharmacy Network Integrations: Enabling direct, dynamic QR-code redemptions across national pharmacy chains for immediate over-the-counter medication pickup.
- Client-Side On-Device Inference: Porting quantized triage models directly onto mobile devices via Flutter/TFLite, enabling psychological first aid and bill scanning even when completely disconnected from cellular networks.
Built With
- bullmq
- dart
- docker
- express.js
- flutter
- machine-learning
- node.js
- ocr
- onnx
- pdfkit
- pgvector
- poppler
- postgresql
- qwen
- razorpay
- redis
- socket.io
- supabase
- tesseract
- transformers
- twilio
- typescript
- websockets
Log in or sign up for Devpost to join the conversation.