---
title: 'Day 7: A Demo for People, a Signature for Machines'
series: Building the Caladrius PHR with agents
part: 7
series_total: 15
date: '2026-11-24'
reading_time: 16 min
description: A public demo anyone can open without an account, with invented people
  and a guided tour in five languages, and UHI request signing built the way NHA's
  gateway checks it, with the proof ready to run against the sandbox.
canonical_url: https://caladriushealth.ai/solutions/phr-build-diary/day-7-a-demo-for-people-a-signature-for-machines/
publisher: Caladrius Health AI Studio
---

# Day 7: A Demo for People, a Signature for Machines

A public demo anyone can open without an account, with invented people and a guided tour in five languages, and UHI request signing built the way NHA's gateway checks it, with the proof ready to run against the sandbox.

*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.*

4 November pulled in two directions at once, and both turned out to matter.

One direction was outward, towards people. We put up a **public demo** that anyone could open without an account,
with a guided tour in five languages, and we showed what **Personalised Intelligence** could look like on top of a PHR:
biomarker trends, a mental-health check, preventive cardiology and a Lung Health module.

The other direction was outward too, but towards machines. The PHR started joining **UHI**, the Unified Health
Interface, as a patient-side app. Before a single search can go out on UHI, the app has to sign its requests exactly
the way NHA's gateway checks them. Day 7 is the day we got that signature right, and built the proof that will show it.

In between, the locker work from Day 6 came back with a lesson I hadn't expected. Seventeen PRs merged: ten into `dev`,
seven promotions to QA, and 74 commits, many of them on UHI branches that would merge the next day.

---

## 1. Fixing the fix: when "the same identifier" means different documents

On Day 6 we stopped a health locker from storing the same record twelve times. Part of the fix was to recognise a
document by the facility, the visit and the document's own identifier (the FHIR Composition identifier), and to erase
later copies.

