Skip to content

feat(viewer): show and manage care relationships per subject and per carer (#6646) - #6687

Open
rubentalstra wants to merge 35 commits into
mainfrom
feat/viewer-care-relationships
Open

rubentalstra wants to merge 35 commits into
mainfrom
feat/viewer-care-relationships

Conversation

@rubentalstra

Copy link
Copy Markdown
Member

Closes #6646

This branch builds on #6683 (#6644, roles and grants), which builds on #6669 (#6642). It carries their commits until they merge. Review only the commits after #6683.

The viewer reads and writes care relationships through the CDR's care relationship resources under {ext}. The CDR decides each read per subject, so the viewer adds no rule of its own: a relationship the caller may not read is left out, and a 403 is drawn as the CDR's refusal. No openEHR specification governs these resources: this is FerroEHR's own design over its draft access control package.

  • An EHR's Care tab (/ehrs/{id}/care, GET care_relationship?subject_id=&subject_namespace=) lists the relationships of the subject that EHR_STATUS names. Each row shows:

    • the carer, linked to its party;
    • the care role as a coding (rubric, code, terminology);
    • the period;
    • the path: direct for a PERSON or ROLE target, team for a GROUP or ORGANISATION.

    The tab shows live relationships by default. Ended ones too (all=true) and Live on (at=) are a GET form. A subject with no external reference gets a sentence saying so. The tab links to the subject's PERSON page to manage relationships, because the person id is known only once a relationship names it.

  • A party's Care page (/parties/{kind}/{id}/care, linked from the party Overview):

    • For a PERSON, the same list (GET demographic/person/{id}/care_relationship) and the form that adds one: carer kind and id, care role, provider identifier issuer and id, From and To.
    • For every party, the subjects in its care (GET care_relationship?carer=), paged through the session cookie (crate::paging, a new care-of-carer listing). The list can show patient data, so the page position stays out of the URL.
  • A relationship's page (/care/{uid}) shows its facts and its versions with who committed each and when (versioned_care_relationship/{uid}/revision_history). An older version opens read-only by its version uid. Three writes are available, each naming the version read in If-Match, with a refusal drawn in the CDR's words:

    • Save the change: role and period;
    • End today: the period closes today, behind a confirmation;
    • Delete: behind a danger confirmation.
  • Care role choices: the HL7_ParticipationType codes, the terminology the CDR reads when the policy binds no care_role value set. A role of another terminology is posted as terminology|code, and the CDR checks it against the value set the policy binds. The viewer takes the terminology id from openehr_rm::draft::access_control::terminology::TERMINOLOGY_ID_PARTICIPATION_TYPE, so it now depends on openehr-rm with the draft feature.

The recorder seeds three more things:

  • a PERSON for the EHR's subject, declaring its record subject through openehr_access::record_subject;
  • the provider ORGANISATION, carrying the identifier urn:oid:2.999.7.9|dev that the dev configuration's party binding names;
  • three care relationships: one live with two versions, one ended, and one that the in-process tests end.

Tests

  • ssr_app::care runs over the re-recorded CDR. It covers the EHR tab (live, and ended on request), a person's and a carer's Care page, a relationship's versions, an add (recorded live) and an end.
  • e2e_care (a browser journey) seeds a patient, a carer and a provider over REST. It then adds a relationship through the form, ends it behind its confirmation, finds its first version, and finds the patient in the carer's list.
  • Docs shots: /ehrs/{id}/care and /parties/person/{id}/care. Unit tests cover the document a new relationship writes, a change that keeps every other attribute, the path, the span query and the posted role.

Docs

  • The book's viewer/access-control.md has a Care relationships section, and the viewer index mentions the tab.
  • Changelog fragment 6646-viewer-care-relationships.added.md.

A new Access policy page in the console group draws the controller's
ACCESS_POLICY in force by section, each coded value with its rubric and
code; its Versions tab lists every version and opens any one read-only;
an administrator edits the whole policy in the code editor, saved with
If-Match naming the version read (If-None-Match: * for the first). While
none is committed the page says nothing is tightened; a 403 and an admin
API that is off are drawn as such.

The recorder of the replayed CDR provisions its user with the four
arguments scim-provision.sh takes, takes its container name from the
environment, and seeds two versions of the policy under a
write_access_policy grant its own test ceiling admits; the e2e lane seeds
the same for its journey.
…ave words

The access policy editor, Edit as a new version and the party editors
share Unsaved, editor_line, save_as_words and reload_words in
pages::common, and Access policy words an attribute as Configuration
does; the book page names its audience.
…hic class (#6644)

The allow line for the AQL the viewer sends the CDR matches each FROM
root AQL defines, EHR and the demographic classes, so the roles and grants
queries pass and any other string that starts with SELECT is still read.
…carer (#6646)

An EHR's Care tab lists its subject's care relationships, live ones by
default and ended ones on request; a party's Care page shows the same for
a PERSON with the form that adds one, and the subjects in a carer's care,
paged in the session; a relationship's page shows its versions and
changes its role or period, ends it today or deletes it, each with
If-Match. The recorder seeds the subject's PERSON with three care
relationships and the provider ORGANISATION the dev binding names.
…ver a version

pages::editor::document_form docks the decision bar and draws the refusal,
the code editor and its findings; the access policy editor takes it, and
Access policy reads an instant through one pages::policy::instant.
…he care journey an end date

The EHR now draws six tabs, so FerroUI shows a select in place of the row
on a phone; the journey's care relationship needs an end, since the e2e
access policy holds no relationship_validity default for an open one.
# Conflicts:
#	app/ferroehr-viewer/locales/policy/en/policy.ftl
#	app/ferroehr-viewer/locales/shell/en/shell.ftl
#	app/ferroehr-viewer/src/locale/policy.rs
#	app/ferroehr-viewer/src/pages/policy/mod.rs
#	app/ferroehr-viewer/src/routes.rs
#	app/ferroehr-viewer/src/shell.rs
#	app/ferroehr-viewer/tests/fixtures/cdr/manifest.json
#	app/ferroehr-viewer/tests/fixtures/cdr/recording.json
#	app/ferroehr-viewer/tests/it/e2e_docs_shots.rs
#	app/ferroehr-viewer/tests/it/ssr_app.rs
#	scripts/viewer-record.sh
#	website/book/src/viewer/access-control.md
#	website/book/src/viewer/index.md
…tionships

# Conflicts:
#	app/ferroehr-viewer/src/bff/mod.rs
# Conflicts:
#	app/ferroehr-viewer/src/locale.rs
#	scripts/checks/stray-literals.allow

This branch has not been deployed

No deployments
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.

The viewer shows and manages care relationships per subject and per carer

1 participant