-
-
One record, three roles.
-
She says what's wrong.
-
The risk check advises.
-
Tidied on her phone.
-
Approved before she sees it.
-
Opened with a one-time code.
-
A person signs.
-
The desk, already read.
-
A first read, labelled AI.
-
She listens to it.
-
Ask about one region.
-
The facts come from code.
-
A clinician releases it.
-
The county is warned.
-
Under the hood.
Inspiration
A biopsy is a few cells on a glass slide, and the news is in them. Someone has to read it. In Kenya that someone is scarce. A 2017 survey of Kenya's public hospitals cites earlier studies of one pathologist for more than 725,000 people, and found a median wait of 14 days for a histology result where hospitals could do histology at all.
Picture Amina, 36 (our demo patient), in Nairobi. She finds a lump, and her doctor orders a histopathology examination of a breast sample. The order travels by hand, waits for a pathologist, waits for a report, and waits again for someone to explain it. Tabibu cannot make more pathologists. It gives each one a first read waiting when they accept a case, and it moves the order, the hand-off, the report and its explanation at the speed of a phone.
The same scarcity slows outbreaks. When confirming a disease depends on a few people who can run a test, a county learns of a cluster late. On 6 October 2026, Kenya's Ministry of Health confirmed the country's first imported case of Bundibugyo Ebola virus disease; WHO puts Ebola's average case fatality rate at around 50%. Every hour between a confirmed result and a warning counts.
So I asked: once a result exists, why should the explanation or the warning wait? And what if a qualified person still decided every one?
What it does
Tabibu is one app for patients, doctors and pathologists, in English and Kiswahili. The order is the case, so one record carries a person from booking to result:
- Book. Amina books a doctor and speaks her symptoms; the words come back for her to check. On her phone, AI can tidy what she typed, kept only if she taps "Use this". Her doctor reads a summary in English and Kiswahili.
- Order. The doctor orders a test from one catalogue (histopathology, a malaria smear, NAATs for Ebola) and sends it to a pathologist. An AI risk check advises and never clears: for notes that fit a viral haemorrhagic fever, it points to WHO's IDSR guidance and says so.
- Pre-read. When the pathologist accepts, Gemini reads the slide tile by tile. Code builds the heatmap, measures the largest focus and drafts the report. The draft is labelled AI, its confidence is capped at Low, and only the case's pathologist can read it.
- Score and sign. The pathologist scores the pre-read, asks the AI about one region if they want ("Ask AI", never saved), writes the report and signs. The doctor receives only the signed version.
- Explain. When the doctor marks the result discussed, Gemini drafts a plain-language explanation in English and Kiswahili. The doctor approves each draft before Amina can see it. She reads it, or listens to it in a voice labelled as computer-generated.
- Warn the county. When a pathologist signs a confirmed notifiable finding, it becomes an anonymous count: disease, county, date, epi-week and age band, nothing else. One confirmed case of a disease like Ebola raises a signal on its own; for one like malaria, the county's weekly count has to rise above its usual level. Seconds later, an alert waits for an authorised clinician in English and Kiswahili, with the disease, county, count and week filled in by code. Once approved, it reaches the county's clinicians first, then its patients, with Ministry of Health and WHO guidance.
Nothing reaches a person without a person. The pathologist signs the report, the doctor approves the patient's explanation, and an approver releases the alert. These are not prompts asking the model to behave; they are the shape of the system:
- Every number and every alert fact a person reads comes from code. The model labels tiles; code builds the heatmap, the measurements and the report's findings. The alert draft holds
{disease},{county},{count}and{weekStart}, which code fills from the evidence. The model writes prose around them, and a person releases it. - No client can send an alert. The Firestore rules give no app a write to an alert; only the approval function can mark one approved, and only an approved alert is delivered.
- A cancer result waits for the talk. The patient cannot read it until the doctor marks it discussed, and no push names a diagnosis.
It already ran, live, on the project you can test
The outbreak loop, 23 November 2026, from the alert's own timestamps in Firestore:
- 13:11:02 UTC: a pathologist signs a confirmed Ebola NAAT.
- 13:11:13: the alert waits for approval in English and Kiswahili, 11 seconds after the signature.
- After approval, as is: delivered to the county's clinicians and to both language channels 5 seconds later.
- The event behind it holds twelve fields, none of them a patient, a case or a facility.
The pre-read: 45 slide tiles read live by Gemini, Ready 2 min 43 s after the pathologist accepted (UAT-ITR-0001, US-PATH-01), with the heatmap and measurements built in code.
How good is the read? Measured, not claimed. On a fixed held-out set of 200 PatchCamelyon tiles never used for tuning, the pre-read's sensitivity is 70.0% (95% CI 60.4–78.1%) and its specificity 79.0% (70.0–85.8%) (EVAL-0001). These are 96 px tiles from a public Dutch dataset, not whole slides; about three tumour tiles in ten are missed, the model's stated probability tells right from wrong not at all, and no pathologist has reviewed the tiles or the drafts. That is why the pre-read is a prompt for the pathologist, capped at Low confidence, and never a diagnosis.
Tested end to end: I ran 26 user stories across the three roles on the live project, on an iPhone 14, the iOS Simulator and an Android phone (UAT-ITR-0001), behind more than 3,900 app tests, 703 Cloud Functions tests and 250 security-rules tests.
How I built it
Firebase AI Logic, in three places:
| Where | What runs there | Model |
|---|---|---|
| On the phone (hybrid inference) | The patient's symptom tidy prefers the phone and falls back to the cloud | Apple Foundation Models on iOS, Gemini Nano on Android (the model is chosen in Remote Config); gemini-3.5-flash-lite as the tidy's cloud fallback |
| In the app, in the cloud | Voice booking and "Ask AI" on a slide region through server prompt templates; the explanation read aloud | gemini-3.8-flash; gemini-3.8-flash-tts |
| In Cloud Functions | The symptom summary, risk check, pre-read, report translation, explanation drafts and alert drafts: jobs that run with no one holding the phone, next to the data they read (the slides, the signed report, the county's counts) | gemini-3.8-flash |
Firebase: Firestore with security rules per role, Cloud Functions (TypeScript), Auth, Storage, Cloud Messaging, App Check, and Remote Config, with a kill switch for every AI job on the server and in the app.
The app: Flutter (iOS and Android) with bloc, an encrypted offline cache (Hive), English and Kiswahili throughout, and freeRASP for runtime protection.
Data: PatchCamelyon H&E tiles (CC0) for the cancer pre-read and the evaluation; WHO's IDSR guidelines and fact sheets, and Kenya's Ministry of Health handbook, for the guidance a notice carries.
How every change shipped: one change record per pull request, each feature pull request reviewed to a 5/5 Greptile score, and every fix run on the phone before its commit.
Challenges I ran into
- Every pre-read failed at first. One tile call hung: a timed-out call was never cancelled, and the model ran on with no output limit. Each tile call is now aborted at 25 seconds, retried within a 240-second budget and capped at 1,024 tokens, and a tile that never answers is marked Unclear instead of guessed.
- Explanations were refused three times in four for advice-like words. The prompt now names the words the check refuses, and English refusals match only at a word start.
- Apple's default on-device guardrails refuse ordinary clinical notes ("bleeding", "fever"). The tidy only rewrites what the patient typed, so it uses the guardrails Apple provides for exactly that.
- Approvers had to retype the disease into the draft. Code now fills the facts on the approval screen as delivery does, so approving unchanged stays one tap.
Accomplishments that I'm proud of
- The whole loop runs, live, across three roles. One record carries Amina from a spoken booking to a signed report, an approved explanation in Kiswahili and a voice reading it aloud; all 26 user stories passed on an iPhone, an Android phone and the iOS Simulator.
- A warning eleven seconds after a signature. A confirmed Ebola result became an alert draft, ready for approval in two languages, without a single name, case or facility leaving the record.
- Hybrid inference a patient can see. The same "Tidy my notes" runs on Apple Foundation Models, on Gemini Nano or in the cloud, and every result says where it ran: On this phone or In the cloud.
- I published the pre-read's weaknesses before claiming its strengths. A held-out evaluation with confidence intervals, and a design that caps the AI where the numbers say it should be capped.
- Kiswahili is not an afterthought. Every screen, the symptom summary, the patient's explanation, every alert and the voice that reads it work in both languages.
- Built alone, from 11 November, in about two weeks, with every feature reviewed to 5/5 and tested on the phone before it shipped.
What I learned
- Let AI read and write; never let it count. Measurements, alert facts and every number a person reads come from code.
- Safety by construction beats safety by prompt. The strongest guarantee is that no path exists: no app can write an alert, and no prompt holds a patient.
- An honest number makes the case. Publishing 70% sensitivity is what justifies capping the pre-read at Low confidence and keeping the pathologist in charge.
Limits, said plainly
- Every alert in this project is synthetic: demo accounts and demo channels only, marked "Demo".
- The slides are public research data (PatchCamelyon), and the demo accounts are fictional people.
- The pre-read is a prompt for a pathologist, not a diagnosis.
What's next for Tabibu
- A pilot with one Nairobi pathology laboratory, starting with the cancer pre-read and real turnaround times.
- The alert engine on a real county channel, with the Ministry of Health's surveillance officers as approvers.
- More profiles: the malaria pre-read live, and more notifiable diseases.
Built With
- apple-foundation-models
- bloc
- cloud-firestore
- cloud-functions
- dart
- firebase
- firebase-ai-logic
- firebase-app-check
- firebase-authentication
- firebase-cloud-messaging
- firebase-remote-config
- firebase-storage
- flutter
- freerasp
- gemini
- gemini-nano
- google-cloud
- hive
- node.js
- patchcamelyon
- tts
- typescript