Skip to content

Add a medical preset; fix presets declaring path-named fields - #27

Open
adammharris wants to merge 2 commits into
mainfrom
medical-preset
Open

adammharris wants to merge 2 commits into
mainfrom
medical-preset

Conversation

@adammharris

Copy link
Copy Markdown
Member

Medical preset

presets/medical/ is a patient-held health record as a prov workspace:

  • kind is closed, and each term maps to a FHIR resource type (encounter → Encounter, problem → Condition, lab → Observation, and so on).
  • codes[].system is closed (ICD-10-CM, SNOMED CT, LOINC, RxNorm, CVX, CPT). The record carries the codes themselves; the preset doesn't list them.
  • clinician is a ref field.
  • generated.how is closed (written, drafted, transcribed, imported, converted).
  • status has separate vocabularies under Problems and under Medications.
  • Views: Timeline, Active problems, Current medications, By clinician, Awaiting review.
  • Filing: Encounters and Labs are filed by year.
  • Exports: care-team, emergency and family. Each is gated on audience and holds back anything with draft: true. audience defaults to self.

Sign-off order: run prov unset <note> draft before prov confirm <note> --by <clinician>. A confirmation goes stale at the next edit, so unsetting draft after confirming would undo the confirmation.

Fix: presets that declare path-named fields

Workspace::apply_preset wrote each entry through the dotted-path editor. That broke on field names that contain path syntax:

  • An entry named generated.how was written as fields.generated.how, two levels deep instead of one key.
  • codes[].system was refused ("names every item of a list").

Entries are now written as literal keys through a new function, prov_store::edit::set_meta_at_keys. The key is split the same way lookup already splits it: a top-level config key, then the whole entry name. The regression test is a_field_named_by_a_path_is_written_as_one_key.

Verification

  • Gate: ship ci jobs fmt, clippy, test, docs, prov-check and package-isolation all pass. MSRV was skipped on this machine.
  • Smoke test, using a freshly built prov on a new workspace:
    1. prov init --yes
    2. prov presets presets/medical --write
    3. prov new for Encounters, Problems, Medications, Labs, "Care team" and Imports
    4. prov check reports ok: no findings.

…m`) is written as one key

`Workspace::apply_preset` wrote each entry through the dotted-path editor,
so a preset declaring the field `generated.how` landed it as
`fields.generated.how`, nested a level too deep, and one declaring
`codes[].system` was refused ("names every item of a list"). An entry is
now written as literal keys through the new
`prov_store::edit::set_meta_at_keys`, split the way `lookup` already
splits it: a top-level config key, then the entry's name whole.

Behavioural-change: `prov presets --write` and `prov init --preset` write a field declared under a name holding `.` or `[]` as one key under `fields`, where they nested it as a path or refused it.
…eset

A patient-held health record as a prov workspace: a closed `kind` with
each term mapped to a FHIR resource type; a closed `codes[].system`
(ICD-10-CM, SNOMED CT, LOINC, RxNorm, CVX, CPT) with the codes carried
rather than enumerated; `clinician` as a `ref` field; a closed
`generated.how`; `status` vocabularies scoped under Problems and
Medications; views for a timeline, active problems, current medications,
records by clinician and drafts awaiting review; year filing for
Encounters and Labs; and care-team, emergency and family exports, gated
on `audience` and holding on `draft: true`. `audience` defaults to `self`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant