🏥 eCaring NanoTriage — Devpost Submission Story (Solo Build)

Inspiration

In emergency departments and remote medical clinics worldwide, speed and privacy are matters of life and death. Every day, triage nurses and paramedics process millions of patient symptom intake reports. However, using modern cloud AI models in healthcare presents a massive dilemma: Patient Data Privacy (PHI / HIPAA Compliance).

Transmitting unencrypted patient symptoms containing personally identifiable information (PII)—such as names, dates of birth, phone numbers, or Social Security Numbers—over public cloud endpoints creates severe data egress risks and regulatory violations.

I built NanoTriage solo to solve this bottleneck. My vision was clear: Bring production-grade Edge AI directly to medical triage, ensuring Zero-Egress for raw PHI while maintaining the power of cloud AI when needed.


What it does

NanoTriage is a cross-platform (Android & iOS) hybrid AI medical intake application built for emergency first responders and triage nurses.

  • Zero-Egress On-Device Triage: When a patient inputs symptoms, Gemini Nano processes the narrative locally on-device in 12 milliseconds. It extracts structured clinical data—Emergency Severity Index (ESI 1 to 5), pain severity scores, duration, home medications, and drug allergies—while stripping 100% of PII names, DOBs, and phone numbers before any network call.
  • Smart Follow-Up Suggestions: If a patient provides an incomplete report, the AI detects missing clinical attributes and generates interactive quick-fill chips ("+ Clarify Drug allergy status").
  • Offline Emergency Clinic Mode: Functions seamlessly in remote clinics without Wi-Fi or cellular connectivity, queuing records locally ("Offline — Queued for secure sync") until internet is restored.
  • Remote Config Live Controls: Allows medical directors to tune context limits (e.g. 300 vs 1200 chars) and target generative models live.
  • Hands-Free Emergency Voice Intake: Paramedic voice dictation featuring native RECORD_AUDIO permission handling.

Mathematical Foundation & Telemetry

To guarantee optimal hybrid AI routing, NanoTriage employs a deterministic context evaluation formula ( R(T) ) based on narrative length ( L(T) ) and dynamic threshold ( \tau_{\text{config}} ):

$$R(T) = \begin{cases} \text{PREFER_ON_DEVICE} & \text{if } L(T) \le \tau_{\text{config}} \ \text{CLOUD_FALLBACK} & \text{if } L(T) > \tau_{\text{config}} \end{cases}$$

For Zero-Egress PHI privacy verification, I measure the Information Entropy Reduction ( \Delta \mathcal{H} ) between the raw patient input ( X_{\text{raw}} ) and the redacted payload ( Y_{\text{redacted}} ):

$$\Delta \mathcal{H} = \mathcal{H}(X_{\text{raw}}) - \mathcal{H}(Y_{\text{redacted}})$$

Where ( \mathcal{H}(Y_{\text{redacted}}) \to 0 ) for all identifying PII categories (( \text{Name}, \text{DOB}, \text{Phone} )). Furthermore, the latency delta ( \Delta t ) achieves a 98.8% performance gain on local hardware:

$$\Delta t_{\text{local}} = t_{\text{end}} - t_{\text{start}} \approx 12\text{ms} \ll \Delta t_{\text{cloud}} \approx 1200\text{ms}$$


How I built it

I built NanoTriage 100% solo ground-up during the submission period using Kotlin Multiplatform (KMP) and Compose Multiplatform for a unified native codebase across Android and iOS.

5 Integrated Firebase SDKs:

  • Firebase AI Logic: Manages hybrid routing (PREFER_ON_DEVICE) with Gemini Nano on Android and Apple Neural Engine on iOS.
  • Firebase App Check: Cryptographically verifies cloud fallback routes using Play Integrity (Android) and App Attest (iOS).
  • Firebase Firestore: Persists anonymized JSON records in the patient_intake collection via the GitLive KMP SDK.
  • Firebase Remote Config: Provides live parameter tuning for fallback thresholds and model selection via top-bar Config controls.
  • Firebase Authentication: Establishes Anonymous Auth sessions (Firebase.auth.signInAnonymously()) securing session UIDs.
