View source: R/hospital_in_out_dates.R
hospital_in_out_dates | R Documentation |
This function helps to determine when a patient has been in hospital across spell aggregation. When retaining the final record the following criteria is used:
Current admissions take priority
When conflicting on the same day, inpatient admissions take priority over A&E emergency care data
Where a patient has a linked A&E admission to a hospital inpatient stay, the A&E admission date is used
Where a patient has a positive test between two hospital stays the most recent completed hospital stay prior to the test is retained except if the time between these events is greater than 14 days, then the first admission following the test is retained
hospital_in_out_dates(
data,
person_id = "id",
hospital = list(org_code = "organisation_code_of_provider", event_date = "ev_date",
ae_arrive = "arrival_date", ae_depart = "departure_date", ae_discharge =
"ecds_discharge", in_spell_start = "spell_start_date", in_spell_end =
"spell_end_date", in_discharge = "discharge_destination")
)
data |
the linked asset holding A&E and Inpatient data |
person_id |
the column containing the unique patient ID |
hospital |
a list containing the following items
|
new date columns on the data.table for hospital_in
and hospital_out
and hospital_event_rank
epidm::lookup_recode()
epidm::group_time()
epidm::cip_spells()
## Not run:
hospital_in_out_dates(link,
person_id = 'id',
hospital = list(
org_code = 'organisation_code_of_provider',
event_date = 'ev_date',
ae_arrive = 'arrival_date',
ae_depart = 'departure_date',
ae_discharge = 'ecds_discharge',
in_spell_start = 'spell_start_date',
in_spell_end = 'spell_end_date',
in_discharge = 'discharge_destination'
))[]
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.