System Design Atlas

Hospital medication orders

10 / 10Worked example

Final design

Which tests prove contention protection and qualification for medication order in the overall architecture?

The final design retains the complete topology from step 6. Within the system boundary: Interface → Medication Documentation API → Prescription revisions, verification records, dispensing events and documentation; reconciliation processing reads durably stored work from this datastore. Outside: Clinical master system. The processing receives or transmits the domain messages described in the main path; the result reaches the interface via the medication documentation API. The evidence plan complements medication order M-26 with concurrency, retries, exact boundaries and terminal completion. The table specifies expected results for tests still to be run.

Starting point Technical operations have no clinical approval role.

Assumptions for the example case

Own fictitious example design. A fictional documentation workflow for a single medication order whose clinical decisions have already been made, without recommendations on substances, doses or treatment. Technical feedback is marked for clarification from age 60 seconds onwards; this threshold does not provide medical clearance. All figures and test goals are illustrative assumptions.

Overall architecture with checks and review loops

Runtime topology · processes, data stores and external systems

  1. 1 · Clinical master system → Reconciliation processing
  2. 2 · Reconciliation processing → Relational documentation store
  3. 3 · Specialist interfaces → Medication documentation API
  4. 4 · Medication documentation API → Relational documentation store
  5. 5 · Relational documentation store → reconciliation processing
Clinical master systemEntrance or reading path

Medication documentation

Medication documentation APIDomain validation and commit
Relational documentation storeAuthoritative relational data store
Reconciliation processingProcess durably stored work
Professional interfacesUse of results
Clinical master system → Reconciliation processingAssigned prescription revision
Reconciliation processing → Relational documentation storeSave revision locally
Professional interfaces → Medication documentation APIRole-related action
Medication documentation API → Relational documentation storeOrder, verification evidence and dispensing record
Relational documentation store → Reconciliation processingStored response
Reconciliation processing → Clinical master systemFeedback after local commit
Concurrency and replay4 · 5 · 7
Exact limitTechnically clarify feedback from 60 s · 2
CompletionRole evidence · 9

The map shows documentation flows and separate specialist roles; it leads neither to dosing devices nor to therapy calculation.

The clinical master system sends assigned prescription revisions to reconciliation processing. The medication documentation API checks roles and maintains orders, verification evidence and dispensing records in a relational datastore. Prescribers, verifiers, dispensers and documenting professionals have separate interface actions. Feedback goes to the master system after local storage. The diagram shows documentation flows and provides no control path to dosing devices or treatment calculations. The same building blocks and arrows as in step 6. Test marker: API/Commit → Contention and Replay (4/5/7); Boundary Check → Exact Boundary (2); Specialist Role/Close → Terminal Evidence (9).

Test plan for the complete design

ComponentTest and expected resultReturn to an earlier step
Medication documentation APIChange and dispensing both expect version 7. If the change wins, dispensing loses the old approval. If dispensing wins, the change is rejected and, after a fresh read, handled as an investigation case; dispensing that already occurred remains recorded.Steps 3 and 5
Command journalIdentical retries take effect once; changed content produces a conflict.Steps 4 and 7
Domain boundary checkCheck values 59, 60 and 61 seconds. Oracle: Technical feedback is marked for clarification from age 60 seconds onwards; this threshold does not give medical clearance.Step 2
Prescription revisions, verification evidence, dispensing events and documentationIn dokumentiert and storniert, new dispensing creates a conflict. Cancellation does not retroactively undo an action already documented.Steps 5 and 9
Reconciliation processingDispensing is recorded with verification evidence in a local transaction. The response is lost after commit. A retry returns the same dispensing record. A prescription change received in the meantime requires domain review after dispensing and must preserve that record.Steps 6 and 7

Medication documentation API

Test and expected result
Change and dispensing both expect version 7. If the change wins, dispensing loses the old approval. If dispensing wins, the change is rejected and, after a fresh read, handled as an investigation case; dispensing that already occurred remains recorded.
Return to an earlier step
Steps 3 and 5

Command journal

Test and expected result
Identical retries take effect once; changed content produces a conflict.
Return to an earlier step
Steps 4 and 7

Domain boundary check

Test and expected result
Check values 59, 60 and 61 seconds. Oracle: Technical feedback is marked for clarification from age 60 seconds onwards; this threshold does not give medical clearance.
Return to an earlier step
Step 2

Prescription revisions, verification evidence, dispensing events and documentation

Test and expected result
In dokumentiert and storniert, new dispensing creates a conflict. Cancellation does not retroactively undo an action already documented.
Return to an earlier step
Steps 5 and 9

Reconciliation processing

Test and expected result
Dispensing is recorded with verification evidence in a local transaction. The response is lost after commit. A retry returns the same dispensing record. A prescription change received in the meantime requires domain review after dispensing and must preserve that record.
Return to an earlier step
Steps 6 and 7

First end-to-end test and outstanding evidence

