The Problem:

A doctor writes "Hemoglobin 10.2 g/dL. MCV 72 fL." The patient doesn't understand it, and the next specialist never sees it. PUENTE keeps the record with the patient and translates it into plain language — but every sentence must quote the source span that backs it, or be marked unjustified instead of stated.

The design and the frontend of this software are plain on purpose.

I am disabled. I have ADHD and I am autistic, and a lot of stimulus confuses me. Buttons, colours, all of it is surface area for cognitive load. The system is built to spare the person that extra work — which is also why it can be used by someone of any age, and why that is an advantage for older adults as well.

It seemed especially important here, because when we are facing a medical situation we are often under fear, stress and uncertainty. I did not want cheerful or loud colours.

I chose Apache 2.0, as I do in almost all of my repositories, so that anyone can use it and modify it however they prefer.


Inspiration

The patient is the courier. That is the actual failure. A result gets printed, handed over, and whether the next professional ever sees it depends on whether a person remembered to bring a piece of paper to an appointment three weeks later. Meanwhile the patient holds a document they cannot read.

Both halves have obvious-looking fixes, and both fixes are worse than they look. "Put it in a portal" doesn't help someone who can't read the portal. "Run it through an AI summarizer" produces fluent text with no way to tell which parts the document actually supports — which, for a clinical document, is the only question that matters. A paraphrase that is 95% faithful is not 95% useful. It is a document you cannot trust any sentence of.

We wanted the version where the explanation carries its own evidence.

What it does

PUENTE is a shared clinical record for a hospital with a verifiable translator built into it.

The record follows the patient. Every order, result and report is attached to the patient and visible to whoever is currently treating them. Nobody carries paper between offices. Access is checked at read time against a current treating relationship — not granted permanently at first contact.

Every document is sealed on write. SHA-256 over canonical JSON of its kind, author, timestamp and content, computed before the write. Documents are append-only: firestore.rules denies update and delete.

Every generated sentence cites a span. When the translator explains a document, each sentence must quote text that appears verbatim and exactly once in the source. A sentence whose quote is missing, altered, or ambiguous because it occurs twice is marked unjustified and shown as an abstention — never as fact. In our own testing on a real-shaped lab report, 2 of 8 generated sentences came back unjustified. We show that count in the UI. Abstention is the feature.

It runs the hybrid path for real. Gemini Nano on-device in Chrome when available, falling back to the Gemini Developer API in the cloud when not — through Firebase AI Logic. Each draft reports which path actually produced it, because for clinical text "did this leave the machine" is not a footnote.

And it reverses. A patient's plain-language description of symptoms gets structured into a draft note for a professional to review. Never auto-promoted into a diagnosis or a confirmed finding.

Around that core: order tracking as an explicit state machine with overdue flagging, second opinions that attach with their own authorship instead of overwriting the first reading, manual documentary contradiction flagging, and a hash-chained audit trail the UI verifies independently on every load.

How we built it

TypeScript end to end — Next.js 16 on Vercel, Firestore, Firebase Auth, Firebase AI Logic. The language decision has its own record in docs/language-decision.md; the short version is that the hybrid inference requirement is only exposed through the Web SDK, which fixes the frontend, and nothing justified a second language on the backend inside the window.

The architecture has one rule it does not bend: the model never touches the decision path. The deterministic engine seals the document first. The model receives that already-sealed artifact and produces prose about it. The translation is stored beside the source, never inside it. Swapping the inference backend changes wording and nothing else — not the seal, not which document a claim traces to. That is the same discipline behind our other sealed-result work, and it is why an LLM can safely sit in a clinical product at all.

There is no server. Every write goes browser → Firestore, so firestore.rules is the entire enforcement surface: 242 lines, 44 automated tests against the emulator — 20 of them written from the point of view of a malicious treating professional, not an outsider — closed by default.

Built level by level, each level a usable product rather than a technical phase. There is no "security level" — authority and provenance exist from Level 1, because retrofitting them is how they end up decorative.

Challenges we ran into

App Check was broken and invisible. Every cloud-path request was failing 401 UNAUTHENTICATED. It never surfaced in development, because on-device inference never calls that endpoint — so the feature looked perfect on the machine where it was built and was broken everywhere else. The hybrid architecture hid its own failure.

"Running locally" was publishing. next dev still read and wrote the shared cloud project, whose demo passwords are printed in our own README. Anyone testing a private document locally would have published it. We found this while writing the warning telling people not to do it. Local-only mode against the emulators exists because of that.

We red-teamed ourselves and broke our own central claim. The verbatim-span rule ran in the client that generated a translation — and nowhere else. Writing directly to Firestore as a treating professional, we stored an explanation reading "Your blood test came back completely normal. No further action is needed," cited to a sentence that appears nowhere in the document, over a result showing hemoglobin 10.2 and MCV 72. The patient view rendered it as an ordinary citation.

The root cause generalized: with no server, every property was enforced where it was produced and never re-checked where it was consumed. The seal, the span, the hash chain — all written by a client, none verified by the reader. We also fabricated an audit chain from scratch that verified clean, which is why the badge now reads "Chain internally consistent" instead of "Chain verified."

The fix was to verify on read: every citation is re-checked against the document at display time and struck through if it does not hold, every seal is recomputed before the word "sealed" appears, and ungrounded sentences are excluded from text-to-speech — the one surface where a listener cannot see the warning beside the claim. Twenty adversarial tests now pin that behaviour.

The honest span check rejects a lot. Requiring a verbatim, unambiguous quote means a model that paraphrases its own citation gets abstained on. We could have loosened it to fuzzy matching and shown prettier output. We didn't, because the whole claim collapses if the citation is approximate.

Accomplishments we're proud of

The abstention path works and we show it. A demo that occasionally says "I could not justify this sentence" is a stranger thing to put on stage than one that always answers, and it is the only version of this that a clinician should be allowed to use.

The audit trail is tamper-evident rather than labelled immutable. Firestore rules have no hash primitive, so they enforce who may append and that the sequence advances; a stdlib-only verifier recomputes the whole chain on read. We say exactly that in the docs rather than writing "immutable" and hoping.

That we found the hole ourselves, and that the report naming it ships with the submission rather than being quietly patched. The audit separates what we confirmed by running it from what we only reasoned about, and lists the eight attacks that failed alongside the ones that worked.

And the gap list is published. TECHNICAL.md carries an unsoftened account of everything this cannot do. It costs us something in a competition. It is the right call for a repository that will outlive the competition.

What we learned

That the interesting constraint in clinical AI is not accuracy, it is attributability. A system that is right 95% of the time and cannot tell you which 95% is unusable. A system that is right 80% of the time and tells you precisely which 80% is a tool. We spent the window building the second one.

What's next

OCR, so a photographed study can be read at all — today only PDFs with a text layer work. Structured extraction of analyte, value, unit and reference range into fields, so PUENTE can reason about a value instead of handing it to a model. Spanish output. An amendment mechanism, since append-only with no erratum is not how real records work. A way to revoke a treating professional, which the authority model is shaped for but the application cannot yet do. And a measured unjustified rate against a real corpus, because right now we know the failure mode and not the frequency.

Try it

https://puente-pi-mauve.vercel.app — the sign-in page lists the fictional demo accounts; password puente-demo-2026.

Open demo case 1, expand "Explainability and provenance" on the translated result, and look at the source spans. Then add a document of your own and generate an explanation for it: every sentence will either quote your text or abstain.

No real patient data exists anywhere in this project. Everything is fictional.

Built With

Share this project:

Updates

Submission history