Inspiration

On the morning of October 18 this year I woke up with my right ear feeling blocked, and like most people I assumed it was wax or a cold, so when a doctor looked into my ear the next day, saw some congestion in the canal and sent me home with five days of ear drops, I went along with it, even though nobody had actually tested my hearing. It was day five before I had a proper hearing test, and by then my right ear had lost about 80 decibels, which is a severe loss, and the diagnosis changed to sudden sensorineural hearing loss, a condition where every day before treatment matters. I started steroid injections into the ear that same day, and over the next five days my hearing came back to a loss of about 28 decibels, which is mild, and I know how lucky I was. Those five days were not lost because anyone was careless, but because sudden hearing loss looks exactly like a blocked ear and the one test that tells them apart was not done until I pushed for it.

When I read about it afterwards I learned how common my experience is. The AAO-HNS guideline notes that the main first symptom of sudden hearing loss is a full or blocked ear, which is so ordinary that "both patients and physicians are not sufficiently frightened or worried by it." UK guidance (NICE NG98) says sudden hearing loss in the last 30 days should be seen within 24 hours, yet in a study of 518 patients the median delay to treatment was one day for people who went to an emergency department and fifteen days for people who started with their GP. The window for treatment is short, and most people spend it waiting for their ear to pop. I wanted something that sits in the browser you already have open and tells you, that same morning, that this one is not wax.

What it does

Golden Window is a triage aid, not a medical device. It is a calm, single-path check that takes about five minutes with any pair of headphones. You start by telling it what happened in your own words, typed or dictated, and Gemini Nano turns that story into the fields a clinician would ask about: when it started, which ear, whether it came on suddenly, and whether there was dizziness, ringing, a blocked feeling, a recent cold or flight, or any stroke warning signs. You see every field and can correct it before anything is decided, and your words never leave the laptop.

Next it checks your headphones are the right way round and at a comfortable volume, then plays short beeps in one ear at a time at four pitches, adjusting the level up and down to find the quietest beep each ear can hear. Because ordinary headphones are not calibrated, it never pretends to measure hearing in decibels; it compares your two ears with each other, which is the same comparison the guideline uses when no earlier hearing test exists. An optional hum test adds one more clue. Wax or fluid behind the eardrum can also cause a gap between the ears, and the hum test hints which, but none of it ever lowers the urgency.

The result is decided by fixed rules taken from published guidance, not by a model. Any sudden loss in the last 30 days ends with "get seen today", stroke signs end with "call your emergency number now", and there is no result that tells you to relax. You see a chart of your two ears side by side, a plain-language explanation, and the reasons behind the advice. From there it helps you act: it opens a map search for an urgent ENT clinic or emergency department near the city you type, sending only that city, and it writes a short note you can hand to the doctor, opening with a request for a hearing test (pure-tone audiometry) today to rule out sudden sensorineural hearing loss, after showing you exactly what will be sent. Every check is saved on your own device, so after treatment you can repeat it each day and show your ENT how the gap between your ears is closing.

How we built it

The app is React and TypeScript on Vite, deployed as static assets on Cloudflare Workers, and every AI call goes through Firebase AI Logic with App Check (reCAPTCHA Enterprise) in front of it. The interesting part was deciding, job by job, where each model should run, and the hybrid modes of the SDK let me encode those decisions directly.

Reading the person's story uses ONLY_ON_DEVICE with a JSON Schema response constraint, because free text about someone's health is the most private thing in the app and I did not want any path where it reaches a server. If Gemini Nano is not available the app does not quietly fall back to the cloud; it shows a short form instead. The plain-language explanation uses PREFER_ON_DEVICE, so it stays local when Nano is ready and otherwise falls back to cloud Gemini with only the confirmed structured fields. The doctor note uses PREFER_IN_CLOUD, because the bigger cloud model writes a cleaner clinical note, and when the connection drops the SDK falls back to Gemini Nano on its own. I added a "Try it offline" switch that blocks the Gemini endpoints inside the tab, so anyone can watch the note move from the cloud to the device, and every AI output carries a badge read from inferenceSource so the handoff is never hidden. The result page also ends with a short list of what ran where in that check, giving each job, its inference mode, whether it ran on the device or in the cloud, and how long it took. The place search is the one job I kept ONLY_IN_CLOUD with Google Search grounding, on purpose: a small offline model asked for hospitals would invent them. Grounding is not available on the free tier, so in practice, and whenever it is unavailable, the app shows a plain map search for an urgent ENT clinic or emergency department near your city instead of any model-written list. Remote Config holds the cloud model name so I can switch models without redeploying.

The hearing test itself is plain Web Audio: each tone goes through a channel merger so the other ear gets true silence, levels step down 10 dB after a "heard" and up 5 dB after a miss, the threshold is the lowest level heard twice on the way up, and silent catch rounds flag guessing. Saved checks live in IndexedDB, and dictation is only offered when Chrome can recognise speech on the device, so spoken words stay local too.

Challenges we ran into

The hardest problem was safety rather than code. A small on-device model reading "I woke up this morning and my ear sounds underwater" once filled in "gradual" and missed the blocked feeling, which under my rules would have softened the advice. I fixed it in three layers: the prompt now asks for the day and clock hour and the code works out the hours, a simple keyword pass on the device can add warning signs the model missed but can never remove one, and the person confirms every field before the rules run. The model explanation has its own guard as well, so any text that says things like "probably wax" or "no need to rush" is replaced with the rule-based wording.

Gemini Nano also takes several seconds to start a session, which felt slow at exactly the moment someone is anxious, so the app now asks for the explanation as soon as the tone test ends and has it ready while the person does the hum test. Finally, Google Search grounding ran out of free quota while I was testing, which is why the place search has a map fallback that never depends on a model.

Accomplishments that we're proud of

I am proud that the app never lowers urgency, whatever the model writes and whatever the test shows, and that it is honest about what a home test with uncalibrated headphones can and cannot tell you. I am also proud that the privacy story is visible rather than claimed: the person's words are read only on their device, the exact payload for the doctor note is shown before it is sent, and every AI answer says where it was produced. And the hybrid design does real work here, with each job placed on the device or in the cloud for a reason a patient would understand.

What we learned

I learned that hybrid inference is most useful when you treat the mode as a product decision rather than a performance setting. ONLY_ON_DEVICE is a privacy promise, PREFER_IN_CLOUD with an automatic fallback is a reliability promise, and choosing ONLY_IN_CLOUD for search is a promise not to make things up. I also learned that in a medical setting the model should explain decisions rather than make them, and that small models need guard rails that can only ever push towards caution.

What's next for Golden Window

I am going to keep working on this because I know how much of my own recovery came down to luck, and I would like the next person who wakes up with a blocked ear to have something better than luck on that first morning.

Next I want to test the tone check against real audiograms with an ENT clinic so the thresholds can be tuned on real patients rather than on the published criteria alone, add an antiphasic digits-in-noise test, which research shows works without calibration, and bring the same check to Android with Gemini Nano so it works on the phone people actually have beside the bed. I would also like to add more languages, since the first symptom is easy to describe in any of them.

AI and pre-existing code disclosure

Built during the submission period. Frameworks and libraries (React, Vite, Firebase JS SDK) are used as published. I used an AI coding assistant while building it.

Built With

  • chrome-prompt-api
  • cloudflare-workers
  • firebase-ai-logic
  • firebase-app-check
  • firebase-remote-config
  • gemini
  • gemini-nano
  • indexeddb
  • react
  • recaptcha-enterprise
  • typescript
  • vite
  • web-audio-api
  • web-speech-api
Share this project:

Updates

Submission history