In the Cohort output, there are three distinct tables that complement the main cohort table. The main cohort table as you has cohort_definition_id, subject_id, cohort_start_date, cohort_end_date
. The supporting tables are as follows:
- cohort_inclusion ("#cohort_inclusion"): This serves as the rule metadata table, containing rule names and descriptions specific to each cohort. This table helps in identifying which rule is being examined.
-
cohort_inclusion_stats ("#cohort_inc_stats"): This is essentially the result table, containing fields such as
person_count
,gain_count
, andperson_total
. The table usescohort_definition_id
as the entity and attributes likerule_sequence
andmode_id
. -
cohort_inclusion_result ("#cohort_inc_result"): Another result table, this is where the ingenuity of @Chris_Knoll becomes apparent. Here, the entity is
cohort_definition_id
while the attributes includemode_id
andinclusion_rule_mask
. The value column containsperson_count
.
Regarding mode_id: The attribute mode_id
has two key values:
-
mode_id 0
: Denotes all events -
mode_id 1
: Indicates the “best event,” which represents the single event per person meeting the highest number of inclusion criteria.
The cohort_inclusion_result
uses inclusion_rule_mask
to summatively represent which of the inclusion rules were met for a particular combination. For example, an inclusion_rule_mask
of 3
means that rules 1 and 2 were met, and this will be represented in the person_count
column for the respective mode_id
values. How do I know that:
as.integer(intToBits(0))
= 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 i.e. none of max 32 inclusion rules were met.
as.integer(intToBits(3))
= 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 i.e. met rule 1 and 2.
I continue to be amazed by the brilliance of this approach, as initiated by @Chris_Knoll. It by using bitmask numbers to communicate the status of up to 32 inclusion rules efficiently.
Now we can use bit operators in very interesting ways to find count of persons who met only rule 3, or count of persons that met rules 1, 2 but not 3. etc. I heard there is some cool work in OHDSI ShinyModules to use the output to create various types of visualizations of attrition. I cant wait for that innovation.