Before any of this became software, it was a dossier. Every report and photo had to be found, put in date order and filed, one folder per visit. Anyone who has dealt with Romanian bureaucracy knows the genre: nothing here gets solved, or even started, without a dossier. I just didn't expect my son's first one to open before he was born.
My son has a condition that several specialists have followed ever since. His dossier now holds years of records: PDF reports from clinic portals, a few scanned reports, and phone photos of printouts.
Every new doctor starts with the same question: what happened so far? Every time, I answered with the dossier. Today the answer is one private link that any doctor, here or abroad, can open: the whole history, in Romanian and English.
This isn't a story about his condition, though. It's about the project, seen through fifteen years of building software and leading teams: how I planned it, what I built, and the lines I drew around the AI. It did a substantial part of the work, but far from all of it.
A dossier is not a history
What I needed was one place with the whole story:
- a timeline of every event
- the measurements as charts
- the key readings and the care team
- every original document
Readable on a phone in a waiting room. Shareable with a doctor in one message. Closed to everyone else.
And in English. The best advice for my son may not be in our city, or even in our country. A specialist abroad should be able to read the full history and give a second opinion without waiting for me to translate it.
Is there an app for that? Something close, probably. But this is my son's medical history. If something was going to break, I wanted it to break on my terms, in a system I designed, understand end to end and can fix. I've been a software engineer for more than fifteen years. This is what that experience is for.
Private, on my terms
Private from whom? Not from everyone. Three companies see more than a stranger ever will. I chose each of them for one job, and I know what each can see:
- Apple stores the originals.
- Anthropic's model reads them to write the timeline.
- Cloudflare holds the key that opens the published copy.
The model is the one people will ask about, so here is my reasoning. The values in these documents are measured in millimeters, and a millimeter can change a doctor's decision. What reaches a doctor has to be exact. So I wanted the strongest reasoning available reading those pages, with training on my data turned off, then automatic checks on the numbers, then my own eyes on anything in doubt. This is not a side project for trying out technology. It has a real use.
What I refused is everything I didn't have to accept:
- identifiers a doctor doesn't need
- storage anyone could read
- a key an AI agent could reach
- a fact from his file in a git history
The rest of this article is about those refusals.
Planned like a project at work
The most useful thing I brought wasn't code. It was the habits of the job: write the decisions down, split the work into phases, define "done" before starting, review everything.
So the plan came first, and it was on its eleventh draft before the first commit. It held:
- Numbered decisions: hosting, encryption, who sees what.
- A leak review: every place personal data or a key lives, and the control for each.
- Nine phases, each ending with acceptance checks.
- A synthetic case first: a fictional child, fictional doctors, fake identifiers, even fake GPS coordinates in the photos, somewhere in the Black Sea, to prove the metadata gets stripped. Nothing real touched the code until everything worked on it.
Then I treated Anthropic's model like a very fast engineer who joined the team yesterday. Tireless, capable, and with no idea yet which mistakes are expensive here. The split was strict:
- The model does the judgment: reading each document, deciding the timeline entries, writing them in Romanian and English.
- Scripts do the mechanics: finding new files, converting photos, redacting, rendering PDFs, validating, building.
- I do everything that touches a secret, the cloud or a decision: approving held files, publishing, managing access.
Six days in total, until the site was live with every document on it. The building took about three: the app, the pipeline and the encrypted publishing chain. Most of the rest went into the content: getting every file of the dossier in order, then reviewing what came out of it, year by year. That part was slow, and it should be. Without AI, this is not a six-day project. Not even close.
What I built
An update looks like this: I drop new documents into a folder, ask the model to "update the timeline", read its report and review anything it held back. Then I run the publish script myself.
ON MY MAC
originals in iCloud (never changed)
|
v
Anthropic's model + tested scripts
(read, write RO and EN, redact, translate, check)
|
v
processed folder (outside git and iCloud)
|
v
build, then I publish: encrypt with my own key
|
ONLINE v
Cloudflare R2 (EU): ciphertext only
^
| reads, decrypts, logs each view
Cloudflare Worker
^
| checks the login
Cloudflare Access (one-time code by email)
^
|
family and doctors, in a browser
Under the hood, it's deliberately boring technology:
- The app is plain JavaScript rendered from a single data file, with self-hosted fonts and a strict Content Security Policy. No framework, no runtime dependencies, no request to anyone else's server.
- The pipeline is a set of small scripts with fixed inputs and JSON output, so the model runs the same commands every time, and every step is tested without it. A validator checks that both languages carry the same bullets, numbers and dates.
- Publishing encrypts every file separately and uploads only what changed. An index goes up last, so everyone switches to the new version at once, and the previous version stays in place for a one-command rollback.
- Serving starts at Cloudflare Access: a one-time code by email, personal and revocable, no shared password. The Worker then checks the login token again on its own, in case Access is ever misconfigured, decrypts, sets strict security headers and never lets the data or the documents be cached.
- Checking doesn't stop at "it deployed": a smoke test after every publish confirms that logged-out requests are refused, the bucket can't be read from outside, and what it stores is ciphertext.
Cloudflare offers a lot for a project this size:
- Four services: the Worker, Access, R2 for the encrypted files and D1 for a log of every login and document view, kept in the EU.
- Free tiers: all of it runs on them. If the files grow large enough to need more, the paid Workers plan is $5 a month, and that's a price I'm happy to pay.
- A switch halfway through: I moved storage from DigitalOcean Spaces to R2, because DigitalOcean's billing wouldn't accept a payment method. It turned out better: the Worker reads R2 through a binding, so there is no storage key to protect, and one account fewer to secure.
Behind all of it stand 214 automated tests.
Why redact, why encrypt
Because of principles, not because anyone asked. A doctor needs the findings, not our national ID numbers, phone numbers or home address.
Redaction covers every published copy, and it fails closed:
- What gets masked: ID numbers, phones, the address, patient codes and contract numbers. The labels stay visible, so a reader knows something was removed.
- Two detectors on every file: one reads labels and the layout of the patient block, the other is the model's own notes from reading the page. If the model saw an identifier the first one missed, the file is held.
- Scans and photos go through OCR twice, and the masks cover what either reading finds.
- Masked pages are rebuilt as images with a fresh text layer, so nothing from the original text survives.
- Four checks after masking: nothing leaked, everything else is still readable in its place, no clinical value was masked, and the masks stay small.
- Anything doubtful waits for me on a review sheet, original and masked copy side by side.
The second detector earned its place early: it caught addresses in documents laid out as tables.
Encryption is at rest, with a bonus:
- The bonus: R2 already encrypts what it stores, but every file is also encrypted on my Mac, with my own key, before it's uploaded.
- Sealed and bound: each object uses AES-256-GCM and is bound to its place in the bucket, so a file moved or swapped there fails to open.
- Names that say nothing: object names are derived from the key, so they reveal nothing about what they hold.
- People never hold a key, only the Worker does. Removing a doctor means taking one email out of a policy and ending their session, not changing a key.
The keys were never on the table
The most important part of the setup is how strict it is about secrets. Did the AI suggest it? No. Did it help me build it? Absolutely, once I knew what to ask for.
- Every key lives in a dedicated macOS keychain with its own password, unlocked only for the moment a script reads it. The model doesn't know that password.
- The model never publishes, deploys or pushes. It runs in a sandbox that limits which hosts it can reach and where it can write.
- A commit guard rejects any commit with a document or image outside the test data, a valid ID number, a secret, or anything from a private list of real names.
- Each secret reaches exactly one program, never as a command argument and never in a file. Tests check that with decoys.
Then there's wrangler login, Cloudflare's CLI login. It leaves a long-lived token in a plain text file in your home folder, with rights to deploy Workers and change databases on every account you can reach. On a laptop where an AI agent runs commands for you, that file is an open door. There is no such file on my Mac. The scripts use a narrow API token from the keychain, handed to a single command.
That leaves many steps only I can do, so I built a small separate app to track them: a local page with nine phases, 63 steps and 7 runbooks. Five of those steps handle a secret, and they run only in my own terminal. The model can tick a step only after checking the result itself.
Helpful, resourceful, not entirely trustworthy
Was the AI helpful? A lot. Resourceful? Definitely, if you know what you want to build, apply real engineering discipline and keep asking the right questions. Trustworthy? Not entirely. Three moments showed why I stay in the loop:
- Facts from the record, in the code. On the first day, I caught three values from the real record that had slipped into code comments and a reference file as examples: an age, a time, a measurement. Nothing that identifies my son, but still facts from his file, in a repository. They were replaced the same day, and the rule became explicit: nothing from the record goes into code, tests or commit messages, not even as an example.
- Scans. OCR misreads small print, so the number check failed correct English translations. Now the model explains each difference against the page, and the English waits until I compare them side by side.
- Patient codes. Reviewing the redacted copies, I saw patient codes left visible. Before anything went online, that became a new kind of identifier, and every year was redacted and translated again in one evening.
Is it perfect? No.
I know where the limits are:
- It still relies on trusting three companies.
- The detector finds identifiers only by labels it knows.
- OCR will keep misreading scans under certain conditions.
- A takeover of my Cloudflare account would expose what the Worker can decrypt. It's a risk I accepted.
Does it suit our needs? Absolutely.
Will I publish the code? No. It stays private, since even without any data in it, it says too much about one child. What I can share is the approach:
- Write the plan and the decisions down first.
- Prove everything on fake data.
- Let the AI read and write inside clear boundaries.
- Keep the keys and the approvals yourself.
- Make every step fail closed.
Plenty of parents carry a dossier like mine, and some of them are engineers. That's why I wrote this article.
The hard part was never the code. It was deciding what mattered: what a doctor needs to give good advice, who gets to see it, and what never leaves my hands. Fifteen years of building software and leading teams prepared me for exactly that. What my son gets out of it is simpler: whichever doctor we see next, here or abroad, gets his whole story in one link.