Overnight, a QA check found that the clean-up had **erased 18 distinct records** across four visits, leaving each of
those visits with only its invoice. The cause was outside our code. Our counterpart hospital system, our own [AI Studio](https://caladriushealth.ai/platform/brief/#platform) acting as the hospital, serves documents
that were *uploaded* to it with their originator's Composition identifier, and in the test data 22 different documents
in those visits shared one value: a sample id from a published example. A diagnostic report, an immunisation record, a
prescription and a wellness record looked like "the same document" to our key, and the clean-up kept only the earliest.

The fix took the identifier out of identity altogether:

- **Identity is the content only.** The key is an HMAC, per account, over the facility, the care context and the
  normalised body, with per-build ids dropped. Two different documents always differ in content, so they can never be
  merged. A re-pull of the same document, where only the per-build ids changed, still matches and is skipped.
- **Nothing held is replaced by a push.** The "newer version replaces the old one" step depended on the identifier, so
  it was removed. A changed document is now stored *beside* the old one.
- **The keys of live records are cleared** by a migration, and the background job re-keys them by content and erases
  only exact copies.
- The 18 records weren't lost to the person: they were still at the hospital, and the next pull fetched them again.

The PR states the trade-off plainly, and I agree with it: **storing a near-duplicate is a nuisance; erasing a record by
mistake is a harm.** When in doubt, keep both.

An earlier follow-up, just after midnight, handled the links. Before the clean-up, the locker (which also acts as a facility for the person's
uploads) had linked hundreds of care contexts to the consent manager that now pointed at erased copies, and [ABDM](https://caladriushealth.ai/what-is-abdm/)
publishes no "unlink". A requester asking for one of those got nothing at all. Each erased copy now records which live
record **superseded** it, and serving resolves through that pointer, with every consent rule (live, unexpired, artefact
granted, the right HI type and date range) applied to the record it resolves to. A record erased because its consent was
revoked or expired is still never served.

## 2. Consent: reuse only what names what you need

The locker keeps the consent artefacts it has been granted and reuses them, so it doesn't ask the person again for every
new record. A QA trace showed the flaw: a hospital linked a new visit, the locker got the notification, and it fetched
under the newest artefact it held, which had been granted *before* that visit existed. The artefact named 51 care
contexts, but not the new one, so the hospital sent nothing for it and the prescription never arrived.

The rule now: **reuse a held artefact only when it names every care context concerned**. For a subscription event,
that's the care contexts the event names; for a pull, the care contexts linked after the artefact was fetched.
Otherwise the locker asks for consent afresh. With auto-approval on, that's granted at once; with it off, it waits for
the person. The care contexts are read from the encrypted artefact in memory; nothing new is stored in clear.

Two smaller ABDM fixes went in that evening, and both show the debugging style that works with agents:

- **The `refUri` ABDM accepts on edit.** The PHR's own "keep my records up to date" subscription request was refused for an invalid
  `purpose.refUri`. Approve and edit had hit the same refusal days earlier and been fixed with the plugin's worked
  example value; the init now sends the same. This mattered for certification: the sandbox accepts subscription requests
  only from the PHR's own service, so this request is how the P3 subscription cases get demonstrated.
- **Switching ABHA address.** The specification publishes no example of the switch-profile answer, and the sandbox's
  answer didn't match what we'd assumed. The first fix read the token from any of three plausible places, and, more
  importantly, made an unreadable answer **log its field names, one level deep, never the values**. One QA attempt later
  that log line said: HTTP 200, empty body. The session was an address sign-in, for which ABDM has nothing to list. An
  empty answer now reads as an empty list, and the screen says "There is no other ABHA address to switch to".

That second pattern is worth stealing: when you don't know the shape of an answer, **log its shape, not its content**.
You get the diagnosis in one round trip and never put personal data in a log.

## 3. Personalised Intelligence, as a demo

The PHR's job under ABDM is to hold and share records. The reason people will open it every week is what it does with
them. Day 7 put a first version of that in front of people, in the **demo build only**, on synthetic data:

| Feature | What it shows |
|---|---|
| Biomarkers | 138 markers in 14 groups: lab values plus vitals, including a calculated BMI and smoking status |
| Prescription Tracker | Medicines over time |
| Mental Health Check | GAD-7 and PHQ-9 |
| Preventive Cardiology | A first-visit assessment |
| Patient Journal | The person's own notes |
| **Lung Health** | A capability unlocked per person and ABHA address by a code: lung profile, inhalers with dose counters, breathing exercises, technique check, symptom diary, flare-ups, an action plan, an assessment, and an air-quality badge |

A few design decisions carried more weight than the screens:

- **Capabilities are per person and per ABHA address.** One family member may have Lung Health; another may not. A
  capability changes which documents and views a person sees.
- **Every feature has its own consent**, withdrawn when the feature is switched off.
- **Care plan and reminders are common screens.** A feature shows its own slice with a context parameter, rather than
  each feature building its own.

**App permissions** became the last onboarding step, once per device and all optional, with a Settings list behind a
small registry. The location permission needed a matching `Permissions-Policy` change in nginx, in the same PR.

**The air-quality badge** is the one part of Lung Health that touches the real API, and it's a good example of how a
small feature becomes S1 the moment it involves location:

- `GET /api/v1/air-quality` behind its own RBAC feature, patient read only.
- Coordinates are **rounded to 0.1° before anything else** happens. Only that grid cell reaches the provider, the cache
  and the response.
- The location is never logged or audited. The response is `no-store`. A provider failure is a generic 502.
- The browser only ever calls `/api`, so the content security policy didn't change ([security by design](https://caladriushealth.ai/platform/brief/#security)).

The PR listed what was *not* ready, and I want that habit everywhere: the free air-quality source isn't licensed for
commercial use, so production needs a licence or an Indian public source; the privacy notice needs an entry for the
outbound call; the clinical wording is sample text; four of the five languages are machine-drafted; and the consent
wording is a draft for legal review. A demo can go up with those open. A release can't.

## 4. Type, text size and a name to be called by

A batch of front-end work merged just after midnight and is easy to underrate.

**Text that fits.** The standard text size now follows the screen width, `clamp(1rem, 5.35vw, 1.4375rem)`: about 19
px at 360 px wide, 23 px at 430, never below the browser's base. It's in `rem`, so the person's own browser text-size
setting still counts. The size steps were rebased to 80/90/100/110%, and saved preferences migrate to the nearest step
that doesn't shrink text. The top bar fits on one line: the title and description pick their own size within floors,
and on a phone some actions become icons.

**A second font family**, with serif headings, self-hosted (so no CSP change), falling back to Noto Sans per glyph for
the Indian scripts.

**A nickname.** Home now greets the person by the name they choose. It sounds trivial; it's an S1 change, because it's
personal data:

- Stored as a FHIR `Patient.name` with `use = nickname`, encrypted, one per patient.
- Validated and **rejected, never repaired**: letters in any script, spaces, apostrophe, full stop and hyphen, at most
  **10 visible characters**, counted as graphemes so Hindi or Tamil names aren't cut mid-letter. The limit came from
  measuring the real Home title across screen widths, text sizes and both font families.
- Audited as set or cleared, **without the value**. Never sent to ABDM, never in an outgoing FHIR bundle.

Building it found a latent bug: a profile sync from ABDM deleted every stored name for the patient. It now spares the
nickname, and the legal-name read ignores it.

## 5. A public demo, built so it can't leak into the app

The demo build had existed since Day 0 for internal walkthroughs. Day 7 made it public, on our QA site, with
production unchanged. The design goal was that the demo can never contaminate the real app, and the real app can never
leak into the demo:

- **A separate build, not a mode.** One build flag produces the demo: mock backend, its own base path, no service
  worker, `sessionStorage` only, and **zero requests** to `/api` or any external origin. The app's own bundle stays free
  of it.
- **A bundle guard.** The script that already checked the API build for demo code now also **fails the app build if
  the demo's invented people appear in it**.
- The app's service worker is told to ignore `/demo/`.
- **Two invented personas** and no login. "Nothing you do here is saved or sent anywhere", in five languages.
- **Clear doors.** "Try the demo" on the app's Welcome page (only where a demo URL is configured), and "Back to the real
  app" / "Leave the demo" inside it.

Late that night, one more owner decision went into `AGENTS.md`: the demo is labelled on its Welcome page and in its
footer, **not with a tab over every screen**. Writing that sentence into the rules file meant no agent would "helpfully"
add the tab back a week later.

**The guided tour** has 12 plain-language steps (Home, Records, Link, Consents, Auto-approval, Lockers, Scan and share,
Pay, [Cally](https://caladriushealth.ai/platform/brief/#cally), Profile, Settings, finish) in English, Hindi, Tamil, Telugu and Marathi. One detail I liked: the type
checker requires **exactly 12 steps per language**, so a translation can't silently fall behind. The tour card has its
own colours and a "Guided tour" label, so it reads as separate from the app. It explains and navigates; it never changes
data.

## 6. UHI: signing a request the way the gateway checks it

UHI is the network that lets a patient-side app (an **EUA**, end-user application) discover and book services from
providers: hospitals empanelled under PM-JAY, blood banks, transplant centres, Jan Aushadhi outlets, doctors,
ambulances. It works by signed messages through a gateway. If your signature is wrong, nothing else matters, so step
U-1 of the new UHI section of our integration plan was the signature alone.

That evening I wrote a new owner rule into `AGENTS.md`: **every UHI API detail comes from NHA's UHI plugin**
(`uhi-integrators-assistant`: its service skills, commands and the documentation server), never from memory or
general knowledge of the protocol UHI is built on. Every constant, rule and required string is cited next to the code,
in `{ value, source }` modules. Where the plugin is silent or contradicts itself, it goes into the contract's **Open**
section instead of being guessed.

What landed in `packages/abdm`:

- **The signature**: Ed25519 over a BLAKE2b-512 digest, built exactly as NHA's gateway builds it.
  - The signing string is space-joined: `(created) (expires) digest`.
  - The signature covers the base64 text of the BLAKE2b-512 hash of that string.
  - The header is JSON, and `expires` is `created` plus 10 seconds.
- **The verifier**, for calls we receive: it **fails closed** on any signature or header it can't verify, and never throws.
- **The client** serialises the body **once**, signs those bytes, and sends the same bytes. Re-serialising after
  signing is the classic way to break a signature with a reordered key or a different space. Logs carry metadata only.
- **The context block** and a first PM-JAY hospital search, validated against the gateway search operation's schema
  (now exported and tested like every ABDM call). The search carries no patient data: a location and a radius.
- **Two scripts.** `uhi:keygen` writes the private key to a path outside the repo with mode 0600, never overwrites an
  existing file and never prints the key. `uhi:prove-signing` sends three requests to the sandbox: a valid one must get
  `200 ACK`, and a tampered body and an expired header must each get `401`.

That third request is my favourite kind of test: **a proof isn't a proof unless it also shows the wrong thing failing.**
A signature check that accepts everything would pass a test that only sends good requests.

Building it surfaced three disagreements in NHA's own material, and the agent recorded each as a question for NHA rather
than picking silently:

| Disagreement | What we do until NHA answers |
|---|---|
| NHA's Node sample signs differently from its gateway (newline-joined, a different header form) | Follow the gateway; the sandbox proof will settle it |
| The schema requires message times with a zone; the prose example has none | Follow the schema, send `+05:30` |
| The schema types two participant ids as URIs but describes them as domain names | The local schema test relaxes the URI format for those two fields only |

The test keys are the public vector from RFC 8032, so no real key ever entered the repository, and the secret scan on
the commit came back clean. The `src/uhi` code finished at 100% line coverage.

## 7. The evening: Find care on branches

By 8 pm the signing work was committed (the PR merged just before midnight), and the agents moved straight on to the first UHI screens: the database tables, the
search routes, the signed callback that receives answers, and four search screens. Those commits sit on 4 November in
the log, stacked branch on branch, but they merged on the 5th, so they belong to the next post.

| | Day 7 |
|---|---|
| PRs merged into `dev` | 10 |
| Promotions to QA | 7 |
| Commits (including UHI branches) | 74 |
| Migrations | record supersession, air-quality feature, content-only identity re-key |
| New owner rules in `AGENTS.md` | UHI only from NHA's UHI plugin, cited (the UHI rule merged just after midnight); demo labelled, no tab over every screen |

## 8. What I learned on Day 7

- **Never let an identifier you don't control decide what you erase.** Identifiers in health documents are set by the
  sender, and senders make mistakes or reuse sample values. Content is the only identity you can trust, and erasure
  should need certainty, not likelihood.
- **Log the shape, not the content.** Field names, one level deep, diagnosed an undocumented ABDM answer in one QA
  round without a single value in a log.
- **A public demo is a security boundary.** It needs its own build, a guard that fails the real build if demo data
  appears, and no path to the API. "A flag in the same bundle" is not enough.
- **Prove the negative.** The signing proof sends a tampered request and an expired one and expects both to be refused.
  The test that shows the wrong thing failing is the one that earns trust.
- **Write disagreements down instead of resolving them by guess.** Three contradictions in the source material went into
  a list of questions, each with what we do meanwhile. An agent will happily pick one and move on; the rule file is what
  tells it to stop and record.

*Next, Day 8 (5 November): Find care goes live in the app: PM-JAY hospitals, blood stock, transplant centres and
generic medicines, then booking a doctor and asking for an ambulance, and a new near-black theme called Charcoal.*

## The team behind Day 7

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 7 widened what Cally will be asked about. The Personalised Intelligence demo added biomarkers, a prescription
tracker, a mental-health check, preventive cardiology, a journal and Lung Health, and the guided tour has a step for
Cally. For Giri's area, the design decisions matter more than the screens: capabilities are per person and per ABHA
address, and every feature has its own consent, withdrawn when the feature is switched off.

So the same question can be in scope for one family member and out of scope for another, and a topic leaves the scope
when its consent does. The pull request also said the clinical wording is sample text, which the taxonomy has to treat
as not yet ready for a real answer.

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

Day 7 was ten pull requests into `dev`, seven promotions to QA and 74 commits, many on stacked UHI branches that merged
the next day. The public demo went up as a separate build on our QA site, with production unchanged: no
service worker, no requests to the API, and a bundle guard that fails the real build if the demo's invented people
appear in it.

UHI signing landed in `packages/abdm`, with a key script that never prints or overwrites a key, and a proof script that
expects a good request accepted and a tampered or expired one refused. On go-live, the air-quality pull request listed
what a release would still need: a licence, a privacy-notice entry and legal review.

### Narrative and personas (Preetha)

Day 7 was the most narrative day so far. The public demo has two invented personas and no login, says "Nothing you do
here is saved or sent anywhere" in five languages, and offers a guided tour of 12 plain-language steps, with the type
checker making sure no translation falls behind. The demo is labelled on its Welcome page and footer, not with a tab
over every screen.

Home now greets the person by a nickname they choose, up to 10 visible characters counted so Hindi or Tamil names
aren't cut mid-letter. Text now follows the screen width, and serif headings arrived. One honest gap: four of the five
languages in the Personalised Intelligence demo are machine-drafted, and need a person's review.

### Product and technology direction (Manish)

The decision of the day was document identity. I agreed with the trade-off the pull request stated: storing a
near-duplicate is a nuisance, erasing a record by mistake is a harm, so identity is the content only. I also set the
consent rule that the locker reuses a held artefact only when it names every care context concerned.

Two owner rules went into `AGENTS.md`: every UHI detail comes from NHA's UHI plugin, cited (the UHI rule merged just after midnight), and the demo is labelled
without a tab over every screen. Writing them into the rules file is how I make sure the next agent follows them,
not just this one.

## 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/))
