System Design Atlas

Clinical studies with consent and visits

04 / 10Worked example

Interfaces

How does the contract for “capture visit” distinguish a repetition from a new intention?

The load profile meets the specific change order “Create visit”. Its content consists of participation, protocol version, collection time, pseudonymized observation. An idempotency key detects the same intention after a loss of response; an aggregate version protects the changed business state.

Starting point Separate study load from concurrent actions on a participant.

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.

Commands, retries and current state

Command and historical result

CommandParticipation T-25 · Protocol P-25 · Visit V-25
Command → Studien-APICheck content and expected version
Study APIAccept the command or recognise a replay
Studien-API → ErgebnisjournalCommit the result before responding
Result journalFingerprint + stored record
identicalHistorical result
ModifiedConflict without effect
Response lossReplay after commit

The key binds the full content; identical repetition provides the stored receipt.

Capture visit binds participation, protocol version, collection time, pseudonymized observation. Same key points back to saved result; altered content branches to conflict.

Proposed API for this example

  1. POST/klinische-studie/{id}/commands

    Capture visits

    Input
    Participation, protocol version, collection time, pseudonymized observation; expected aggregate version, authorized role and stable command key.
    Result
    Durably stored business result and new version; version or content conflicts produce no partial effects. An accepted external request receives an open status.
    Retry behaviour
    The key is scoped to the actor, operation and business object. After authentication, first compare the existing result and canonical content: identical content returns the stored evidence; changed content produces a conflict. Only new keys trigger validation of the current version.
  2. GET/klinische-studie/{id}

    Read the current business state and reason for investigation.

    Input
    Authorised identity and business object.
    Result
    Study participation with current version, proofs and open processing reason.
    Retry behaviour
    Repeating a read creates no business change; access is checked again.

Additional state changes

OperationInputResult and protection
Activate participationProof of consent, pseudonym, protocol revision and versionOnly a documented, applicable scope of consent authorizes new data collection.
Withdraw participationParticipation version and documented withdrawal timeActive → withdrawn; later collection commands lose permission.
Correct observationVisit reference, original content, new content, reason and authorized reviewer roleAn additional correction revision; it is neither new data collection nor blanket deletion.
Complete participationChecked visit and data management proofActive → Completed; new visits remain blocked.

Activate participation

Input
Proof of consent, pseudonym, protocol revision and version
Result and protection
Only a documented, applicable scope of consent authorizes new data collection.

Withdraw participation

Input
Participation version and documented withdrawal time
Result and protection
Active → withdrawn; later collection commands lose permission.

Correct observation

Input
Visit reference, original content, new content, reason and authorized reviewer role
Result and protection
An additional correction revision; it is neither new data collection nor blanket deletion.

Complete participation

Input
Checked visit and data management proof
Result and protection
Active → Completed; new visits remain blocked.

Messages across the external boundary

Source contract
EMA lists ICH E6(R3) as a framework for quality, responsibility and study data. The fictitious time window is not a clinical or regulatory requirement.
System responsibility
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.

Recording and correction have separate contracts

Recording and correction have separate contracts

Recording and correction have separate contracts.

Capture Visit can re-arrive after a lost response.

Participation, protocol version, collection time, pseudonymized observation must remain identical on replay. The exercise specifies the input and expected result.

Alternative considered
A key stored only in volatile memory loses its evidence on restart.
Trade-off
Recording the journal for visits requires permanent retention and protected access.
Reassess
The documented retry window and journal volume determine the future archiving strategy.

Try it yourself

Predict the results of an identical retry of “Record visit”, the same key with a different observation value, and a new key with an old version.

A hint for your attempt

Retry identity and current state require separate checks.

Compare with a possible solution
Identical
The saved result for study participation T-25 is returned; the effect is not repeated.
Changed
The same key with altered canonical content results in conflict.
New intent with a stale version
A new key with a stale version is rejected before any business change. The interface reloads the current state and asks the user to confirm the decision again.

Apply to your project

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

Next, observations are corrected by revisions.