View source: R/apportion_phc_date.R
apportion_phc_date | R Documentation |
The mandatory surveillance launched a new apportioning algorithm on 01/04/2019. This new apportioning algorithm takes into account the date of the most recent discharge from the reporting trust.
apportion_phc_date(
data_collection,
patient_location,
patient_category,
adm_date,
spec_date,
adm_3_mo,
date_discharge,
date_record_created
)
data_collection |
String giving "CDI" or any other value - CDI has a different PTE rule |
patient_location |
The patient's location at time of sample |
patient_category |
The patient's category at time of sample |
adm_date |
Date of admission |
spec_date |
Date of specimen |
adm_3_mo |
Was the patient an inpatient at the trust in previous three months. String yes, no or don't know |
date_discharge |
date the patient was most recently discharged from the reporting trust |
date_record_created |
date the record was entered onto the system |
Depending on the data collection under surveillance (CDI or bacteraemia), cases are then apportioned to one of the following groups:
Healthcare onset - healthcare associated
Community onset - healthcare associated
Community onset - indeterminate association (CDI only)
Community onset - community associated
Community onset - missing
Community onset - unknown
A string variable giving the apportioning type; one of hoha, coha, coia or coca, all_blank if all of the prior healthcare exposures were NA, unknown_3_mo if prior health care in past three months was "Don't know" or NA if date record created < 01/04/2017
phc_dat <- data.frame(stringsAsFactors=FALSE,
id = c(1, 2, 3, 4, 5),
organism = rep("CDI", 5),
patient_location = c("NHS acute trust", "NHS acute trust",
"NHS acute trust", "NHS acute trust",
"NHS acute trust"),
patient_category = c("Inpatient", "Inpatient", "Inpatient",
"Inpatient", "Inpatient"),
admission_date = lubridate::dmy(c("01/06/2019", "01/06/2019",
"01/06/2019", "01/06/2019",
"01/06/2019")),
specimen_date = lubridate::dmy(c("01/06/2019", "01/06/2019",
"01/06/2019", "01/06/2019",
"01/06/2019")),
patient_admitted_at_three_months = c("yes", "yes", "yes", "yes", "no"),
date_most_recent_discharge = lubridate::dmy(c("31/05/2019", "21/05/2019",
"03/05/2019", "08/03/2019", NA)),
date_record_created = lubridate::dmy(c("15/06/2019", "15/06/2019",
"15/06/2019", "15/06/2019",
"15/06/2019"))
)
phc_dat$days_diff <- phc_dat$specimen_date - phc_dat$date_most_recent_discharge
phc_dat$apportion_phc_date <- apportion_phc_date(
data_collection = phc_dat$organism,
patient_location = phc_dat$patient_location,
patient_category = phc_dat$patient_category,
adm_date = phc_dat$admission_date,
spec_date = phc_dat$specimen_date,
adm_3_mo = phc_dat$patient_admitted_at_three_months,
date_discharge = phc_dat$date_most_recent_discharge,
date_record_created = phc_dat$date_record_created
)
# view the results
phc_dat[, c("days_diff", "apportion_phc_date")]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.