Data and states
Which changes to study participation must apply together, and what remains protected after completion?
The contracts require an authoritative data store for study participation T-25. The protocol is immutable content; the participation version protects the mutable authorization status. A separate identity service holds the link to personally identifying information. The learning case only stores pseudonyms. Storage and further processing after withdrawal require a separately agreed legal and study contract. The state is stored together with its command result; this keeps the same change task visible after restart.
Starting point Recording and correction have separate contracts.
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.
Authoritative data and permitted state transitions
Participation version, protocol and observation
The protocol is immutable content; the participation version protects the changeable release status.
Domain entities and relationships
| Entity | Authoritative attributes | Relationship |
|---|---|---|
| Participation | T-25; pseudonym, status, aggregate version | Participation references a documented scope of consent. |
| Revision of protocols | P-25; unchangeable content | Many visits can reference the same shared revision. |
| Visits | V-25; time, observation, origin | Part of exactly one participation and protocol revision. |
| Correction | Relation to the original visit, reason, reviewer | Complements the history; is never issued as a new data collection. |
Participation
- Authoritative attributes
- T-25; pseudonym, status, aggregate version
- Relationship
- Participation references a documented scope of consent.
Revision of protocols
- Authoritative attributes
- P-25; unchangeable content
- Relationship
- Many visits can reference the same shared revision.
Visits
- Authoritative attributes
- V-25; time, observation, origin
- Relationship
- Part of exactly one participation and protocol revision.
Correction
- Authoritative attributes
- Relation to the original visit, reason, reviewer
- Relationship
- Complements the history; is never issued as a new data collection.
Permitted state transitions
| Starting point | Target | Precondition |
|---|---|---|
| Invited | aktiv | Documented proof of consent for the released protocol version. |
| aktiv | widerrufen | Withdrawal is accepted permanently; new data collections remain blocked. |
| aktiv | abgeschlossen | The visit is reviewed and data management confirms the planned completion. |
| widerrufen or abgeschlossen | terminal | New collections are blocked; justified corrections of existing data are kept as own revisions. |
Invited
- Target
- aktiv
- Precondition
- Documented proof of consent for the released protocol version.
aktiv
- Target
- widerrufen
- Precondition
- Withdrawal is accepted permanently; new data collections remain blocked.
aktiv
- Target
- abgeschlossen
- Precondition
- The visit is reviewed and data management confirms the planned completion.
widerrufen or abgeschlossen
- Target
- terminal
- Precondition
- New collections are blocked; justified corrections of existing data are kept as own revisions.
Atomic changes and versions
- Content reference
- The protocol is immutable content; the participation version protects the mutable authorization status. A separate identity service holds the link to personally identifying information. The learning case only stores pseudonyms. Storage and further processing after withdrawal require a separately agreed legal and study contract.
- Shared commit
- Study API checks participation, protocol version, collection time, pseudonymized observation and writes domain change, command result and, if applicable, pending work in a transaction. Commit means that these changes will be permanently visible together. Before commit, a rollback ends the attempt without partial effect.
- Concurrency
- 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.
- Terminal completion
- After withdrawal or completion, every new visit is rejected; corrections reference the old record and remain separate from new data collection.
Cover the full scope of the case
- Concrete rule
- The 24-hour domain window is an illustrative assumption. Data submissions exactly at its right boundary are rejected as outside the window. Observations already collected but submitted later need an explicitly agreed follow-up path; backdating does not authorize them automatically.
Derive storage needs from access patterns
- Authoritative relational datastore
- Participation references a documented scope of consent. Many visits can reference the same shared revision. The draft therefore selects a relational metadata store with uniqueness constraints and short transactions. Historical versions remain referenceable; a rebuildable read model must not overwrite the authoritative state.
- Large content and measurement series
- Immutable files reside in a separate artifact or document store; their hash references become available for approval only after the files are fully stored.
Correct observations through revisions
Correct observations through revisions.
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.
After withdrawal or completion, every new visit is rejected; corrections reference the old record and remain separate from new data collection. The exercise specifies the input and expected result.
- Alternative considered
- Separate unversioned changes allow an older state to overwrite the newer one.
- Trade-off
- Changes to study participation T-25 are briefly serialized.
- Reassess
- Measurable waiting times for 20 competing data collections and a withdrawal of the same participation justify a check of the transaction duration.
Try it yourself
Explain the two possible winner orders in the case contract. Also determine the behaviour after terminal completion.
A hint for your attempt
Content revision and aggregate version have different tasks.
Compare with a possible solution
- Concurrency
- 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.
- Completion
- After withdrawal or completion, every new visit is rejected; corrections reference the old record and remain separate from new data collection.
Apply to your project
Which states must remain protected in your model against late replay?