-
-
ClearChart — Privacy-First Cross-Platform Hybrid AI Medical Companion (Web, Android & iOS) built with Flutter & Firebase AI Logic.
-
Tier 1 (ONLY_ON_DEVICE): Local Privacy Firewall scrubs 7 PII items in 119ms with [REDACTED ON-DEVICE] highlights & PDF/TXT upload.
-
Tier 3 (ONLY_IN_CLOUD): Clinical Brief via Firebase AI Logic (gemini-3.8-flash) using only a sealed SHA-256 AnonymizedPayload.
-
Zero-PII Firestore Vault: Owner-only storage via Firebase Anonymous Auth with Raw JSON proof showing zeroPiiVerified: true.
-
Live Hybrid Diagnostics: Firebase Core, Anonymous Auth, App Check Verified, Remote Config (gemini-3.8-flash) & Execution Audit Trail.
-
Tier 2 (PREFER_ON_DEVICE): Rx timeline spacing Levothyroxine (6:30 AM) 4+ hrs from Iron & Vitamin D3 (1:00 PM) with safety alerts
-
Onboarding Step 1 — Private by Design: Personal details stay on-device before any cloud AI call.
-
Onboarding Step 2 — Clear Lab Results: Translating complex biomarkers into plain-English explanations and range bars.
-
Onboarding Step 3 — Daily Medicine Plan: Morning-to-Bedtime prescription schedules and critical drug-spacing alerts.
-
Onboarding Step 4 — 100% Free & Open Source: Zero paywalls, zero login walls, zero user-supplied API keys (Apache 2.0).
Inspiration
Every day, patients and caregivers receive confusing blood test results, discharge summaries, and prescriptions filled with Latin shorthand (HbA1c 6.8%, eGFR 54 mL/min, Levothyroxine 50mcg QAM PO). Trying to make sense of them before a doctor's visit, millions of people copy-paste raw medical documents—complete with full names, dates of birth, MRNs, SSNs, phone numbers, and home addresses—directly into cloud LLMs.
We built ClearChart to prove that patients should never have to trade their medical privacy for clinical clarity. Using Firebase AI Logic's Hybrid Inference architecture, ClearChart runs sensitive processing locally on-device when Gemini Nano is available and enforces a compile-time, zero-PII privacy firewall before anything ever reaches Cloud Gemini.
What it does
ClearChart is a 100% free, cross-platform (Web, Android, and iOS) medical lab report and prescription companion built around a three-tier Hybrid AI privacy architecture:
- Direct On-Device Clinical Summary (
ONLY_ON_DEVICE): When Gemini Nano is ready locally (Chrome Desktop Prompt API / Android AICore), ClearChart surfacesGet Clear Summary - On Device, delivering a plain-English clinical summary locally with zero cloud transfer—without even needing to strip personal details. - On-Device Privacy Firewall (
ONLY_ON_DEVICE): When cloud reasoning is used (or on devices without a local model), ClearChart scrubs PII/PHI locally via Gemini Nano + a deterministic on-device regex guard (PiiRegexSanitizercovering names, DOBs, MRNs, SSNs, US & international phone numbers, emails, and addresses). Users inspect every redaction live in a split-screen Raw vs. Redacted diff inspector. - Type-Safe
AnonymizedPayloadBoundary:ClinicalBriefRepository.generateClinicalBriefaccepts only a sealed, SHA-256-fingerprintedAnonymizedPayloadminted exclusively insidePrivacyFirewallRepository—never a rawString. Leaking raw patient text to Cloud Gemini is a compile-time error. - Deep Cloud Clinical Brief (
ONLY_IN_CLOUD): Sends only the verifiedAnonymizedPayloadto Firebase AI Logic (gemini-3.8-flash) to generate structured plain-English biomarker cards with custom clinical range bars (Low/Optimal/High), an interactive 5-question Doctor Visit Prep checklist, lifestyle guidance, and red-flag symptom warnings. - Offline-First Med & Jargon Helper (
PREFER_ON_DEVICE): Imports PDFs, text files, or scanned pill-bottle/prescription photos (on-device Google ML Kit OCR on mobile) and decodes Latin Rx shorthand (PO,BID,QHS,QOD,QAM) into a Morning-to-Bedtime dosage timeline with critical absorption-spacing alerts (e.g., 4-hour separation between Levothyroxine and Iron) plus an instant Medical Word Helper. - Verifiable Zero-PII Firestore Vault: Saves anonymized summaries strictly under each user's Firebase Anonymous Authentication UID (
users/{uid}/anonymized_reports/{id}), complete with an "Inspect Raw Firestore Document" JSON modal proving zero PII ever reached the cloud, plus one-click Markdown export for doctor visits.
How we built it
We built ClearChart with Google Antigravity from a single cross-platform Flutter codebase (flutter_bloc, get_it, equatable) running live on Web (https://clearchart-7c0c6.web.app) and Android (v1.0.0 APK on GitHub Releases), integrating 5 Firebase products at runtime:
- Built with Google Antigravity: Used Antigravity's agentic coding, architecture, testing, and live browser verification workflows to design the Clean Architecture layers, enforce the compile-time
AnonymizedPayloadprivacy boundary, configure Firebase products, and verify end-to-end Web and Android builds. - Firebase AI Logic (
firebase_ai ^5.1.0): PowersHybridAiRouter(onlyOnDevice,preferOnDevice,onlyInCloud), bridging Chrome's Built-in AI (LanguageModelPrompt API) and Android AICore with Cloud Gemini (gemini-3.8-flashusingThinkingLevel.lowand automaticgemini-2.5-flash/gemini-2.5-flash-literesilience fallback viaFirebaseAI.agentPlatform). - Firebase App Check (
firebase_app_check): Enforces endpoint protection across both Web and Android builds. - Firebase Remote Config (
firebase_remote_config): Dynamically controls cloud model names (cloud_model_name,cloud_clinical_model,med_helper_cloud_model), strict PII guard toggles, and all three clinical system prompt templates without redeploying the app. - Cloud Firestore (
cloud_firestore): Stores zero-PII clinical summaries enforced by owner-only security rules (firestore.rules). - Firebase Anonymous Authentication (
firebase_auth): Provides instant, zero-friction private vaults with no login wall or user-supplied API keys. - On-Device Ingestion & Clinical UI: Native Web & IO PDF/TXT extraction (
syncfusion_flutter_pdf), mobile photo OCR (google_mlkit_text_recognitionon Android/iOS), responsiveAdaptiveShell(Mobile / Tablet / Desktop), Light & Dark clinical themes, customBiomarkerRangeBarvisualizations, and a live Hybrid Diagnostics telemetry panel.
Challenges we ran into
- Enforcing privacy at the type-system level: Prompting a cloud LLM to "ignore PII" still transmits sensitive data over the wire. We solved this architecturally by enforcing a sealed
AnonymizedPayloadtype boundary so raw strings cannot even be passed to the cloud inference layer. - Graceful degradation across heterogeneous devices: On-device Gemini Nano availability varies across Chrome Desktop, flagship Android phones, and mid-range devices. We built transparent hybrid routing with live execution badges (
⚡ On-Devicevs.☁️ Cloud • Anonymized), 8-second local readiness guards, and a deterministic on-device regex safety net so every user gets a fast, private experience on any hardware. - Cloud latency & structured JSON reliability: Early tests on
gemini-3.8-flashhit503 Deadline expiredtimeouts and unsupportedMINIMALthinking-level errors. TuningThinkingConfig.withThinkingLevel(ThinkingLevel.low), enforcing a compactapplication/jsonkey contract, and adding automatic retry +gemini-3.8-flash-litefallback made cloud briefs fast and dependable.
Accomplishments that we're proud of
- True Multi-Platform Hybrid AI: One Flutter + Firebase AI Logic codebase running live on Web (
https://clearchart-7c0c6.web.app) and Android (v1.0.0release APK). - Auditable Zero-PII Cloud Proof: Judges and patients can click "Inspect Raw Firestore Document" inside the Saved Vault to verify firsthand that not a single name, DOB, MRN, or phone number ever touched Cloud Firestore.
- Zero-Friction Judging & Open Source: Live Firebase Hosting demo, downloadable Android release APK, 3 realistic 1-click sample medical reports, 100% free with zero paywalls, and licensed under Apache 2.0 (
https://github.com/techie2046/clearchart).
What we learned
- Hybrid AI shines brightest when privacy is the routing signal, not just offline convenience—combining on-device Gemini Nano with cloud Gemini unlocks sensitive healthcare workflows that cloud-only AI cannot responsibly offer.
- Firebase Remote Config + Firebase AI Logic is a superpower for production AI apps: upgrading models (
gemini-2.5-flash→gemini-3.8-flash) and refining clinical prompts takes seconds without rebuilding or redeploying client binaries.
What's next for ClearChart
- Native iOS release leveraging Apple Foundation Models via Firebase AI Logic.
- Longitudinal biomarker trend charts (tracking HbA1c, LDL, and eGFR over 6–12 months) stored purely as anonymized numeric time-series in Firestore.
- Multilingual plain-English clinical briefs so families can review lab reports in their preferred language.
