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.
Arguments
- data
a data.frame or data.table containing the patient data
- id
a named list to provide the column names with identifiers, quoted
nhs_number
the patient NHS number
hospital_number
the patient Hospital numbers also known as the local patient identifier
date_of_birth
the patient date of birth
sex_mfu
the patient sex or gender field as Male/Female/Unknown
forename
the patient forename
surname
the patient surname
postcode
the patient postcode
- .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