System Design Atlas

Laboratory samples with a complete chain of custody

10 / 10Worked example

Final design

The end-to-end path includes a valid and a rejected path. What conditions ensure the result?

Only successful measurements would leave the time limit unchecked.

Starting point Hash verification blocks incomplete result versions.

Assumptions for the example case

Fictitious training laboratory with an aqueous control sample. The draft documents custody changes and results; diagnostic interpretation and clinical decisions are outside the case. All quantities, thresholds and operational objectives of this design are illustrative assumptions.

Laboratory architecture with counterexamples

Device adapter and authorised reviewer

Scanning interfacesauthenticated
Laboratory APIReceipt + Release
Relational sample data storeP-40 · Inbox · E-40
Device adapterMeasurement data acceptance
Raw data storageFile + hash
Assignment WorkerSample + Procedure
Measuring instrumentExternal
Authorised reviewerReviewer
Scanning interfaces → Laboratory APIReceipt / release
Laboratory API → Relational sample data storeP-40 + inbox + domain state
Measuring instrument → Device adapterMeasurement data
Device adapter → Raw data storeRaw file + hash
Device adapter → Relational sample data storeAssociation task
Relational sample data store → Assignment workerInbox task
Raw data storage → Assignment workerHash
Assignment worker → Relational sample data storeAssociate E-40
Authorised reviewer → Laboratory APIRelease command

The inbox and domain state share the relational data store; raw data stays separately in object storage.

Architecture from step 6; marker time limit at sample receipt, contention at chain of custody, hash at release; backlinks 2, 5, 9.

Test plan with expected outcomes

Input and initial stateExpected resultReturn to an earlier step
P-40 in transit, version=2 → receipt A/B and B/A expected=2A custodian wins; loser conflict; exactly a confirmed receipt.Step 5 and 7
Receipt A committed → A identical, then other recipients under AIdentical result; altered repetition conflict.Step 4
Removal t=0 → Receipt at 7,199,999 / 7,200,000 / 7,200,001 msOnly first receipt allowed in time; other rejections with reason.Step 2
E-40 measured → rawHash missing; then quality failure; alternatively, complete authorised reviewMissing hash blocks release; failed quality review makes the measurement invalid; complete successful review releases it.Step 5 and 10

P-40 in transit, version=2 → receipt A/B and B/A expected=2

Expected result
A custodian wins; loser conflict; exactly a confirmed receipt.
Return to an earlier step
Step 5 and 7

Receipt A committed → A identical, then other recipients under A

Expected result
Identical result; altered repetition conflict.
Return to an earlier step
Step 4

Removal t=0 → Receipt at 7,199,999 / 7,200,000 / 7,200,001 ms

Expected result
Only first receipt allowed in time; other rejections with reason.
Return to an earlier step
Step 2

E-40 measured → rawHash missing; then quality failure; alternatively, complete authorised review

Expected result
Missing hash blocks release; failed quality review makes the measurement invalid; complete successful review releases it.
Return to an earlier step
Step 5 and 10

End-to-end test and unresolved agreements

First end-to-end path
Accept the control sample, trigger concurrent receipt attempts, retry the instrument message and release the result with complete provenance. Separately, reject a sample exactly at the expiry boundary.
Clarify before real use
Procedure-specific acceptance criteria, actual signature requirements, retention and domain-specific quality assurance require separate agreements.

The end-to-end test covers a valid path and a rejected path.

The end-to-end test covers a valid path and a rejected path.

Validate acceptance, concurrency, measurement association and result release together.

Only successful measurements would leave the time limit unchecked.

Sample receipt rejects exactly 120 minutes; error leads to step 2. Handover chain allows a winner in both orders; error leads to step 5 and 7.

Alternative considered
A result view with a demo value does not prove a chain of provenance.
Trade-off
Error points must be injected in a targeted manner.
Reassess
Only after this evidence will further procedures be added.

Try it yourself

Assign the time-limit test and concurrent receipt test to a module, expected result and design step to revisit.

A hint for your attempt

Only successful measurements would leave the time limit unchecked.

Compare with a possible solution
Acceptance window
Sample receipt rejects exactly 120 minutes; error leads to step 2.
Change of depository
Handover chain allows a winner in both orders; error leads to step 5 and 7.

Apply to your project

What is the equivalent of “The end-to-end path includes a valid and a rejected path” in your own design?

Transfer the decisions and their counterexamples to the editable 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 is the equivalent of “sample and result bear separate responsibility.” in your own project?

    In the example: Receipt and authorised result release remain separate decisions.

  2. Requirements

    What is the equivalent of “The acceptance window ends exactly.” in your own project?

    In the example: At receipt, check that age is less than 120 minutes.

  3. Scale estimates

    What is the equivalent of “delivery generates the scanning peak.” in your own project?

    In the example: Test average load and scanning peaks separately.

  4. Interfaces

    What is the equivalent of "The recipient belongs to the repeat contract." in your own project?

    In the example: The key and input hash identify the same receipt.

  5. Data and states

    Which correspondence has "custody change and results remain comprehensible." in your own project?

    In the example: The previous custodian remains authoritative until acceptance is confirmed.

  6. Overall architecture

    What is the equivalent of “Big raw data is outside the receiving commit.” in your own project?

    In the example: Store raw data immutably and associate it by hash.

  7. Critical flow

    What is the equivalent of "The winning commit decides the custodian." in your own project?

    In the example: Write the version check and receipt atomically.

  8. Bottlenecks and trade-offs

    Which equivalent has “Unallocated data is a domain workflow bottleneck” in your own project?

    In the example: Count unassigned measurements separately by cause.

  9. Operations and security

    What is the equivalent of "Every release needs recoverable origin." in your own project?

    In the example: Hash verification blocks incomplete result versions.

  10. Final design

    What is the equivalent of “The end-to-end path includes a valid and a rejected path” in your own design?

    In the example: Validate acceptance, concurrency, measurement association and result release together.