uk_patient_id | R Documentation |
Groups patient records from multiple isolates with a single integer patientID by grouping patient identifiers.
Grouping is based on the following stages:
matching nhs number and date of birth
Hospital number & Date of Birth
NHS number & Hospital Number
NHS number & Name
Hospital number & Name
Sex & Date of Birth & Surname
Sex & Date of Birth & Fuzzy Name
Sex & Year and Month of Birth & Fuzzy Name
Postcode & Name
Name Swaps (when first and last name are the wrong way around)
Identifiers are copied over where they are missing or invalid to the grouped records.
uk_patient_id(
data,
id = list(nhs_number = "nhs_number", hospital_number = "patient_hospital_number",
date_of_birth = "date_of_birth", sex_mfu = "sex", forename = "forename", surname =
"surname", postcode = "postcode"),
.useStages = c(1:11),
.sortOrder,
.keepValidNHS = FALSE,
.forceCopy = FALSE
)
data |
a data.frame or data.table containing the patient data |
id |
a named list to provide the column names with identifiers, quoted
|
.useStages |
optional, default 1:11; set to 1 if you wish patient ID to be assigned cases with the same DOB and NHS number, set to 2 if you wish patient ID to be assigned to cases with the same hospital number (HOS) and DOB, set to 3 if you wish patient ID to be assigned cases with the same NHS and HOS number, set to 4 if you wish patient ID to be assigned cases with the same NHS number and surname, set to 5 if you wish patient ID to be assigned cases with the same hospital number and surname, set to 6 if you wish patient ID to be assigned cases with the same DOB and surname, set to 7 if you wish patient ID to be assigned cases with the same sex and full name, set to 8 if you wish patient ID to be assigned cases with the same sex, DOB and fuzzy name, set to 9 if you wish patient ID to be assigned cases with the same DOB and fuzzy name, set to 10 if you wish patient ID to be assigned cases with the same name and postcode, set to 11 if you wish patient ID to be assigned cases with the same first name or second name in changing order and date of birth. |
.sortOrder |
optional; a column as a character to allow a sorting order on the id generation |
.keepValidNHS |
optional, default FALSE; set TRUE if you wish to retain the column with the NHS checksum result stored as a BOOLEAN |
.forceCopy |
optional, default FALSE; TRUE will force data.table to take a copy instead of editing the data without reference |
A dataframe with one new variable:
id
a unique patient id
valid_nhs
if retained using argument .keepValidNHS=TRUE
, a
BOOLEAN containing the result of the NHS checksum validation
uk_patient_id(
data = head(epidm::lab_data),
id = list(
nhs_number = 'nhs_number',
hospital_number = 'local_patient_identifier',
date_of_birth = 'patient_birth_date',
sex_mfu = 'sex',
forename = 'forename',
surname = 'surname'
postcode = 'postcode'
),
.sortOrder = 'specimen_date',
.forceCopy = TRUE
)[]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.