End-to-end path
A prescription change competing with dispensing is the first end-to-end test. Dispensing is recorded with verification evidence in a local transaction. The response is lost after commit. A retry returns the same dispensing record. A prescription change received in the meantime requires domain review after dispensing and must preserve that record.
Clarify before extending the scope
Before real use, agree the clinical master-system contract, retention, recovery targets and roles. All the limit values here are design assumptions. The proof table describes tests to be carried out; technical integration, browser testing and comprehension testing with readers follow separately.

Test a prescription change against dispensing end to end

Test a prescription change against dispensing end to end

Test a prescription change against dispensing end to end.

A prescription is changed after verification. A screen opened earlier still attempts to confirm dispensing against the old revision. Completion requires technical and domain evidence.

Change and dispensing both expect version 7. If the change wins, dispensing loses the old approval. If dispensing wins, the change is rejected and, after a fresh read, handled as an investigation case; dispensing that already occurred remains recorded. The exercise specifies the input and expected result.

Alternative considered
An initial end-to-end path limited to lists and forms postpones the critical state checks.
Trade-off
The first end-to-end path needs controlled concurrency and failure points.
Reassess
Passing the counterexample tests and checks with readers provides grounds for extending the case.

Try it yourself

Choose two architectural decisions: concurrency protection and evidence-backed completion. For each, name the test, expected result and step to revisit.

A hint for your attempt

Link the markers of the overall architecture with the associated design steps.

Compare with a possible solution
Concurrency control
Change and dispensing both expect version 7. If the change wins, dispensing loses the old approval. If dispensing wins, the change is rejected and, after a fresh read, handled as an investigation case; dispensing that already occurred remains recorded. The invariant is expected: the dispensing and documentation reference exactly the released prescription revision; a new revision invalidates the old local dispensing approval. Deviation leads back to step 5 and to the command contract in step 4.
Test completion and retries
Initial state: dispensing against the exact approved prescription revision has occurred and the actual action is documented. Retry the same dispensing command; then attempt new dispensing with a new key and cancellation of the documented action. Expected result: replay returns the original dispensing record, new dispensing receives a conflict, and the actual action remains in the history. Any domain correction requires a separate investigation record. Deviations lead back to step 9 for ownership and step 7 for the failure sequence.

Apply to your project

Which two counterexample tests will you run first in your own end-to-end implementation?

Transfer the architecture and counterexamples to the editable Markdown design template.

Start your own design

Choose a small case from your project. The template collects the ten design tasks and leaves space for your sketches, decisions, and open assumptions. You can edit it in your text editor or note-taking app.

Download design template (.md)
Compare the ten tasks with the example case
  1. Purpose and boundary

    What proof of medication order would arise in your own project outside of the application?

    In the example: Documentation follows a clinically authorised prescription. A fictional documentation workflow for a single medication order whose clinical decisions have already been made, without recommendations on substances, doses or treatment.

  2. Requirements

    Which rule of your project remains binding even with slow processing?

    In the example: Verification evidence binds the exact prescription content. A technical response is flagged for investigation from age 60 seconds; this threshold grants no clinical approval.

  3. Scale estimates

    Which single item concentrates the load more strongly than the daily mean at medication steps?

    In the example: Test concurrency on an individual order. An average of 0.166667 events/s says little about two clinicians working on the same order revision.

  4. Interfaces

    Which input fields make two change intentions different in your project?

    In the example: Dispensing requires the revision and verification evidence. The order, current prescription revision, verification evidence and dispensing event must remain identical on replay.

  5. Data and states

    Which states must remain protected in your model against late replay?

    In the example: The actual action retains its own evidence. In dokumentiert and storniert, new dispensing creates a conflict. Cancellation does not retroactively undo an action already documented.

  6. Overall architecture

    Which planned service boundary would distribute a currently local guarantee across the network?

    In the example: Reconciliation runs outside the local verification transaction. Prescription revisions, verification evidence, dispensing events and documentation must express the same valid state.

  7. Critical flow

    What feedback could be missing even though the underlying action has already taken place?

    In the example: After response loss, retry only the same dispensing record. Dispensing and documentation reference the exact approved prescription revision; a new revision invalidates the old local dispensing approval.

  8. Bottlenecks and trade-offs

    Which similar display could have two different causes in your project?

    In the example: Investigate version conflicts before performance issues. Outdated verification evidence results from changed revisions; technical response loss results from transmission. Version conflicts and pending reconciliations are observed separately.

  9. Operations and security

    Which open state in your project needs a domain specialist as well as technical operations?

    In the example: Technical operations have no clinical approval role. In dokumentiert and storniert, new dispensing creates a conflict. Cancellation does not retroactively undo an action already documented.

  10. Final design

    Which two counterexample tests will you run first in your own end-to-end implementation?

    In the example: Test a prescription change against dispensing end to end. Change and dispensing both expect version 7. If the change wins, dispensing loses the old approval. If dispensing wins, the change is rejected and, after a fresh read, handled as an investigation case; dispensing that already occurred remains recorded.