Caution
HIPAA & CLINICAL COMPLIANCE DISCLAIMER MedIQ is currently operating in a Stealth Private Beta for clinical evaluation.
- No Signed BAA: This research platform does not have a signed Business Associate Agreement (BAA) with infrastructure hosts (Neon, Vercel). Do NOT input raw, unscrubbed Protected Health Information (PHI) in production.
- Clinical Decision Support (CDSS): MedIQ is an educational and reference validation CDSS designed for licensed healthcare professionals. It does NOT substitute for professional clinical judgment, local hospital guidelines, or institutional protocols.
Tip
Why Run Locally? For the absolute best clinical experience with zero delay, sub-second vector queries, and full auto-updating capabilities, we highly recommend running MedIQ on a local server.
- No Password Friction: Local execution unconditionally bypasses all login pages and access passwords, landing you directly on the clinical swarm dashboard.
- Sub-Second Latency: Directly binds with your local environment reducing network roundtrip times.
We have introduced fully automated launcher scripts designed for clinicians, operators, and developers who want a seamless "one-click" style experience.
These launchers keep you permanently connected to the GitHub repository to fetch the latest improvements and clinical crawlers dynamically every time they are run!
- Open Terminal: Press
Cmd + Spaceon your Mac, type Terminal, and pressEnter. - Paste & Run the Launcher: Copy and paste the single command below into the terminal window, then press
Enter:git clone https://github.com/king007pin/Mediq.git && cd Mediq && ./start.sh
- Enjoy!: The script will automatically pull the newest updates from GitHub, verify your system configuration, set up secure keys, boot the local server, and automatically open the MedIQ dashboard in your browser!
- For subsequent launches, simply run:
cd Mediq && ./start.sh
- For subsequent launches, simply run:
- Open Command Prompt: Press the
Windows Key, type cmd, and pressEnter. - Paste & Run the Launcher: Copy and paste the single command below into the Command Prompt window, then press
Enter:git clone https://github.com/king007pin/Mediq.git && cd Mediq && start.bat
- Enjoy!: The script will automatically pull updates, verify Node.js, install packages, configure secrets, boot the local server, and automatically open the MedIQ dashboard in your web browser!
- For subsequent launches, you can simply double-click the
start.batfile inside theMediqfolder using Windows Explorer! It will pull updates from GitHub and start your server immediately.
- For subsequent launches, you can simply double-click the
MedIQ represents a paradigm shift in Clinical Decision Support. Rather than routing complex multi-system complaints to a single "generalist" LLM (which introduces severe diagnostic anchoring bias), MedIQ maps symptoms to a 21-Specialty Clinical Matrix matching 19 MBBS Post-Graduate (PG) subject tracks.
[ Patient Complaint / Lab Sheet / Case File ]
β
βΌ
[ Dynamic Swarm Router Engine ]
β
ββββββββββββββββββββ΄βββββββββββββββββββ
βΌ βΌ
[ Keyword & Acuity Triage ] [ SSRF Safety Gate Check ]
β β
βΌ βΌ
[ Select Swarm: 3 <= N <= 10 ] [ DNS Resolve / Subnet Filter ]
β
βββββββββββββββββββββββββββββββββββββββ
βΌ βΌ
[ Agent 1: Emergency ] [ Agent 2: Cardiology ]
(Strategy: ABCDE First) (Strategy: Ischemic ACS)
β β
ββββββββββββββββββββ¬βββββββββββββββββββ
βΌ
[ Multi-Agent Peer Debate ]
β
βΌ
[ SOTA Consensus Synthesizer ]
β
βΌ
[ Server-Sent Events (SSE) Stream ]
β
βΌ
[ Glassmorphic UI Dashboard ]
The clinicianβs question dynamically allocates a specialist panel (
- Emergency & Acute Triage (
emergency): Executes the ATLS ABCDE framework. Investigates immediate life-threats first (tamponade, tension pneumothorax, PE) and mandates strict time-to-action triage buckets:STAT(Critical life-threat, <1 hour)Urgent(Acute diagnostic evaluation, 1-6 hours)Routine(Stable ward evaluation, <24 hours)
- Oncology & Malignancy (
cancer_care,gynae_oncology): WORST-CASE & RED FLAG HUNTER. Screens for occult tumors, RECIST 1.1 progression markers, and acute oncologic emergencies (SVC syndrome, spinal cord compression, tumor lysis). - Womenβs Health & Maternal Fetal (
obstetrics_gynaecology): MATERNAL-FETAL SAFETY SHIELD. Calculates gestational milestones, interprets CTG telemetry, and strictly filters pharmacology for trimester-based teratogenicity. - Pediatric Care (
paediatric_care): AGE-ADAPTED DEVELOPMENTAL TRIAGE. Enforces strict weight-basedmg/kgdosing and Holliday-Segar fluid equations.
- AES-256-GCM Envelope Encryption (
src/lib/phi-vault.ts): Securely vaults patient metadata under a dual-layer key envelope. It wraps a unique transaction Data Encryption Key (DEK) under a Master Key Encryption Key (KEK) using AES-256-GCM, outputting a highly secure 7-part base64url envelope:v1.[wrapped_dek].[dek_iv].[dek_tag].[payload_iv].[payload_tag].[payload_ciphertext] - Active Regex de-identification (
src/lib/phi-scrubber.ts): Automatically sanitizes system logs and memory contexts by scrubbing titled names, phone numbers, emails, SSNs, MRNs, and dates of birth. - SSRF Safety Gate (
src/lib/safe-fetch.ts): Outbound scrapers feature a custom SSRF filter. Resolves domains to their IP addresses to verify they do not belong to private range subnets (RFC1918, IPv6 local). It limits redirects (manual 5-hop location auditing) and enforces response size limits (25MB) to protect against DoS attacks.
MedIQ maintains a dense vector database of peer-reviewed literature, emergency protocols, and national guidelines. The master ingestion flow features a robust Null-Byte Sanitizer (\u0000 strip) to prevent PostgreSQL transaction abortions during PDF conversions.
| Category | Gold-Standard Clinical Sources Crawled |
|---|---|
| Global Guidelines | NICE (UK), WHO Guidelines, Cochrane Summaries, KDIGO (Renal), GOLD (COPD), GINA (Asthma), WikiEM, LITFL, MDCalc, ClinicalTrials.gov, PubMed Central, Radiopaedia, StatPearls |
| Pharmacology | DailyMed (FDA), WHO Essential Medicines, NLEM 2022 (India), PubChem Compounds, OpenFDA FAERS, PvPI Alerts (Pharmacovigilance), National Formulary of India (NFI) |
| Genetics & Rare Diseases | Gene Reviews, Orphadata (Orphanet Portal), OMIM (Mendelian Inheritance) |
| Indian National Protocols | AIIMS Clinical Protocols, ICMR National Guidelines, CDSCO Drug Alerts, FOGSI (Obstetrics), IAP (Pediatrics), INASL (Liver), IDSP (Surveillance), NACO (HIV), NCG India (Cancer), RSSDI (Diabetes), UIP (Immunization) |
| Component | Technology | Description |
|---|---|---|
| Core Framework | Next.js 16.2.6 (Turbopack) | Highly optimized React 19 serverless architecture. |
| Database Pool A | PostgreSQL (Neon serverless) | Operational transactional engine mapping cases, sources, and feedback. |
| Database Pool B | pgvector (RiveStack) | Separated vector corpus storage housing 384d semantic embeddings (bypasses Neon's 512MB free tier cap). |
| ORM | Drizzle ORM (0.45.2) | Ultra-fast TypeScript SQL schema definitions and migrations. |
| LLM Provider | NVIDIA NIM API | Low-latency inference hosting SOTA models (Llama 3.3 70B, Llama 4 MoE, Ministral 14B). |
| Connection Pooling | Undici Keep-Alive Agent | Custom HTTP connection pool (32 keep-alive workers) reducing TLS handshake latencies by 120-180ms. |
| PDF Extraction | unpdf (PDF.js Wrapper) | Streamlines serverless PDF parsing with manual memory cleanups (pdf.destroy()). |
- Node.js >= 22 (Required for
unpdf/Promise.withResolverssupport) - PostgreSQL Database Instance (or dual-pool Neon instances)
- NVIDIA API Key (for high-fidelity RAG embeddings and swarm completion)
Create a .env.local file in the root directory:
# Operational Relational Pool (Low-weight transactions)
DATABASE_URL="postgres://user:pass@host:port/operation_db?sslmode=require"
# Storage-Heavy pgvector Pool (Optional: maps embeddings, defaults to DATABASE_URL if omitted)
RIVESTACK_DATABASE_URL="postgres://user:pass@host:port/corpus_db?sslmode=require"
# NVIDIA NIM Integration
NVIDIA_API_KEY="nvapi-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
# Cryptographic Vault Keys (Must decode to exactly 32 base64 bytes)
# Ensure APP_PHI_KEK !== APP_SECRET_KEY to prevent key collapse
APP_PHI_KEK="aGFzaF92YXVsdF9zb3RhX2NyeXB0b19rZWtfbWVkX2Vx=="
APP_SECRET_KEY="c2VjcmV0X2tleV9kZXZlbG9wZXJfYmFzZV82NF9rZXk="
# Groq / OpenAI (Whisper fallback for YouTube and Audio ingestion)
GROQ_API_KEY="gsk_XXXXXXXXXXXXXXXXXXXX"
OPENAI_API_KEY="sk-proj-XXXXXXXXXXXXXXXXXXXX"
# Crawler Credentials (Optional)
TINYFISH_API_KEY="tf-XXXXXXXXXXXXXXXX"-
Clone and Install Dependencies:
git clone https://github.com/king007pin/Mediq.git cd Mediq npm install -
Generate Cryptographic Secrets: Generate random 32-byte keys for your environment:
npm run setup-secrets
-
Prepare Database Schemas: Apply CI-TEXT extensions and push schema structures via Drizzle:
npm run db:setup
-
Seed Administrator Credentials: Create the primary dashboard admin credentials:
npm run db:seed-admin
-
Execute Locally: Launch the high-performance Turbopack development server:
npm run dev
Open http://localhost:3000 in your browser.
MedIQ is validated under a comprehensive automated unit and integration testing suite utilizing vitest.
To run all 346 test specs verifying safety gates, the cryptographic vault, and swarm selection:
npm run testFor clinical QA benchmark harnesses:
# Run baseline diagnostic quality tests
npm run quality:baseline
# Run current clinical quality tests with regression diff
npm run quality:current- Lead Architect & Core Developer: king007pin
- SOTA AI Co-Pilot: Antigravity CLI (Google DeepMind) β Co-orchestrated the 21-specialty dynamic swarm routing logic, the secure connection pooling dispatcher, automated SQL transaction pipelines, and the real-time SSE stream sync layers.
MedIQ is open-source under private enterprise licensing.
β οΈ Clinical Disclaimer: MedIQ is a clinical decision support tool designed for educational exploration and review by licensed healthcare professionals only. It does not constitute medical advice or a substitute for expert clinical judgment. Always cross-reference recommendations with institutional protocols and local healthcare guidelines.