System Design Atlas

Clinical studies with consent and visits

10 / 10Worked example

Final design

Which examinations prove concurrency control and completion for study participation in the overall architecture?

The conclusion takes over the entire topology from step 6. Within the system boundary: Interface → Study API → Participations, protocol references, observation revisions and access log; checklist processing reads durably stored work from this data store. Outside: protocol archive. The processing receives or transmits the domain messages described in the main path; the result reaches the interface via the Study API. The verification plan complements study participation T-25 with contention, repetition, boundary conditions and terminal completion. All results in the table are expected outcomes; these tests have not yet been run.

Starting point Access follows study assignment and task.

Assumptions for the example case

Own fictitious example design. Fictitious documentation of an observational study with a pseudonymized participant, a visit and a versioned protocol. The example visit window covers seconds from the planned start: 0 inclusive to 86400 exclusive. 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 · Study team → Study API
  2. 2 · Study API → Relational participation status
  3. 3 · Relational participation status → checklist processing
  4. 4 · Checklist Processing → Data Management
Study teamRecording visits and revocation

Pseudonymised study documentation

Study APICheck permission atomically
Relational participation stateParticipation version and observation
Checklist processingCreating quality tasks
Data managementCheck assigned pseudonyms
Study team → Study APIVisit or revocation
Study API → Relational participation stateCommit participation version and observation
Relational participation state → Checklist processingPseudonymous observation
Checklist processing → Data managementOpen quality task
Concurrency and replay4 · 5 · 7
Exact limitVisit window 0 ≤ t < 86,400 s · 2
CompletionRole evidence · 9

Pseudonymized participation and observations are stored in the study data; the link to personally identifying information is outside this example.

Study team and reviewers use the study API with relational participation status. A separate protected document area contains proofs of protocol and consent; the API stores their stable references. Checklist processing reads pseudonymized observations and generates open quality tasks. The link to personally identifying information is outside the example scope. Data management receives exclusively assigned pseudonymized data records. The withdrawal path ends synchronously at the authoritative participation state before further data collections are admitted. 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
Study APIThe visit and withdrawal both expect version 4. If withdrawal wins, the visit is rejected. If the visit wins, it remains an already accepted collection; after a fresh read, withdrawal is accepted against version 5 and blocks further collection.Steps 3 and 5
Command journalIdentical retries take effect once; changed content produces a conflict.Steps 4 and 7
Domain boundary checkCheck values 86399, 86400 and 86401 seconds. Oracle: The example visit window covers seconds from the planned start: 0 inclusive to 86400 exclusive.Step 2
Study participation, protocol references, observation revisions and access logAfter withdrawal or completion, every new visit is rejected; corrections reference the old record and remain separate from new data collection.Steps 5 and 9
Checklist processingData collection and withdrawal compete on the same participation record. The commit point sets the local order. A capture result lost after commit is read from the command journal; a withdrawal is neither deleted nor backdated.Steps 6 and 7

Study API

Test and expected result
The visit and withdrawal both expect version 4. If withdrawal wins, the visit is rejected. If the visit wins, it remains an already accepted collection; after a fresh read, withdrawal is accepted against version 5 and blocks further collection.
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 86399, 86400 and 86401 seconds. Oracle: The example visit window covers seconds from the planned start: 0 inclusive to 86400 exclusive.
Return to an earlier step
Step 2

Study participation, protocol references, observation revisions and access log

Test and expected result
After withdrawal or completion, every new visit is rejected; corrections reference the old record and remain separate from new data collection.
Return to an earlier step
Steps 5 and 9

Checklist processing

Test and expected result
Data collection and withdrawal compete on the same participation record. The commit point sets the local order. A capture result lost after commit is read from the command journal; a withdrawal is neither deleted nor backdated.
Return to an earlier step
Steps 6 and 7

First end-to-end test and outstanding evidence

End-to-end path
Withdrawal against Visit checks the first end-to-end path. Data collection and withdrawal compete on the same participation record. The commit point sets the local order. A capture result lost after commit is read from the command journal; a withdrawal is neither deleted nor backdated.
Clarify before extending the scope
Agree on the actual protocol-archive contract, retention, recovery targets and role assignments. Every limit here is a design assumption. The evidence table specifies tests to run; technical integration, browser checks and reader comprehension checks follow separately.

Test withdrawal against a concurrent visit end to end

Test withdrawal against a concurrent visit end to end

Test withdrawal against a concurrent visit end to end.

A scheduled visit coincides with withdrawal of consent. The software must distinguish the time of new collection from the subsequent correction of already documented observations. Completion requires technical and domain evidence.

The visit and withdrawal both expect version 4. If withdrawal wins, the visit is rejected. If the visit wins, it remains an already accepted collection; after a fresh read, withdrawal is accepted against version 5 and blocks further collection. 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
The visit and withdrawal both expect version 4. If withdrawal wins, the visit is rejected. If the visit wins, it remains an already accepted collection; after a fresh read, withdrawal is accepted against version 5 and blocks further collection. The invariant is expected: a new study data collection requires active participation for the same protocol version at the time of atomic acceptance; a withdrawal ends new data collection authorizations. Deviation leads back to step 5 and to the command contract in step 4.
Test completion and retries
Initial state: an active participation has exactly one accepted visit. Withdraw participation and complete the agreed process. Submit a new visit and retry the previously accepted visit with the same key and content. Expected result: the new collection is rejected; replay returns the existing evidence; exactly one accepted visit remains. A correction references this existing record and follows the separate correction path. Failures return to step 9 for responsibility 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 study participation would arise in your own project outside of the application?

    In the example: Permission to collect data applies to a specific protocol version. Fictional documentation of an observational study with a pseudonymized participant, a visit and a versioned protocol.

  2. Requirements

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

    In the example: Withdrawal blocks new data collection at commit time. The example visit window covers seconds since its planned start from 0 inclusive to 86400 exclusive.

  3. Scale estimates

    Which individual entity in your project concentrates load more strongly than the daily average in this study-visit example?

    In the example: Separate study load from concurrent actions on a participant. An average of 0.0833333 events/s says little about 20 concurrent data submissions and a withdrawal for the same participation.

  4. Interfaces

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

    In the example: Recording and correction have separate contracts. The participation, protocol version, collection time and pseudonymized observation must remain identical on replay.

  5. Data and states

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

    In the example: Correct observations through revisions. After widerrufen and abgeschlossen, every new visit is rejected; corrections reference the old record and remain separate from new data collection.

  6. Overall architecture

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

    In the example: Personally identifying data stays outside the study API. Study participation, protocol references, observation revisions and the access log 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: Order withdrawal and visit updates on the same record. New study data collection requires active participation for the same protocol version at the atomic acceptance point; withdrawal ends permission for new collection.

  8. Bottlenecks and trade-offs

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

    In the example: Checklists expose missing provenance rather than guessing it. Many queries may result from missing protocol references or slow review lists; the proportion of incomplete submissions and queue age are separate signals.

  9. Operations and security

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

    In the example: Access follows study assignment and task. After widerrufen and abgeschlossen, every new visit is rejected; corrections reference the old record and remain separate from new data collection.

  10. Final design

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

    In the example: Test withdrawal against a concurrent visit end to end. The visit and withdrawal both expect version 4. If withdrawal wins, the visit is rejected. If the visit wins, it remains an already accepted collection; after a fresh read, withdrawal is accepted against version 5 and blocks further collection.