cleverly.StudyProtocol#
- class cleverly.StudyProtocol(target_population: str, eligibility: Sequence[str], time_zero: str, treatment_strategies: Sequence[str], treatment_versions: Sequence[str], outcome: str, horizon: str, intercurrent_event_handling: Sequence[str], interference_unit: str, assumption_rationale: Sequence[str])[source]#
Record the scientific protocol that gives a causal question its context.
- Parameters:
- target_population
str Population to which the causal question applies.
- eligibilitysequence
ofstr Inclusion and exclusion criteria.
- time_zero
str Event that aligns eligibility, treatment assignment, and follow-up.
- treatment_strategiessequence
ofstr Treatment strategies under comparison.
- treatment_versionssequence
ofstr Version attached to each treatment strategy, in the same order.
- outcome
str Outcome definition and measurement.
- horizon
str Follow-up horizon for the outcome.
- intercurrent_event_handlingsequence
ofstr Rules for events after time zero that affect outcome interpretation.
- interference_unit
str Unit within which interference may occur.
- assumption_rationalesequence
ofstr Study-specific rationale for the identification assumptions.
- schema_version
int Version of this normalized record schema.
- target_population
See also
cleverly.CausalStudyAttach a protocol to observed study data.
cleverly.IdentifiedEffectPersist the record with an identified question.
cleverly.ProvenanceStore the protocol digest on a fitted result.
Notes
This hybrid record uses target-trial and ICH estimand vocabulary. It is not a complete target-trial protocol or a complete ICH estimand. The typed estimand stores the contrast, and the method stores the analysis configuration.
Examples
>>> from cleverly import StudyProtocol >>> protocol = StudyProtocol( ... target_population="Adults eligible for navigation", ... eligibility=["Discharged alive"], ... time_zero="Hospital discharge", ... treatment_strategies=["Navigation", "Usual care"], ... treatment_versions=["Two calls", "No call"], ... outcome="Thirty-day transition score", ... horizon="30 days", ... intercurrent_event_handling=["Use outcome regardless of readmission"], ... interference_unit="Patient", ... assumption_rationale=["Adjustment covers measured common causes"], ... ) >>> len(protocol.fingerprint) 16
Methods#
- classmethod StudyProtocol.from_dict(payload: dict[str, Any]) StudyProtocol[source]#
Construct a protocol from its normalized form.
- Parameters:
- Returns:
StudyProtocolValidated immutable protocol record.
Attributes#
- StudyProtocol.canonical_json#
Return canonical UTF-8 JSON text used by
fingerprint.
- StudyProtocol.fingerprint#
Return the BLAKE2b digest of the canonical UTF-8 JSON record.