---
title: 'Day 8: Find Care, Book a Doctor, Call an Ambulance'
series: Building the Caladrius PHR with agents
part: 8
series_total: 15
date: '2026-11-25'
reading_time: 14 min
description: 'Up to Day 7, everything the PHR did was about records. On Day 8 it learned
  to help a person find and book care over UHI: search hospitals, blood stock and
  generic medicines, book a consultation with a doctor, and ask an ambulance provider
  for a quote.'
canonical_url: https://caladriushealth.ai/solutions/phr-build-diary/day-8-find-care-book-a-doctor-call-an-ambulance/
publisher: Caladrius Health AI Studio
---

# Day 8: Find Care, Book a Doctor, Call an Ambulance

Up to Day 7, everything the PHR did was about records. On Day 8 it learned to help a person find and book care over UHI: search hospitals, blood stock and generic medicines, book a consultation with a doctor, and ask an ambulance provider for a quote.

*The PHR is built by a small Caladrius team (Giri, Krishna, Preetha and me) working with AI agents; each post ends with what the day meant for each of our areas.*

Up to Day 7, everything the PHR did was about records: creating an identity, linking what hospitals hold, deciding who
may read it, keeping it in a locker. Those are the [ABDM](https://caladriushealth.ai/what-is-abdm/) milestones P1 to P4,
and they're what the app is certified against.

On 5 November the app learned to help a person **find and book care**. Through UHI, the Unified Health Interface, a
person can now search PM-JAY empanelled hospitals, blood stock, transplant hospitals and Jan Aushadhi generic medicines
and outlets; book a physical consultation with a doctor; and ask an ambulance provider for a quote. Nine PRs merged,
eight into `dev` and one promotion to QA, but they carried more new surface than any day since Day 0.

The day ended with something much smaller that people noticed more: a near-black theme called **Charcoal**.

---

## 1. Four PRs stacked like floors of a building

UHI arrived as a stack of branches, each built on the one below:

```
#176 UHI request signing                      (merged on Day 7)
  └─ #178 Find care: tables, routes, signed callback, four search screens
       ├─ #181 UHI settings on QA, permission text, the UHI plugin rule
       └─ #182 a stub UHI gateway and the Find care functional tests
            └─ #183 Book a doctor and every catalogue search
#186 Ambulance booking, phase 1                (separate, the same day)
```

Stacking is how agents can keep moving while review happens: the next floor is built while the one below is still
being inspected. It has a cost, and every PR in the stack says so in its first lines (stacked on #178; retarget to
`dev` once it merges). The agent that built each floor also did the retargeting as the floors below merged. Without
that sentence at the top of each PR, a stack becomes a puzzle for whoever merges it.

## 2. Find care: search only, nothing personal

The first four UHI services (PM-JAY hospitals, blood banks, NOTTO transplant hospitals and Jan Aushadhi) are **search
only**. UHI offers no booking for them. The design rule for all four is that **nothing personal leaves the system**.

**On or off, never half.** UHI needs four settings: our subscriber id, our public key id, our private key and the URL
where answers come back. All four or none. With none, the patient routes answer `503 UHI_NOT_CONFIGURED` and the
callback route isn't mounted at all. In production the private key must load as Ed25519 at startup or the API refuses
to start.

**The routes.** The app posts a search, then reads it back as answers arrive. There are reference lists for states and
districts (LGD codes) and the code tables each service uses. A per-account rate-limit tier
sits on top of the global limits.

**The callback is where the risk is.** UHI is asynchronous: the gateway acknowledges the search, then providers answer
later by calling *us*. Anyone on the internet can call a public endpoint, so `on_search` handles a request in a strict
order:

1. Keep the **raw body**.
2. **Check the signature against the UHI registry before parsing anything.**
3. **Reject replays.**
4. **Acknowledge at once**, then store the answer.
5. **Fail closed** at every step.

**Location is personal data.** A location search sends the point **rounded to two decimal places, about 1 km**,
rounded by the API before anything else happens; the exact point is never stored, logged or sent. The filters and every
received catalogue are encrypted at rest. Answers are purged after 24 hours by default, are **never shown past 48
hours** whatever the setting (one of the plugin's go-live checks), and never past the answer's own time-to-live. Logs and
audit carry ids and statuses only, never filters, locations or catalogues.

**The browser never talks to UHI.** It never holds a key or a raw UHI payload. The API signs, sends, receives and turns
each provider's catalogue into a simple result card. So the content security policy didn't change at all.

## 3. Four screens, and the plugin as the referee

The screens follow a design canvas made beforehand: a Find care tile on Home, a hub, and one search per service. They
render results **as they arrive**, because UHI answers trickle in from several providers, with a "so far" state,
timeouts, empty results, Try again and client-side paging. Each of those behaviours is a rule in the plugin, cited where
it's used.

The strings NHA requires are used **word for word**, each with its source next to it: the line telling the person to call
ahead, the note that blood stock is "indicative", and showing the transplant coordinator's phone first.

The plugin also decided what we *couldn't* build yet, and the PR lists those departures from the design rather than
hiding them:

- **No PM-JAY speciality filter** at first: its codes must come from NHA's PM-JAY API, which wasn't integrated yet.
  (It was by the end of the day.)
- **Blood stock by GPS only** at first: the blood bank's state codes aren't LGD codes, and no list had been published.
- **NOTTO has no location search**: NOTTO says GPS is "not available yet".

Where the plugin is silent or contradicts itself, the item went into the contract's **Open** section: the registry
lookup's body (the schema requires a nested object, the example is flat), which registry field carries the signing key,
and NACK codes, of which none are published. When the sandbox answers, those items close. Until then nobody, human or
agent, has to wonder whether a value was invented.

In the demo build, the four services return invented results, every one marked "(demo)" with a "[Demo address]" and
an obviously fake phone number. Synthetic data that *looks* synthetic is a rule from Day 0, and it's easy to forget when
the data is a list of hospitals.

## 4. Ready for the sandbox before the sandbox is ready

Our UHI sandbox registration was raised but not yet issued. Two PRs made sure that wouldn't hold anything up.

**QA settings (#181).** The QA deploy now forwards the UHI key as a secret and the ids as variables. The deploy checks
validate the **shape** of each value (the key must be one line of base64 PKCS#8; the ids may not contain a separator
character) and never print a value. The agent tested four cases with dummy values: off, partial (refused), full, and
malformed (refused). The upshot: **turning UHI on in QA is a secrets change, not a code change.**

The same PR corrected the location permission text in all five languages. It used to say the location was "never
stored". A Find care search keeps its *rounded* area, encrypted, for at most a day, so "never stored" had become untrue.
A privacy statement that's slightly wrong is worse than one that's slightly long.

**A stub UHI gateway (#182).** Until the real one was reachable, the functional tests needed something that behaves like
it, strictly:

- It checks the PHR's signature **the way the gateway does**: looks up the key id in a stub registry (subscribed,
  within validity), verifies over the raw bytes, and answers `401` for a bad, expired or unknown signature, or a key that
  doesn't match the consumer id. A bad context gets `400 NACK` with the full error object.
- It answers with **signed** `on_search` calls, a fresh header every time. For blood banks, three providers answer
  separately, so the app's "answers arrive" path is really exercised.
- It has scenarios (`answer`, `empty`, `silent`, `nack`), reset before every test.
- Keys are **generated at run time**. Nothing is committed.

The Find care spec runs on both the API build and the demo build. It walks Home → Find care → each service, and checks
the arriving results, the NHA notices, empty and silent searches, and the gateway's refusal. UHI has no NHA case ids in
our PHR catalogue, so the spec names none, and the NHA gate scripts are unaffected.

A stub is only as good as its strictness. One that accepts any signature tests nothing; this one rejects what NHA's plugin says
the real gateway rejects, using the same signing module, so a signing regression fails CI.

## 5. Book a doctor: the first flow that sends patient details

Everything so far sent nothing about the person. **Book a doctor** (UHI Physical Consultation) can't work that way:
the clinic needs to know who is coming. That made #183 the most carefully specified PR of the day.

**The flow.** The person searches nine ways (the nine doctor searches in NHA's catalogue), picks a slot, reads the
clinic's **five terms**, confirms and gets a **check-in PIN**. The visit then moves through started, completed or
no-show; it can be cancelled with a reason; and the person can message the clinic. A completed visit lands in My
Records as a linked facility and care context, the same shape P2 uses, so the rest of the app needs to know nothing
about UHI.

**What is sent, and from where:**

- Patient details are built **on the server, from the person's own records**: name, birth date, gender, mobile and
  ABHA ids. **Address and email are never sent**, and **nothing comes from the browser**.
- Each send is audited **by field name**.
- The share tick comes *before* the slot is held, because UHI's `init` step already sends the details.
- Confirm stays locked until all five terms have been opened.

The one fix found in review says a lot about how these PRs were checked: the Review screen listed address and email
among the details being sent, but the API sends neither. The screen now lists exactly what is sent. A consent screen
that over-states is still a consent screen that's wrong.

**The PIN** is the check-in secret, so it's treated like one: there's **no PIN column** in the database. It's held in
process memory for at most two minutes, handed over once, and re-requested from the clinic if needed. The agent also
checked it's in no browser storage.

**The callbacks** (`on_init`, `on_confirm`, `on_status`, `on_update`, `on_cancel`, `on_message`) must each be signed by
**the order's own clinic**, with its registry key. Another valid UHI participant can't move your booking.

**Every catalogue search.** The same PR added the rest of the searches NHA's catalogue lists: PM-JAY by hospital name and
by speciality (from NHA's speciality API, allow-listed and cached, with nothing personal sent), and blood stock by state
and district using the blood bank's own region codes. That last option is **data-driven**: it stays hidden until the
region list is imported, and a code not in the list is a `400`.

Late the evening before, the agents closed the gaps from the plugin's go-live checklist that the first version had left open:
honouring each answer's time-to-live with the 48-hour ceiling, going back to the slot list when a clinic says a slot is
no longer held, and showing the PM-JAY nodal officer's contact and whether a hospital is government or private. One
small commit in that batch is a good sign of the guard rails working: the new order SQL was rewritten "in full, no
`${}` in statements", because the SQL rule in our static analysis gate (one of our [security-by-design](https://caladriushealth.ai/platform/brief/#security) rules) rejects interpolated statements outright.

## 6. Ambulance, phase 1: a quote, not a dispatch

The ambulance PR was deliberately small: **search, then ask one provider for a quote**. The UHI plugin defines no
confirm, status or cancel for ambulances, so we built none.

- **"Call 108"** on every ambulance screen. In an emergency the national number is the answer, not an app.
- The person chooses the class and whether oxygen is needed. **Exact location is off by default.**
- The quote shows the breakup, payment terms, any advance and the terms.
- Sent on the person's consent: name, phone, ABHA address, gender and date of birth. **Never** the ABHA number, email or
  home address. Each send audited by field name.
- The table has **no columns** for driver, vehicle or phone: data we don't need, we can't leak.
- No answer in two minutes: the request fails cleanly. A quote expires after 30 minutes.
- The contract's ambulance section has 12 Open items.

## 7. Small things people notice: the KYC chip and Charcoal

Two front-end PRs closed the day.

**KYC status on the ABHA card.** Home showed the profile status ("KYC verified" or "self-declared") as a separate row.
It now sits inside the ABHA card as a chip, in on-card white so it reads in both themes against the ABHA brand gradient,
with "Link ABHA number" directly under the card for a self-declared profile. These are NHA cases (the KYC indicator, the
link prompt and the card itself), so CI picked them out to be re-run on demand.

**Charcoal.** Our dark theme was blueish. I asked for a near-black option, a third choice beside Light and Dark. The
first version used warm neutrals; a second PR later that morning made it darker, on Material Design's dark-theme values:

| Token | Value | Contrast |
|---|---|---|
| Base | `#121212` | |
| Surfaces (elevation overlays) | `#1e1e1e`, `#272727`, `#2e2e2e` | |
| Text, 87% | `#e0e0e0` | 12.6:1 |
| Muted text, 60% | `#a0a0a0` | 6.4:1 |

How it's wired matters more than the colours:

- **PHR only.** The app sets `data-dark-tone="charcoal"` on the page when the theme is dark. The shared theme provider
  in [the Caladrius design system](https://caladriushealth.ai/platform/brief/#design-system) is unchanged, so no
  other app is affected.
- **Only the neutrals change.** Accent and status colours stay the dark theme's, so a warning still looks like a
  warning.
- **Tokens, not hex in components.** The values live in the app's theme file; the "glass" effects derive from the
  surface colour and followed automatically, as did the browser's theme colour.

The same PR deleted the animated canvas backgrounds on Welcome, sign-in and registration. They were pretty, they cost
battery on cheap phones, and nothing else used them.

## 8. What I learned on Day 8

- **The callback is the attack surface.** Outbound signing is the easy half of UHI. The inbound half (verify before
  parse, trust a key only while its registry entry says so, replay checks, fail closed) is where an integration is won
  or lost.
- **Build the details sent on the server.** If the browser can't contribute a field, it can't add one either. Then
  audit by field name, and make the consent screen list exactly what the server sends.
- **Don't store what you don't need.** No PIN column, no driver or vehicle columns, rounded locations, a 48-hour ceiling.
  Each is a line of design that removes a whole class of incident.
- **A strict stub is a test; a lenient stub is a decoration.** Our stub gateway rejects what NHA's plugin says the real one
  rejects, with the same signing code, so CI can tell us when signing breaks.
- **Let the source decide what not to build.** The plugin had no ambulance confirm, no blood-bank codes and no NOTTO
  location search, so we built none of them and wrote down why. Agents fill gaps with plausible guesses unless the rules
  tell them to stop and record.

*Next, Day 9 (6 to 8 November): three days without a single merge, and the plans that came out of them: shared Caladrius
platform packages, on the principle that apps share code, never runtime.*

## The team behind Day 8

The PHR is built by a small Caladrius team working with AI agents:

- **Giri**: CEO; Cally taxonomy and intent framework
- **Krishna**: development, infrastructure and go-live
- **Preetha**: narrative engineer, personas
- **Manish** (me): CTO and CPO, enabling the Caladrius Health AI PHR and the AI Studio framework

### Cally: taxonomy and intent (Giri)

Day 8 had no Cally work, but it added a new family of things a person may ask for: find a hospital, check blood stock,
book a doctor, get an ambulance. For the Cally taxonomy, which is Giri's area, that is groundwork. The day settled the
guardrails any request in this family would have to respect: a search sends nothing personal, a booking sends only the
fields the server builds from the person's own records, and an emergency gets one answer before any other: "Call 108".
It also drew a line between categories. Finding care is discovery; booking is a disclosure the person agrees to on a
screen. A request that sounds like the first but needs the second has to be treated as the second.

### Development, infrastructure and go-live (Krishna)

On the infrastructure side, which Krishna leads, Day 8 was about being ready before the sandbox was. UHI arrived as a
stack of branches, each saying at the top what it sat on, so the merge order was never a puzzle. The QA deploy learned
to forward the UHI settings, checking the shape of each value without ever printing one, so **turning UHI on in QA
became a secrets change, not a code change**. A strict stub gateway, with keys generated at run time and nothing
committed, let the functional tests run on both builds while our sandbox registration was still pending. Eight PRs
went into `dev` and one promotion went to QA.

### Narrative and personas (Preetha)

Preetha's area is the person on the other side of the screen, and Day 8 met several of them: someone looking for a
PM-JAY hospital or a generic medicine, a family checking blood stock, someone booking a visit, someone who needs an
ambulance now. The wording carried much of the weight. NHA's required lines are used word for word. The location
permission text was corrected in all five languages once "never stored" had stopped being true. The Review screen now
lists exactly what is sent, no more. Even the demo's hospitals are written to look invented, marked "(demo)" with a
"[Demo address]". And the smallest change, the Charcoal theme, was the one people noticed.

### Product and technology direction (Manish)

My decisions that day were mostly about what not to do. Search services send nothing personal, and the browser never
talks to UHI, so the content security policy didn't change. Ambulance stayed a quote, not a dispatch, because the
plugin defines nothing more. Where the plugin was silent, the gap went into the contract's Open section instead of a
guess. And I asked for a near-black theme, on one condition I'd repeat for any visual change: it lives in the PHR's
tokens, changes only the neutrals, and leaves the shared design system and every other app untouched.

## Further reading

- [Caladrius Health](https://caladriushealth.ai/), the company behind the PHR
- [The Caladrius platform brief](https://caladriushealth.ai/platform/brief/): AI Studio, [Cally](https://caladriushealth.ai/platform/brief/#cally), the [Health Vault](https://caladriushealth.ai/platform/brief/#vault), the [design system](https://caladriushealth.ai/platform/brief/#design-system) and [security by design](https://caladriushealth.ai/platform/brief/#security)
- [Caladrius Pulse](https://caladriushealth.ai/blog/), our blog, including the ABDM series ([What is ABDM?](https://caladriushealth.ai/what-is-abdm/)) and the NHCX series ([What is NHCX?](https://caladriushealth.ai/what-is-nhcx/))
