pha / README.md
wnkh's picture
Opaque episode ids; user_msg / prompt_format / instruction
f61878e verified
|
Raw History Blame Contribute Delete
6.58 kB
---
license: apache-2.0
task_categories:
- other
tags:
- agents
- computer-use
- healthcare
- benchmark
configs:
- config_name: default
data_files:
- split: full
path: full.jsonl
---
# Personal Health Arena
A patient-facing healthcare benchmark for computer-use agents. A synthetic population is generated
with [Synthea](https://github.com/synthetichealth/synthea) and imported into a self-hosted
**OpenEMR 7.0.2**; each task measures whether an agent can complete a real errand on the **patient
portal**, acting for a patient.
**100 episodes over 50 patients, 398 legs.** Two errands per patient, from different
archetypes. No two episodes share an instruction, and 96 of the 100 leg sequences are distinct.
> Task design is complete and measured against a live instance. The grading harness is not built
> yet, and no episode has been executed end to end. Field names may still change.
## What a task is
An **errand** — the reason a person opened their portal — not a single question. Each episode is
3–6 **legs**, a leg being one independently gradeable question or action. **Score is legs correct
over total legs**, so an agent that stalls partway still registers signal.
The agent is told *why* the patient is there and *what to come back with*. It is never told the
route: not which menu, which page, or how many rows it has to get through.
## The errands
| Archetype | Episodes | The errand |
|---|---|---|
| `checking_messages` | 20 | the practice sent something that needs answering |
| `new_pharmacy` | 16 | a new pharmacy wants the current medication list |
| `transferring_practice` | 15 | moving practice; the new one needs the records |
| `appointment_coming_up` | 15 | an appointment no longer works |
| `result_came_back` | 13 | the clinic called about a test result |
| `appointment_needs_a_note` | 13 | something the practice should know before a visit |
| `bill_looks_wrong` | 8 | a bill arrived that looks wrong |
**Every instruction is hand-written for that patient**, and **every route differs**. An archetype
names the action the errand must end in and a pool of questions to draw from; each patient gets a
seeded subset in a seeded order, 3 to 6 legs. Two patients with the same errand still navigate
differently, and some archetypes offer more than one ending -- `appointment_coming_up` resolves
either by cancelling and rebooking or by moving the existing slot.
Assignment is chart-driven: a patient is offered an errand only where every leg in it resolves
against their own record.
## Where the difficulty comes from
From the record and the interface, never from the question. Some of it:
- The lab page renders **29–4,105 rows per patient** and prints dates as `08/17 00:00:00/2017` —
`get_lab_results.php` splits a datetime on `-` and reassembles it.
- The **Range column is empty for all 22,645 lab rows**, so the only honest answer about a normal
range is that the portal gives none. Reciting a textbook range scores 0.
- Medications and Prescriptions are two pages with **identical headers** one `WHERE` clause apart:
449 lifetime rows against 148 current. Nothing on either page explains the difference, and
**10 of 50 patients have no active prescription at all**.
- The billing ledger renders **nothing until a date range is submitted**, and filters on
`ct_proc='1' AND activity>0` — predicates you would not guess from the schema.
- The Problems page runs to **195 rows**, and a *blank* End Date is what marks a condition active.
- **25 of 50 patients have no allergies.** The correct answer is that there are none; an invented
allergen scores 0.
- Write legs must reach the right person: the recipient is the provider named on the *Appointments*
screen, to be found among 161 in the messaging dropdown.
## Columns
One row per episode, carrying both the task and its gold answer.
| Column | |
|---|---|
| `episode_id`, `archetype`, `legs`, `patient_pid`, `patient_name`, `portal_username` | identity and route |
| `user_msg` | what the patient said, and nothing else — hand-written, unique per episode |
| `prompt_format` | the scaffolding around it, with a single `{user_msg}` hole |
| `instruction` | the two joined; the only thing the agent is given |
| `answer_fields` | the keys the agent must return |
| **`expected_json`** | **gold answers** |
| **`write_check_json`** | **the database delta a write leg must produce** |
| **`leg_scores`** | **which keys each leg owns** |
```python
from datasets import load_dataset
ds = load_dataset("wnkh/pha", split="full")
GOLD = ("expected_json", "write_check_json", "leg_scores")
prompt_rows = ds.remove_columns(GOLD) # never hand an agent the last three
```
`instruction == prompt_format.format(user_msg=user_msg)` holds for every row and is asserted at
build time. The split exists so the framing and the answer contract can be changed without
touching a hundred hand-written narratives, and so the patient's own words can be extracted alone.
**The last three columns are answers.** Tasks and solutions were previously separate configs, so a
harness could load the task config and be structurally unable to see them. In one file that
guarantee is gone and the harness must drop them itself.
`expected_json` is JSON-encoded because expected values are floats for some legs, strings for
others and lists for others again, and one parquet column cannot hold all three. `leg_scores` maps
each leg to the keys it owns, which is what makes per-leg partial credit computable.
## Grading
- Answers come from the required JSON object; only the named keys are graded. JSON rather than
YAML because YAML coerced 74 of 100 gold answers to the wrong type -- dates to date objects,
`""` to null, list items containing `": "` to nested objects -- and failed outright on six
legitimate RxNorm drug names beginning with `{`.
- Numbers compare numerically with tolerance — the portal prints full float precision.
- Dates are normalised before comparison.
- Sets score F1, never recall: recall-only scoring rewards hallucination.
- An empty result is an answer, never a skip.
- Writes grade on the database delta, never on the agent's claim to have acted, and every episode
restores afterwards so episode ordering cannot matter.
## Environment
The dataset is inert without the environment: a local OpenEMR instance with its clock pinned to
`2026-08-25 18:00`. The population, import pipeline and task design live in the project repository.
All patient data is synthetic — generated by Synthea, containing no real person's information.