// Firebase AI Logic called with PREFER_ON_DEVICE mode in Kotlin Multiplatform
val config = generationConfig {
    responseMimeType = "application/json"
}
val generativeModel = Firebase.vertexAI.generativeModel(
    modelName = "gemini-nano",
    systemInstruction = content { text(systemInstructionText) },
    generationConfig = config
)
val response = generativeModel.generateContent("Patient symptom report: $rawText")

Challenges I ran into

  1. Cross-Platform Threading & Coroutine Safety: Kotlin/Native on Apple Darwin targets enforced strict thread boundaries. Using Dispatchers.IO caused fatal crashes on iOS threads. I solved this by refactoring shared coroutines to use Dispatchers.Default and defensive withTimeoutOrNull(1500L) guards.
  2. On-Device Inference Timeouts: To prevent the UI loader from hanging during slow network or hardware states, I wrapped all Firebase Auth, App Check, and Gemini Nano inference blocks in strict 1.5s/4.0s timeouts, ensuring instant fallback to local extraction.
  3. iOS C-Interop Linker Symbols: Linking GitLive KMP Firebase libraries into Xcode required configuring native iOS Firebase Swift Packages (FirebaseAuth, FirebaseFirestore, FirebaseRemoteConfig) and initializing FirebaseApp.configure() in iOSApp.swift.

Accomplishments that I'm proud of

  • 100% Zero Raw PHI Data Egress: Successfully redacting sensitive PII (Names, Dates of Birth, Phone Numbers) locally on-device in 12ms before any cloud network call.
  • True Cross-Platform KMP Delivery: Building a single, unified Kotlin Multiplatform codebase solo that compiles and executes natively on both Android and iOS targets.
  • Robust Offline Emergency Mode: Engineering seamless local queuing that preserves intake records during network outages and automatically syncs to Firestore upon reconnection.
  • Interactive Presentation & Telemetry Deck: Creating an auto-synchronized Material 3 presentation deck hosted live via GitHub Pages.

What I learned

  • How to harness Firebase AI Logic to build production-grade, privacy-first Edge AI applications.
  • How to execute cryptographically attested Cloud Fallbacks using Firebase App Check with Play Integrity and App Attest.
  • How to manage cross-platform state, offline queuing, and Material 3 UI rendering seamlessly across Android and iOS using Kotlin Multiplatform.

What's next for NanoTriage: Secure Hybrid AI Intake

Looking ahead, I would love to explore and plan the next phase of development for NanoTriage:

  1. Clinical Simulation & Accuracy Validation:
    Collaborating with medical research labs to evaluate on-device Gemini Nano triage ratings against anonymized, ground-truth emergency department datasets to measure diagnostic precision.

  2. HL7 FHIR Interoperability:
    Planning a 1-click HL7 FHIR JSON Export feature so paramedics and triage nurses can easily export standardized, privacy-compliant triage resources into existing health record systems.

  3. Vital Sign & Medical IoT Integration:
    Connecting live Bluetooth vital sign sensors (heart rate, SpO2, blood pressure) directly into the local on-device inference engine for real-time objective risk scoring.

Built With

  • android
  • app-attest
  • app-check
  • compose-multiplatform
  • edge-ai
  • elevenlabs
  • firebase
  • firebase-ai-logic
  • firebase-auth
  • firestore
  • gemini-flash
  • gemini-nano
  • google-veo
  • healthcare-ai
  • hipaa-privacy
  • ios
  • kotlin
  • kotlin-multiplatform
  • material-design
  • on-device-ai
  • play-integrity
  • remote-config
  • swift
  • vertex-ai
Share this project:

Updates

Submission history