As a practitioner, I can open a teleexpertise case (backend model) #13

Open
opened 2026-04-14 20:42:04 +00:00 by claude-desktop · 0 comments
Collaborator

User story

As a practitioner, I want to open a teleexpertise case backed by a FHIR ServiceRequest and a Matrix room, so that my colleagues and I have a structured workspace for the request.

Acceptance criteria

Case creation

  • POST /api/cases body: { patient, specialty, urgency, question, invitees[], patientInvolvement }.
  • Creates a FHIR ServiceRequest with category=teleexpertise, status=active, intent=order, and Koinos extensions (matrixRoomId, patientInvolvement).
  • Creates a Matrix room (E2EE enabled) and stores its ID on the ServiceRequest.
  • Invites invitees to the room (local invitees only in this issue; cross-instance in #19).
  • Creates a FHIR Encounter linked to the ServiceRequest.
  • Generates the initial Task for each invitee.

Lifecycle

  • PATCH /api/cases/{id} transitions: active → on-hold → active → completed / active → revoked.
  • State transitions guarded by policy (requester + assignees only).
  • Closing a case archives the Matrix room (suspend invites, retain history).

Querying

  • GET /api/cases?status=...&mine=requested|assigned|all with pagination.

Tests

  • Integration test covering the happy path and each transition.
  • Policy tests for unauthorized actors.

Out of scope

  • Case UI (issue #14).
  • Cross-instance invites (issue #19).
  • Signed DiagnosticReport on closure (later).

References

  • spec/04-functional/02-teleexpertise.md §§2–4.
  • spec/03-architecture/04-medical-data.md.
  • spec/08-roadmap-mvp.md — step #13.
## User story **As a practitioner**, I want to open a teleexpertise case backed by a FHIR `ServiceRequest` and a Matrix room, **so that** my colleagues and I have a structured workspace for the request. ## Acceptance criteria ### Case creation - [ ] `POST /api/cases` body: `{ patient, specialty, urgency, question, invitees[], patientInvolvement }`. - [ ] Creates a FHIR `ServiceRequest` with `category=teleexpertise`, `status=active`, `intent=order`, and Koinos extensions (`matrixRoomId`, `patientInvolvement`). - [ ] Creates a Matrix room (E2EE enabled) and stores its ID on the `ServiceRequest`. - [ ] Invites invitees to the room (local invitees only in this issue; cross-instance in #19). - [ ] Creates a FHIR `Encounter` linked to the `ServiceRequest`. - [ ] Generates the initial `Task` for each invitee. ### Lifecycle - [ ] `PATCH /api/cases/{id}` transitions: `active → on-hold → active → completed` / `active → revoked`. - [ ] State transitions guarded by policy (requester + assignees only). - [ ] Closing a case archives the Matrix room (suspend invites, retain history). ### Querying - [ ] `GET /api/cases?status=...&mine=requested|assigned|all` with pagination. ### Tests - [ ] Integration test covering the happy path and each transition. - [ ] Policy tests for unauthorized actors. ## Out of scope - Case UI (issue #14). - Cross-instance invites (issue #19). - Signed `DiagnosticReport` on closure (later). ## References - `spec/04-functional/02-teleexpertise.md` §§2–4. - `spec/03-architecture/04-medical-data.md`. - `spec/08-roadmap-mvp.md` — step #13.
claude-desktop added this to the v0.1 milestone 2026-04-14 20:42:04 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/koinos#13
No description provided.