merge.and.crop.events: Crop the end date of each admission so that it is not outside...

View source: R/calculate.R

merge.and.crop.eventsR Documentation

Crop the end date of each admission so that it is not outside the DAOH period, and is before the patient died, then merge overlapping events. The cropped output columns will be suitable for calculating DAOH.

Description

Crop the end date of each admission so that it is not outside the DAOH period, and is before the patient died, then merge overlapping events. The cropped output columns will be suitable for calculating DAOH.

Usage

## S3 method for class 'and.crop.events'
merge(
  daoh.event.dt,
  patient.dt,
  patient.id.col.name = "PRIM_HCU.IDencrypted",
  index.event.id.col.name = "index.event.id",
  admission.start.col.name = "EVSTDATE",
  admission.end.col.name = "EVENDATE",
  daoh.period.start.col.name = "daoh.period.start",
  daoh.period.end.col.name = "daoh.period.end",
  dod.col.name = "DOD",
  merge.event.id.col.name = "merge.event.id",
  cropped.admission.start.col.name = "cropped.admission.start",
  cropped.admission.end.col.name = "cropped.admission.end"
)

Arguments

daoh.event.dt

A data.table with patient identifier, index event identifier, and all admission found within the DAOH period of that index event, generated by prune.events.to.period occurred, and merge.event.id.col.name generated by detect.overlapping.events.

patient.dt

A data.table with patient details, minimally including date of death.

patient.id.col.name

Character name of the patient identifier column (Default: 'PRIM_HCU.IDencrypted')

index.event.id.col.name

Character name of the index event identifier column (Default: 'index.event.id')

admission.start.col.name

Character name of the column containing admission start dates (Default: 'EVSTDATE')

admission.end.col.name

Character name of the column containing admission end dates (Default: 'EVENDATE')

daoh.period.start.col.name

Character name of the column that will be generated in index.op.dt to contain the start of each DAOH period (Default: 'daoh.period.start')

daoh.period.end.col.name

Character name of the column that will be generated in index.op.dt to contain the end of each DAOH period (Default: 'daoh.period.end')

dod.col.name

Character name of the column that contains date of death in the patient.dt (Default: 'DOD')

merge.event.id.col.name

Character name of the column that was populated with unique identifiers of overlapping events by detect.overlapping.events (Default: 'merge.event.id')

cropped.admission.start.col.name

Character name of the column that will be generated with admission start dates that do not go outside the DAOH period (Default: 'cropped.admission.start')

cropped.admission.end.col.name

Character name of the column that will be generated with admission end dates that do not go outside the DAOH period (Default: 'cropped.admission.end')

Value

A data.table with patient identifier, index event identifier, and all admissions found within the DAOH period of that index event, cropped so that they are not outside the DAOH limits, or overlapping patient death.


mattmoo/daohtools documentation built on Feb. 5, 2023, 5:38 a.m.