TimeWindowInteraction
This class defines how two time windows interact (boolean result - Yes or No). Motivation - it is being used to decide:
- How to label samples based on registry - given outcome registry time range and prediction time range. return True/False if we should label the sample based on the registry record outcome value.
- Whether or not to censor the sample - given outcome registry time range and prediction time range. return True/False if we should censor the sample the object is being initialized by medial::sampling::init_time_window_mode function.
the initialization string format
the init strings define the Rules for interaction between sample time window and the registry time window.
this is abstraction of the time windows definitions:
Â
The init string has format of âlabel_value:Interaction_string|label_value:Interaction_string;âŚâ
Can also use label_value for all labels by specifying âallâ or just the numeric value: "0" for controls and "1" for cases.
We can specify diffrent rules for cases/controls
Â
 Interaction_string has format of âcondition,conditionâ.
The first condition is for sample from time window interaction with [registry start, registry end]
The first condition is for Sample to time window interaction with [registry start, registry end]
Â
Condition is enum with those options:
- âbefore_startâ â condition for time to be before registry startâ˘âafter_startâ â condition for time to be after registry startâ˘âwithinâ â condition for time to be after registry start and before registry end
- âbefore_endâ â condition for time to be before registry endâ˘âallâ â no condition, always true
Examples:
First example - Diseases that occurs once and forever like cancer full init string: â0:within,within|1:before_start,after_startâ Explain controls rule "within,within": samples should by within registry start to end time (which registry defines time range we mark the patient as sure control). also the from time window of sample/prediction and the end time window of sample/prediction Explain cases rule "before_start,after_start": sample should start before start_time of registry and finish after start_time of registry. in the registry there meaning for end time only start time = outcome time. there is no end_time for cancer and it's not being used Second example for vaccination registry (each vaccination holds for X time) full init string: â0:within,within|1:all,withinâ Explain controls rule "within,within": sample time window should be within all time range of unvaccinated period to be counted. can also specify less strict rule by "before_end,after_start" and conlifct_method="max" to include controls as patients with some interseciton with sure unvaccinated period and no intersection with vaccination period. Explain cases rule "all,within": sample time window should finish within registry vaccination period (never mind if started already vaccinated or not vaccinated). can also provide more strict rule by providing 3rd argument for intersection rate like "all,within,0.5-1.0" to count only samples with at least 50%-100% intersection.    Â