PharmaStackX Nexus — AI-powered medicine discovery brain built on Gemma 4. On-device E2B inference via LiteRT WebGPU + cloud 26B for AskRX (medicine chatbot), prescription scanning, smart pharmacist routing, and WhatsApp pipeline. Built for Nigeria. Designed for Africa.
# PharmaStackX Nexus — Gemma 4 Good Hackathon
> **Mission:** To ensure that no patient ever leaves a hospital without the medicine they need because "nobody knew where it was."
PharmaStackX Nexus is an AI-orchestrated medicine discovery platform built for the world. It moves beyond "AI features" to a **True AI App** architecture where a single Gemma 4 "brain" handles intent classification, medicine extraction, pharmacist routing, and patient consultation.
Medicine stock failures aren't a local problem — they happen in the UK, the US, across Africa, and everywhere in between. Nexus is built to solve it wherever it occurs.
## 📺 Watch the Demo Video
## 🧠 The "One Brain" Architecture
Nexus is built around a central orchestrator (`nexus-brain.ts`). Every interaction — whether it's a typed query, a photograph of a prescription, or an informal WhatsApp message — flows through this brain.
- **Intent Classification:** Gemma 4 determines if the user needs a consultation, a drug search, or a structured request from a scan.
- **Medicine Extraction:** Vision-enabled Gemma 4 extracts brand names, strengths, and dosages from photos of medicine boxes and prescriptions with near-perfect accuracy.
- **Connection Routing:** The AI analyzes nearby pharmacists and scores them based on proximity, historical response rates, and stock likelihood to find the best match for the patient.
- **Real-time Visibility:** The **Nexus Dev Console** (visible in the demo) provides a real-time window into the AI's "thought process," making its decision-making transparent.
## ✈️ Offline Nexus (Digital Equity)
Connectivity gaps exist everywhere. Nexus solves this by integrating **Gemma 4 Edge** via MediaPipe and WebGPU.
- **Zero-Network Mode:** When offline, the app seamlessly switches from cloud inference (26B) to on-device inference (E2B).
- **On-Device Vision:** Patients can scan prescriptions and get medicine guidance even in "Airplane Mode," ensuring healthcare access is never blocked by a …