22 KiB
Diplodoctor
One health platform. Your own health file, kept on your device; a symptom
check-in by voice or text with urgency and red-flag rules; measurements and
trends (weight, blood pressure, glucose and more); lab reports read with you;
and Find care: doctors, clinics, hospitals and pharmacies near you. Read, log
and look up without an account, in five languages. The same core is meant to
serve a care home, a practice or a pharmacy later, as views on one platform
rather than separate apps: docs/platform.md.
Served at diplodoctor.orangecat.ch. Beta:
running, not released. Information, not a diagnosis, and not a medical device.
What is live, next and later: ROADMAP.md. Why it looks the way
it does, and what it does that ChatGPT's Health app does not:
docs/competition/chatgpt-health.md.
Features
| Feature | What it does |
|---|---|
| Personal file | Today, Records, medicines, appointments, notes and a profile, in this browser; optionally sealed on the server for signed-in people |
| Symptom check-in | Say or type what is wrong; red-flag rules set the urgency (an emergency shows only 144 / 112), the answer asks before it advises |
| Measurements | Weight, blood pressure and pulse, glucose, temperature, pain, sleep, steps; a trend, a high/low mark by arithmetic, an optional local reminder |
| Lab reports | Paste or photograph a report: every value, its range, the line it came from, questions for your doctor |
| Find care | Doctors, clinics, hospitals and pharmacies by postcode, city or position, kind of care and radius; call, website, directions |
| Ask | Questions about your own file, answered from it, names hidden first |
Find care: data and privacy
- Places come from OpenStreetMap through the public Overpass API (© OpenStreetMap contributors, ODbL). We try several public Overpass servers in turn, never in parallel, with a descriptive User-Agent, one request per area at a time, a few minutes of rest for a server that failed, and a day of caching. Please keep it that way: these are volunteer services.
- A postcode or city is looked up at the Swiss federal geocoder (
api3.geo.admin.ch) first and at Nominatim (one request a second, per its usage policy) abroad. - Location is used on demand: your browser asks first, or you type a postcode. It is rounded to about 1 km before any outbound call, the cache is keyed on the rounded value, and nothing stores or logs a coordinate, a postcode or a query (only which server answered and how many places).
- If no server answers,
POST /api/carereturns{ "error": "unavailable", "fallback": { "mapUrl" } }and the page offers OpenStreetMap's own search and a Retry. - A listing is a map of who is nearby, not a recommendation or a rating. Check coverage with your insurer.
Three kinds of help
| Does | Does not | |
|---|---|---|
| Any AI model | Reads, lists every value, flags what is outside its range, explains what it measures, drafts questions for an appointment | Diagnose, prescribe, advise on a medicine, or say a result is nothing to worry about |
| A health assistant (a name or a pseudonym) | Explains, translates, helps prepare an appointment, gives their experience and view, for a price they set | Give medical advice with a clinician's standing; what they say is an opinion, and is labelled as one |
| A licensed professional (verified licence; a name or a pseudonym) | Advises on what a result means for you, diagnoses and treats within their licence | Work outside the places they are licensed |
There is no "Diplodoctor model": the AI is whichever model answers, from the fleet's shared free chain or the reader's own key, and nothing is tied to one vendor.
The first line is software. The last two are people, and the difference between them is not a ranking: it is who is allowed to say what, and who vouches for them. An assistant may or may not hold a health qualification, and how helpful people found them is shown on their profile, so the person asking makes their own decision. A licence is what the law requires for medical advice where the patient is, and with a zero-knowledge proof a professional can show it is valid without showing who they are (planned). The line between giving medical advice and giving a view is set by law in almost every country, and it is the one rule of the product that is not ours to relax. Nobody is listed yet, and the pages say so.
Where it sits
Diplodoctor is one product on three planes, like everything else in the fleet
(bitbaum/fleet AGENTS.md is the authority; this is only how it shows up here):
- Loki builds and ships it, and holds its identity. Problem, solution,
mission and vision live in the Loki project profile; the site renders them
from the fleet map (
lib/fleet.ts) and does not author them.ROADMAP.mdandCHANGELOG.mdare the public record: Loki ingests them and/roadmapand/changelogread the map back throughbip-kit. - OrangeCat is its economy and, later, its identity. Assistants and licensed professionals will offer their work as OrangeCat services and be paid there, in any currency.
- Solon is its governance: who is admitted as a licensed professional, how helpfulness is evaluated and how a dispute is settled are decisions to be taken there.
It is built the way Causius is built, on the same packages, for people and later for care homes, practices and pharmacies.
Stack
The blessed column of fleet STACK.md, nothing else:
| Job | Here |
|---|---|
| AI | @bitbaum/ai-kit complete() over the shared free chain; no vendor SDK, no pinned model id |
| A reader's own model | ai-kit/byok + ai-kit/byok-probe, key kept in the browser only |
| Validation | zod (the report, every request body, the fleet map entry) |
| Rate limiting | limitkit |
| Accounts | @bitbaum/accountkit/auth runtime and screens on the existing Drizzle/Postgres account tables |
@bitbaum/mail-kit, for sign-in links, when a key is set |
|
| A list | listkit (filters, order, pages, in the address) + @bitbaum/searchkit (typo-tolerant) |
| Dates | @bitbaum/whenkit (nobody types a date) |
| Chat | @bitbaum/chatkit for Ask |
| Roadmap and changelog | bip-kit, from the fleet map |
| i18n | next-intl: English, German, French, Italian, Spanish |
| Design | @bitbaum/design-tokens (tokens.css + the Tailwind preset via @config) |
| Tests | Vitest, hermetic |
| Deploy | PR, CI, auto-merge, deploy to the box, Live check |
Fleet packages not used, and why
paykit and threadkit (they belong to paying and messaging people who help, which does not exist yet),
geo-kit, speechkit (it measures how someone speaks, not what they say), ai-forms (the add
forms have three fields; a form assistant would be more to read than the form).
Header and footer are @bitbaum/sitekit's application masthead and footer
(components/site/Masthead.tsx, components/site/SiteFooter.tsx): the menu, its phone fold, the
skip link, active states and touch targets are the package's, so a fix there reaches this site with
the next version. Diplodoctor supplies the words, the places and its mark. The language links and
the light/dark toggle are still this app's own, in the header's actions slot (in the footer on a
phone), because sitekit has neither yet.
What exists today
-
/todaywhat is next, the latest results and your medicines;/recordseverything in the file in one searchable, filterable list;/records/addadd a medicine, an appointment or a note -
/symptomthe symptom check-in;/measurelog a measurement;/profileyour profile, on this device -
/careFind care -
/askquestions about your own file, answered from it, names hidden first -
/accountyour account; one switch keeps your file in it, sealed, so it follows you to any device -
/sign-in,/sign-upaccounts: email and password, link, passkey, two-factor, OrangeCat or the shared sign-in -
/what Diplodoctor is;/platformhow it is built and why;/securitywhat protects a report;/ecosystemthe fleet, read from the fleet map -
/reports/newintake: paste a report or photograph up to four pages, pick translation languages -
/reports/[id]the report: every value with unit, printed range, flag and the line it came from; trends against earlier reports in this browser; questions for your doctor; terms explained; follow-ups the document asks for; the document in each language; export -
/reportsredirects to/records, which also imports an exported file -
/reports/samplea worked example with invented personal details -
/peoplethe three kinds of help and the rules for assistants and licensed professionals; nobody is listed yet -
/settingsyour own model -
/roadmap,/changelogthe public record -
POST /api/analyzereport in, health file out -
POST /api/model/checkdoes this key work, and which models can it use -
GET /api/healthis the site up, and can it read text and photos without a reader's key -
POST /api/symptoma symptom check-in, answered with an urgency and a next step; nothing stored -
POST /api/careplaces near a rounded position or a postcode/city; a POST so a position never sits in a URL -
POST /api/aska question about your own (redacted) file, answered from it; nothing stored -
GET/PUT/DELETE /api/filethe signed-in person's sealed file, only if they turned it on
Every page exists in English (/en/…), German (/de/…), French (/fr/…),
Italian (/it/…) and Spanish (/es/…); / opens in the browser's language. A
reading is written in the reader's language.
What does not exist yet
Said plainly, because the pages say it too. ROADMAP.md has the order.
- No marketplace, care abroad, care-home round, practice or pharmacy view yet. They are on the roadmap in that order; care abroad needs legal and quality rules first.
- Nobody is listed. Nothing pulls in OrangeCat services, labels them, shows how helpful people were or checks a licence. Proving a licence with a zero-knowledge proof is planned. "Have a person look at it" is planned.
- Accounts are optional, and your file stays on your device unless you say otherwise. You can sign in (email and password, a link, a passkey, two-factor, OrangeCat or the shared sign-in); reading a report needs none. One switch in Account keeps your file on our server too, sealed, so it follows you across devices. Until keys only you hold exist, we could technically read it, and the switch says so. Your own model key stays in the browser, never on the server. Reminders beyond this device and the EPD are on the roadmap.
- Photos are not anonymised automatically. The reader covers details by hand.
- PDFs are not read yet; paste the text or photograph the pages.
- No independent security review and no legal opinion on the medical-device question (Swiss MepV) yet. The second is a gate before the explanation step is promoted.
How a reading is made
lib/analyze.ts asks a model for ONE JSON object and lib/report.ts decides what to
trust in it:
computeFlagcompares each value with the printed bounds. The model's flag is used only where there is no numeric range to compare with, and a value is calledcriticalonly if the report itself says so.attentionFloormakes the urgency at least what the flags imply; the model may ask for more care, never less.- Every value carries the exact line it was read from, shown one tap away.
lib/report-trends.tsfollows a value across reports by its English name and unit, and never converts a unit.
Configuration
The free reading runs on whichever of the fleet's shared vendor keys this
deployment has. With none of them, /api/analyze answers 503 not_configured
and the intake page offers your own model or filing by hand.
| Variable | Effect |
|---|---|
GROQ_API_KEY, OPENROUTER_API_KEY |
The shared free chain (Groq, then OpenRouter's :free models). Either switches free reading on. A photo needs OpenRouter: Groq's free models cannot read images. Google's Gemini API is billed and is not in the chain. |
DIPLODOCTOR_MODEL |
Optional. Start the chain at this model instead of the front. |
DIPLODOCTOR_GROQ_MODELS and the like |
Optional per-vendor overrides, read by ai-kit's freeChain("DIPLODOCTOR"). |
Limits (per hour, in memory): 8 free readings per visitor, 60 on your own key; 30 questions on Ask on the free chain, 200 on your own key.
Accounts and the file kept in an account need more; .env.example lists every
variable with what it does:
| Variable | Effect |
|---|---|
DATABASE_URL |
Postgres for accounts. /api/health is red without it. |
BETTER_AUTH_SECRET |
32+ characters. Signs sessions and seals two-factor secrets. |
SECRET_SEAL_KEY |
32+ characters. Seals a file kept in an account. Without it that switch says it is unavailable. |
RESEND_API_KEY, RESEND_FROM |
Optional. With both, addresses are verified and sign-in links work. |
SIGNIN_ISSUER, SIGNIN_CLIENT_ID, SIGNIN_CLIENT_SECRET |
Optional. The shared bitbaum sign-in button. |
ORANGECAT_OAUTH_CLIENT_ID, ORANGECAT_OAUTH_CLIENT_SECRET, ORANGECAT_OAUTH_ISSUER |
Optional. The "Sign in with OrangeCat" button. |
After setting a key on the host, check it end to end:
curl -s https://diplodoctor.orangecat.ch/api/health # {"ok":true,"analysis":{"text":true,"photo":…}}
pnpm run check:analyze # the sample report through a real model, in all five languages
pnpm run check:ask # a symptom with no report: asked in German, French, English
check:analyze asserts that exactly the four values outside their range are flagged,
that nothing is called critical, and prints the rest to read. check:ask asserts that a
symptom question is answered in the person's own language, with questions before advice,
and with no medicine named. Neither is part of CI: they need a key and the network.
Privacy and security
A medical record is "besonders schützenswert" under Swiss data-protection law, so both are designed in rather than added:
- Anonymised before it leaves the browser.
lib/redact.tsreplaces names, addresses, AHV and IBAN numbers, phone numbers, e-mail addresses, dates of birth, and labelled patient, order, sample and insurance numbers with placeholders ([NAME-1]). The reader sees each replacement, can add their own words and preview the exact text sent. The model answers with the placeholders and the browser restores the real values. Photos are covered by hand incomponents/PhotoRedactor.tsx; the boxes are burnt into the pixels before upload. - Nothing stored on the server unless you choose it. A report goes to the model provider
and the answer comes back; only which model served it is logged. Reports, the placeholder
table and a reader's own API key live in the browser. A signed-in person may turn on one
switch that keeps their file on the server, sealed with
SECRET_SEAL_KEY(lib/health-file.ts,lib/secrets.ts); turning it off deletes the copy. - Anonymised hand-over. "Export anonymised" writes the report with every personal detail replaced and without the placeholder table.
- Headers (
lib/security.ts,proxy.ts): a per-request nonce CSP withstrict-dynamic,connect-src 'self'andframe-ancestors 'none'; HSTS for two years;nosniff;Referrer-Policy: no-referrer; a Permissions-Policy that allows the microphone and location on this site only (each on a button press) and turns off camera and payment; same-origin opener and resource policies;no-storeon every API response. - Abuse limits per visitor (
lib/limits.ts), and strict validation of every request body and imported file (zod).
This repository is public: no real person's report, name, birth date or number belongs in it, including in tests and the sample.
Design
The look of this product is one file: app/theme.css. Colour, typefaces, corner radius,
whether a headline is a serif in sentence case or a sans in capitals, and whether a button
shouts or speaks are all values there, read by @bitbaum/design-tokens and by the few
shapes in app/globals.css. No component sets a colour, a face or a radius of its own. So:
- "make it red and white" is the accent (
--public-accent) and its dark twin; - "more gothic" is
--theme-headline-font,--theme-headline-caseand the radii; - another typeface is
--font-display/--font-sans; - light or dark is the reader's choice, defaulting to their device's.
lib/theme.test.ts reads theme.css and fails if a change makes text unreadable (WCAG AA,
4.5:1) in either mode, so a look can be tried freely. lib/copy-budget.test.ts holds each page to a
word budget (Home is about 230 words): to add copy, cut copy.
It deliberately differs from OrangeCat, Loki and Solon, which are black with one orange
accent: this is for someone holding a result they may be afraid of, so it is light, calm and
rounded by default: warm paper and a deep pine green, not the clinical blue every hospital uses,
with amber and red kept clear for flagging a value. The structure, the tokens and the primitives
are the same, so the products still sit together. What a capability page says is real is decided in one file,
lib/capabilities.ts; pages name capabilities and never state a status.
Development
pnpm install
pnpm dev
pnpm run verify # format check, lint, typecheck, tests and build
pnpm run test:integration # needs DATABASE_URL naming a throwaway *_test database
pnpm run check:analyze # needs a vendor key: the sample report through a real model
pnpm run check:ask # needs a vendor key: a symptom question through a real model
Merging to main deploys: CI must pass, then the shared deploy workflow builds on the box,
health-checks and rolls back on failure. After every deploy, live-check.yml asks the live
site from outside whether every language answers, the security headers are on and reading
is switched on.