Characterise episodes

characterise_episodes(connection = NULL, .debug = FALSE)

Arguments

connection

a connection to the CC-HIC database

.debug

logical flag. If TRUE the function will extract from internal package test data

Value

a tibble that characterises each episode. The attribute invalid_records contains information related to invalid records and the reason for invalidation

Details

There are several ways to potentially define an episode. Fundamentally, a start and an end datetime are required for an unambiguous episode. The start datetime is already required to import episodes into the CC-HIC database (it is a primary key) and so is ensured to be 100% complete if the schema definition has been applied. This function therefore serves to identify the end of an episode, which is often much less clearly defined. Potential sources of information, in order of precedence include:

  • datetime of unit departure: 0412

  • date and time of in-unit death: 0042 and 0043

  • date and time of brainstem death: 0044 and 0045

  • date and time of body removed: 0038 and 0039

Further, these end times must correlate with an outcome status:

  • vital status at discharge from ICU: 0097

  • declaration of brainstem death: 0400