The TimeAtRisk class, encapsulating the id, startWith, startOffset, endWith and endOffset
This class is used to specify a time-at-risk (TAR) definition. A TAR is defined by choosing the start/end date of a cohort to start with (plus an offset), and a start/end date of the cohort to end with (plus an offset).
Note, when serializing with a library such as jsonlite, first call toList() on the R6 class before calling jsonlite::toJSON().
idan integer uniquely identifying this time at risk
startWiththe cohort date to start the time-at-risk. Can be either "start" or "end".
startOffsetThe number of days added to the date specified in startWith.
endWiththe cohort date to start the time-at-risk. Can be either "start" or "end".
endOffsetThe number of days added to the date specified in startWith.
new()creates a new instance, using the provided data param if provided. The JSON takes the form: "id":1,"start":"dateField":"start","offset":1,"end":"dateField":"start","offset":30
TimeAtRisk$new(data = list())