System Design Atlas

Laboratory samples with a complete chain of custody

06 / 10Worked example

The overall architecture

Large raw data is outside the receiving commit. What conditions ensure the result?

File transfer takes longer than the short custodian change.

Starting point The previous custodian remains authoritative until acceptance is confirmed.

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.

Device adapter and authorised reviewer

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.

API and mapping worker as two processes at the common relational data store; raw data storage separately; measuring device external boundary.

Responsibilities within the application

Laboratory modules

Sample receiptAge + containers
Chain of custodyCustodian
Release of resultsHash + Person
Measurement associationSample + raw data

Sample receipt, chain of custody and result release belong to the API; measurement association belongs to the worker.

Internal modules: Sample receipt: Checks identity, condition and acceptance window. Chain of custody: Tracks confirmed custody changes and open transfers. Measurement association: Combines raw measurement with sample and method. Result release: Freezes reviewed result revisions. The overall architecture shows their assignment to runtime processes and storage.

Runtime components and authoritative data

Runtime boundary
Scanning interfaces → laboratory API → relational sample data store. The device adapter runs as a separate process, receives instrument data, writes raw data to object storage and writes a handoff task to the same relational store. The assignment worker processes that task. The authorised reviewer uses the API. The inbox and domain state share the relational store; the inbox is not a second database.
Module responsibilities
Sample receipt: Checks identity, status and acceptance window.; Chain of custody: Tracks confirmed custody changes and open transfers.; Measurement association: Connects raw measurement with sample and method.; Result release: Freezes reviewed result revisions.

Large raw data files remain outside the receipt commit.

Large raw data files remain outside the receipt commit.

Store raw data immutably and associate it by hash.

File transfer takes longer than the short custodian change.

The laboratory API handles scans; the device adapter accepts data; the assignment worker performs the domain-level association. A relational data store holds the inbox and business state; the object store holds raw bytes. The inbox is not a second database.

Alternative considered
Raw files in the scan lock extend each acceptance.
Trade-off
Orphaned files need a cleanup rule.
Reassess
Very large series of devices justify further workers.

Try it yourself

Assign API, device adapter, and measurement mapping processes; name their authoritative data store.

A hint for your attempt

File transfer takes longer than the short custodian change.

Compare with a possible solution
Runtime
Laboratory API handles scans; device adapter accepts data; assignment worker performs the domain association.
Data management
A relational data store holds inbox and domain state; object store holds raw bytes. The inbox is not a second database.

Apply to your project

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

Step 7: The winning commit decides the custodian. What conditions ensure the result?