On-device pharmacokinetic digital twin for medication safety. YC x Google DeepMind x Cactus Voice Agents Hackathon — April 18-19, 2026.
Voice in → Gemma 4 understands → function calls route → PK engine computes → time-aware risk + visualization out. Everything runs locally on the phone; cloud is only a fallback when on-device confidence is low.
Tavril is an educational wellness simulation, not a medical device. It models drug/food/supplement interactions using general pharmacology. It does not diagnose, treat, cure, or prescribe. Every alert directs the user to confirm with their prescriber.
┌──────────────────────────────────────────────────────────────┐
│ React Native + Expo (iOS / Android) │
│ │
│ Voice ──► Cactus STT (Parakeet) ──► Gemma 4 E2B (INT4) │
│ │ │
│ ▼ │
│ Function calls: │
│ • extract_health_entities │
│ • update_health_profile │
│ • check_interactions │
│ • calibrate_severity │
│ • generate_response │
│ │ │
│ TTS ◄─────── spoken answer ◄─────────┘ │
└──────────────────────────────────────────────────────────────┘
│
▼ (fallback / validation only)
┌──────────────────────────────────────────────────────────────┐
│ Python backend (FastAPI) │
│ • PK engine (one/two-compartment, CYP/PGx modulation) │
│ • RAD causal risk attribution │
│ • Interaction + food database │
└──────────────────────────────────────────────────────────────┘
| Path | What's in it |
|---|---|
App.tsx, index.ts |
Mobile app entry |
src/ |
React Native screens, hooks, components, on-device tools |
src/lib/pk/ |
Pharmacokinetic simulation (TypeScript) |
src/lib/cactus/ |
Cactus SDK integration + hybrid routing |
src/lib/database/ |
Local interaction/food database |
python-backend/ |
FastAPI service — PK engine, RAD, PDTC, interaction DB |
cactus-clinical-router/ |
Tool-calling router for the Cactus Python SDK |
data/ |
Interaction corpus (DailyMed + curated food/drug data) |
tests/, python-backend/tests/, validation/ |
Test suites + benchmark harness |
legal/ |
Privacy policy, terms, medical disclaimer, HealthKit disclosure |
patches/ |
Local patches applied to cactus-react-native |
HACKATHON_DOCS.md |
Cactus/Expo API reference used during the build |
npm install
cp .env.example .env # fill in optional API keys
# Dev build on a physical iPhone (Cactus needs a real device)
npx expo prebuild
npx expo run:ios --device
# Or in Expo Go (no Cactus, limited)
npx expo startThe Gemma 4 E2B model (~1 GB, INT4) is downloaded on first launch. Keep the phone plugged in for the initial fetch.
If you want cloud fallback for out-of-database questions, create a local .env with:
EXPO_PUBLIC_GEMINI_API_KEY=your_key_hereNo secrets are committed in this repository.
cd python-backend
python3.11 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
uvicorn api:app --reload --port 8000
# http://localhost:8000/docsnpm test # TS/JS
pytest # PythonAll keys are optional — the app works fully offline with on-device inference. Keys unlock cloud fallbacks and premium TTS.
| Variable | Used for |
|---|---|
EXPO_PUBLIC_GEMINI_API_KEY |
Cloud fallback when on-device confidence is below threshold |
EXPO_PUBLIC_OPENAI_API_KEY |
Higher-quality TTS via OpenAI (optional) |
See .env.example.
- Tested on iPhone 13 (4 GB RAM). Close other apps during demo.
- INT4 quantization is mandatory at this memory budget.
- Pre-download the model before any live demo.
The strongest live demo path is the Advocate screen:
- Tap to speak.
- Say:
I take atorvastatin every night. I had grapefruit juice today. What happens if I also take acetaminophen for a headache? - Tap again to stop.
Expected output:
- on-device Gemma audio transcription
- local PK computation
- concentration curves with highlighted peak timing
- PK ledger showing compute time, AUC0-12h, peak risk timing, and safe window
- mitigation view comparing the requested path to the safer option
Secondary prompt:
I take sertraline 50 milligrams every morning. My doctor just prescribed tramadol for back pain.
Code in this repository is provided for hackathon-submission review. Drug interaction data is derived from public DailyMed / DrugBank sources; check respective upstream licenses before redistribution.