
Apply exclusion criteria from a study spec to a skeleton
Source:R/tteplan_apply_exclusions.R
tteplan_apply_exclusions.RdApplies every eligibility criterion in the parsed study specification. Calls
skeleton_eligible_combine() at the end to AND them into one eligible
column.
Arguments
- skeleton
A data.table skeleton (person-week panel).
- spec
Parsed study specification from
tteplan_read_spec().- enrollment_spec
Enrollment spec from the plan (must contain
enrollment_id), as returned byplan[[i]].
Value
The skeleton (modified by reference), with eligibility columns
added and a combined eligible column.
Details
The function applies five groups of criteria, in this order:
calendar years, from
inclusion_criteria$isoyearsglobal inclusion criteria, from
inclusion_criteria$criteriaenrollment-specific additional inclusion, such as an age range
global exclusion criteria
enrollment-specific additional exclusion criteria
A global inclusion criterion applies to every enrollment. It declares
type: has_event, and an implementation block that names a
source_variable and a window. It adds one
eligible_has_<variable>_<window> column to the skeleton.
A washout declares implementation$type, a source_variable, a value and
a window. All four rule blocks accept one. no_prior_value keeps a
person-week when no prior week in the window holds value, and adds
eligible_no_<variable>_<window>. only_prior_value keeps a person-week
when every prior week in the window that holds an observation holds value,
and adds eligible_only_<variable>_<window>. A prior week with no
observation violates neither rule.