diff --git a/NAMESPACE b/NAMESPACE index d0323b8c4..27447da7b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -164,17 +164,6 @@ export(write_file) importFrom(data.table,.N) importFrom(data.table,.SD) importFrom(magrittr,"%>%") -importFrom(readr,col_character) -importFrom(readr,col_date) -importFrom(readr,col_datetime) -importFrom(readr,col_double) -importFrom(readr,col_factor) -importFrom(readr,col_integer) -importFrom(readr,col_logical) -importFrom(readr,col_number) -importFrom(readr,col_time) -importFrom(readr,cols) -importFrom(readr,cols_only) importFrom(rlang,":=") importFrom(rlang,.data) importFrom(tibble,tibble) diff --git a/R/createslf-package.R b/R/createslf-package.R index acf9154b6..cdd7d1a01 100644 --- a/R/createslf-package.R +++ b/R/createslf-package.R @@ -1,6 +1,4 @@ ## usethis namespace: start -#' @importFrom readr cols cols_only col_character col_date col_datetime -#' col_double col_factor col_integer col_logical col_number col_time #' @importFrom tibble tibble #' @importFrom rlang := .data ## usethis namespace: end diff --git a/R/process_extract_ae.R b/R/process_extract_ae.R index 95dfd99be..d4ab9bf7c 100644 --- a/R/process_extract_ae.R +++ b/R/process_extract_ae.R @@ -193,12 +193,12 @@ process_extract_ae <- function(data, year, write_to_disk = TRUE) { ae_cup_file <- read_file( path = get_boxi_extract_path(year, "AE_CUP"), - col_type = cols( - "ED Arrival Date" = col_date(format = "%Y/%m/%d %T"), - "ED Arrival Time" = col_time(""), - "ED Case Reference Number [C]" = col_character(), - "CUP Marker" = col_double(), - "CUP Pathway Name" = col_character() + col_type = readr::cols( + "ED Arrival Date" = readr::col_date(format = "%Y/%m/%d %T"), + "ED Arrival Time" = readr::col_time(""), + "ED Case Reference Number [C]" = readr::col_character(), + "CUP Marker" = readr::col_double(), + "CUP Pathway Name" = readr::col_character() ) ) %>% # rename variables diff --git a/R/read_extract_acute.R b/R/read_extract_acute.R index 6a0d23b11..84baa6f5b 100644 --- a/R/read_extract_acute.R +++ b/R/read_extract_acute.R @@ -9,75 +9,75 @@ read_extract_acute <- function(year, file_path = get_boxi_extract_path(year = year, type = "Acute")) { # Read BOXI extract extract_acute <- read_file(file_path, - col_type = cols( - "Costs Financial Year (01)" = col_integer(), - "Costs Financial Month Number (01)" = col_double(), - "GLS Record" = col_character(), - "Date of Admission(01)" = col_date(format = "%Y/%m/%d %T"), - "Date of Discharge(01)" = col_date(format = "%Y/%m/%d %T"), - "Pat UPI" = col_character(), - "Pat Gender Code" = col_double(), - "Pat Date Of Birth [C]" = col_date(format = "%Y/%m/%d %T"), - "Practice Location Code" = col_character(), - "Practice NHS Board Code - current" = col_character(), - "Geo Postcode [C]" = col_character(), - "NHS Board of Residence Code - current" = col_character(), - "Geo Council Area Code" = col_character(), - "Geo HSCP of Residence Code - current" = col_character(), - "Geo Data Zone 2011" = col_character(), - "Treatment Location Code" = col_character(), - "Treatment NHS Board Code - current" = col_character(), - "Occupied Bed Days (01)" = col_double(), - "Inpatient Day Case Identifier Code" = col_character(), - "Specialty Classificat. 1/4/97 Code" = col_character(), - "Significant Facility Code" = col_character(), - "Lead Consultant/HCP Code" = col_character(), - "Management of Patient Code" = col_character(), - "Patient Category Code" = col_character(), - "Admission Type Code" = col_character(), - "Admitted Trans From Code" = col_character(), - "Location Admitted Trans From Code" = col_character(), - "Old SMR1 Type of Admission Code" = col_integer(), - "Discharge Type Code" = col_character(), - "Discharge Trans To Code" = col_character(), - "Location Discharged Trans To Code" = col_character(), - "Diagnosis 1 Code (6 char)" = col_character(), - "Diagnosis 2 Code (6 char)" = col_character(), - "Diagnosis 3 Code (6 char)" = col_character(), - "Diagnosis 4 Code (6 char)" = col_character(), - "Diagnosis 5 Code (6 char)" = col_character(), - "Diagnosis 6 Code (6 char)" = col_character(), - "Operation 1A Code (4 char)" = col_character(), - "Operation 1B Code (4 char)" = col_character(), - "Date of Operation 1 (01)" = col_date(format = "%Y/%m/%d %T"), - "Operation 2A Code (4 char)" = col_character(), - "Operation 2B Code (4 char)" = col_character(), - "Date of Operation 2 (01)" = col_date(format = "%Y/%m/%d %T"), - "Operation 3A Code (4 char)" = col_character(), - "Operation 3B Code (4 char)" = col_character(), - "Date of Operation 3 (01)" = col_date(format = "%Y/%m/%d %T"), - "Operation 4A Code (4 char)" = col_character(), - "Operation 4B Code (4 char)" = col_character(), - "Date of Operation 4 (01)" = col_date(format = "%Y/%m/%d %T"), - "Age at Midpoint of Financial Year (01)" = col_integer(), - "Continuous Inpatient Stay(SMR01) (inc GLS)" = col_integer(), - "Continuous Inpatient Journey Marker (01)" = col_integer(), - "CIJ Planned Admission Code (01)" = col_integer(), - "CIJ Inpatient Day Case Identifier Code (01)" = col_character(), - "CIJ Type of Admission Code (01)" = col_character(), - "CIJ Admission Specialty Code (01)" = col_character(), - "CIJ Discharge Specialty Code (01)" = col_character(), - "CIJ Start Date (01)" = col_date(format = "%Y/%m/%d %T"), - "CIJ End Date (01)" = col_date(format = "%Y/%m/%d %T"), - "Total Net Costs (01)" = col_double(), - "NHS Hospital Flag (01)" = col_character(), - "Community Hospital Flag (01)" = col_character(), - "Alcohol Related Admission (01)" = col_character(), - "Substance Misuse Related Admission (01)" = col_character(), - "Falls Related Admission (01)" = col_character(), - "Self Harm Related Admission (01)" = col_character(), - "Unique Record Identifier" = col_character(), - "Line Number (01)" = col_character() + col_type = readr::cols( + "Costs Financial Year (01)" = readr::col_integer(), + "Costs Financial Month Number (01)" = readr::col_double(), + "GLS Record" = readr::col_character(), + "Date of Admission(01)" = readr::col_date(format = "%Y/%m/%d %T"), + "Date of Discharge(01)" = readr::col_date(format = "%Y/%m/%d %T"), + "Pat UPI" = readr::col_character(), + "Pat Gender Code" = readr::col_double(), + "Pat Date Of Birth [C]" = readr::col_date(format = "%Y/%m/%d %T"), + "Practice Location Code" = readr::col_character(), + "Practice NHS Board Code - current" = readr::col_character(), + "Geo Postcode [C]" = readr::col_character(), + "NHS Board of Residence Code - current" = readr::col_character(), + "Geo Council Area Code" = readr::col_character(), + "Geo HSCP of Residence Code - current" = readr::col_character(), + "Geo Data Zone 2011" = readr::col_character(), + "Treatment Location Code" = readr::col_character(), + "Treatment NHS Board Code - current" = readr::col_character(), + "Occupied Bed Days (01)" = readr::col_double(), + "Inpatient Day Case Identifier Code" = readr::col_character(), + "Specialty Classificat. 1/4/97 Code" = readr::col_character(), + "Significant Facility Code" = readr::col_character(), + "Lead Consultant/HCP Code" = readr::col_character(), + "Management of Patient Code" = readr::col_character(), + "Patient Category Code" = readr::col_character(), + "Admission Type Code" = readr::col_character(), + "Admitted Trans From Code" = readr::col_character(), + "Location Admitted Trans From Code" = readr::col_character(), + "Old SMR1 Type of Admission Code" = readr::col_integer(), + "Discharge Type Code" = readr::col_character(), + "Discharge Trans To Code" = readr::col_character(), + "Location Discharged Trans To Code" = readr::col_character(), + "Diagnosis 1 Code (6 char)" = readr::col_character(), + "Diagnosis 2 Code (6 char)" = readr::col_character(), + "Diagnosis 3 Code (6 char)" = readr::col_character(), + "Diagnosis 4 Code (6 char)" = readr::col_character(), + "Diagnosis 5 Code (6 char)" = readr::col_character(), + "Diagnosis 6 Code (6 char)" = readr::col_character(), + "Operation 1A Code (4 char)" = readr::col_character(), + "Operation 1B Code (4 char)" = readr::col_character(), + "Date of Operation 1 (01)" = readr::col_date(format = "%Y/%m/%d %T"), + "Operation 2A Code (4 char)" = readr::col_character(), + "Operation 2B Code (4 char)" = readr::col_character(), + "Date of Operation 2 (01)" = readr::col_date(format = "%Y/%m/%d %T"), + "Operation 3A Code (4 char)" = readr::col_character(), + "Operation 3B Code (4 char)" = readr::col_character(), + "Date of Operation 3 (01)" = readr::col_date(format = "%Y/%m/%d %T"), + "Operation 4A Code (4 char)" = readr::col_character(), + "Operation 4B Code (4 char)" = readr::col_character(), + "Date of Operation 4 (01)" = readr::col_date(format = "%Y/%m/%d %T"), + "Age at Midpoint of Financial Year (01)" = readr::col_integer(), + "Continuous Inpatient Stay(SMR01) (inc GLS)" = readr::col_integer(), + "Continuous Inpatient Journey Marker (01)" = readr::col_integer(), + "CIJ Planned Admission Code (01)" = readr::col_integer(), + "CIJ Inpatient Day Case Identifier Code (01)" = readr::col_character(), + "CIJ Type of Admission Code (01)" = readr::col_character(), + "CIJ Admission Specialty Code (01)" = readr::col_character(), + "CIJ Discharge Specialty Code (01)" = readr::col_character(), + "CIJ Start Date (01)" = readr::col_date(format = "%Y/%m/%d %T"), + "CIJ End Date (01)" = readr::col_date(format = "%Y/%m/%d %T"), + "Total Net Costs (01)" = readr::col_double(), + "NHS Hospital Flag (01)" = readr::col_character(), + "Community Hospital Flag (01)" = readr::col_character(), + "Alcohol Related Admission (01)" = readr::col_character(), + "Substance Misuse Related Admission (01)" = readr::col_character(), + "Falls Related Admission (01)" = readr::col_character(), + "Self Harm Related Admission (01)" = readr::col_character(), + "Unique Record Identifier" = readr::col_character(), + "Line Number (01)" = readr::col_character() ) ) %>% # Rename variables diff --git a/R/read_extract_ae.R b/R/read_extract_ae.R index 6cddd1cb6..dab886816 100644 --- a/R/read_extract_ae.R +++ b/R/read_extract_ae.R @@ -8,42 +8,42 @@ read_extract_ae <- function( year, file_path = get_boxi_extract_path(year = year, type = "AE")) { extract_ae <- read_file(file_path, - col_type = cols( - "Arrival Date" = col_date(format = "%Y/%m/%d %T"), - "DAT Date" = col_date(format = "%Y/%m/%d %T"), - "Pat UPI [C]" = col_character(), - "Pat Date Of Birth [C]" = col_date(format = "%Y/%m/%d %T"), - "Pat Gender Code" = col_double(), - "NHS Board of Residence Code - current" = col_character(), - "Treatment NHS Board Code - current" = col_character(), - "Treatment Location Code" = col_character(), - "GP Practice Code" = col_character(), - "Council Area Code" = col_character(), - "Postcode (epi) [C]" = col_character(), - "Postcode (CHI) [C]" = col_character(), - "HSCP of Residence Code - current" = col_character(), - "Arrival Time" = col_time(""), - "DAT Time" = col_time(""), - "Arrival Mode Code" = col_character(), - "Referral Source Code" = col_character(), - "Attendance Category Code" = col_character(), - "Discharge Destination Code" = col_character(), - "Patient Flow Code" = col_double(), - "Place of Incident Code" = col_character(), - "Reason for Wait Code" = col_character(), - "Disease 1 Code" = col_character(), - "Disease 2 Code" = col_character(), - "Disease 3 Code" = col_character(), - "Bodily Location Of Injury Code" = col_character(), - "Alcohol Involved Code" = col_character(), - "Alcohol Related Admission" = col_character(), - "Substance Misuse Related Admission" = col_character(), - "Falls Related Admission" = col_character(), - "Self Harm Related Admission" = col_character(), - "Total Net Costs" = col_double(), - "Age at Midpoint of Financial Year" = col_double(), - "Case Reference Number" = col_character(), - "Significant Facility Code" = col_character() + col_type = readr::cols( + "Arrival Date" = readr::col_date(format = "%Y/%m/%d %T"), + "DAT Date" = readr::col_date(format = "%Y/%m/%d %T"), + "Pat UPI [C]" = readr::col_character(), + "Pat Date Of Birth [C]" = readr::col_date(format = "%Y/%m/%d %T"), + "Pat Gender Code" = readr::col_double(), + "NHS Board of Residence Code - current" = readr::col_character(), + "Treatment NHS Board Code - current" = readr::col_character(), + "Treatment Location Code" = readr::col_character(), + "GP Practice Code" = readr::col_character(), + "Council Area Code" = readr::col_character(), + "Postcode (epi) [C]" = readr::col_character(), + "Postcode (CHI) [C]" = readr::col_character(), + "HSCP of Residence Code - current" = readr::col_character(), + "Arrival Time" = readr::col_time(""), + "DAT Time" = readr::col_time(""), + "Arrival Mode Code" = readr::col_character(), + "Referral Source Code" = readr::col_character(), + "Attendance Category Code" = readr::col_character(), + "Discharge Destination Code" = readr::col_character(), + "Patient Flow Code" = readr::col_double(), + "Place of Incident Code" = readr::col_character(), + "Reason for Wait Code" = readr::col_character(), + "Disease 1 Code" = readr::col_character(), + "Disease 2 Code" = readr::col_character(), + "Disease 3 Code" = readr::col_character(), + "Bodily Location Of Injury Code" = readr::col_character(), + "Alcohol Involved Code" = readr::col_character(), + "Alcohol Related Admission" = readr::col_character(), + "Substance Misuse Related Admission" = readr::col_character(), + "Falls Related Admission" = readr::col_character(), + "Self Harm Related Admission" = readr::col_character(), + "Total Net Costs" = readr::col_double(), + "Age at Midpoint of Financial Year" = readr::col_double(), + "Case Reference Number" = readr::col_character(), + "Significant Facility Code" = readr::col_character() ) ) %>% # rename variables diff --git a/R/read_extract_cmh.R b/R/read_extract_cmh.R index 16151bd43..da627a67a 100644 --- a/R/read_extract_cmh.R +++ b/R/read_extract_cmh.R @@ -13,24 +13,24 @@ read_extract_cmh <- function( # Read BOXI extract extract_cmh <- read_file(file_path, - col_types = cols_only( - "UPI Number [C]" = col_character(), - "Patient DoB Date [C]" = col_date(format = "%Y/%m/%d %T"), - "Gender" = col_double(), - "Patient Postcode [C]" = col_character(), - "NHS Board of Residence Code 9" = col_character(), - "Patient HSCP Code - current" = col_character(), - "Practice Code" = col_integer(), - "Treatment NHS Board Code 9" = col_character(), - "Contact Date" = col_date(format = "%Y/%m/%d %T"), - "Contact Start Time" = col_time(format = "%T"), - "Duration of Contact" = col_integer(), - "Location of Contact" = col_character(), - "Main Aim of Contact" = col_character(), - "Other Aim of Contact (1)" = col_character(), - "Other Aim of Contact (2)" = col_character(), - "Other Aim of Contact (3)" = col_character(), - "Other Aim of Contact (4)" = col_character() + col_types = readr::cols_only( + "UPI Number [C]" = readr::col_character(), + "Patient DoB Date [C]" = readr::col_date(format = "%Y/%m/%d %T"), + "Gender" = readr::col_double(), + "Patient Postcode [C]" = readr::col_character(), + "NHS Board of Residence Code 9" = readr::col_character(), + "Patient HSCP Code - current" = readr::col_character(), + "Practice Code" = readr::col_integer(), + "Treatment NHS Board Code 9" = readr::col_character(), + "Contact Date" = readr::col_date(format = "%Y/%m/%d %T"), + "Contact Start Time" = readr::col_time(format = "%T"), + "Duration of Contact" = readr::col_integer(), + "Location of Contact" = readr::col_character(), + "Main Aim of Contact" = readr::col_character(), + "Other Aim of Contact (1)" = readr::col_character(), + "Other Aim of Contact (2)" = readr::col_character(), + "Other Aim of Contact (3)" = readr::col_character(), + "Other Aim of Contact (4)" = readr::col_character() ) ) %>% # rename diff --git a/R/read_extract_district_nursing.R b/R/read_extract_district_nursing.R index 607f9b47e..e84856586 100644 --- a/R/read_extract_district_nursing.R +++ b/R/read_extract_district_nursing.R @@ -12,25 +12,25 @@ read_extract_district_nursing <- function( # Read BOXI extract extract_district_nursing <- read_file(file_path, - col_types = cols_only( - `Treatment NHS Board Code 9` = col_character(), - `Age at Contact Date` = col_integer(), - `Contact Date` = col_date(format = "%Y/%m/%d %T"), - `Primary Intervention Category` = col_character(), - `Other Intervention Category (1)` = col_character(), - `Other Intervention Category (2)` = col_character(), - `UPI Number [C]` = col_character(), - `Patient DoB Date [C]` = col_date(format = "%Y/%m/%d %T"), - `Patient Postcode [C] (Contact)` = col_character(), - `Duration of Contact (measure)` = col_double(), - Gender = col_double(), - `Location of Contact` = col_character(), - `Practice NHS Board Code 9 (Contact)` = col_character(), - `Patient Council Area Code (Contact)` = col_character(), - `Practice Code (Contact)` = col_character(), - `NHS Board of Residence Code 9 (Contact)` = col_character(), - `HSCP of Residence Code (Contact)` = col_character(), - `Patient Data Zone 2011 (Contact)` = col_character() + col_types = readr::cols_only( + `Treatment NHS Board Code 9` = readr::col_character(), + `Age at Contact Date` = readr::col_integer(), + `Contact Date` = readr::col_date(format = "%Y/%m/%d %T"), + `Primary Intervention Category` = readr::col_character(), + `Other Intervention Category (1)` = readr::col_character(), + `Other Intervention Category (2)` = readr::col_character(), + `UPI Number [C]` = readr::col_character(), + `Patient DoB Date [C]` = readr::col_date(format = "%Y/%m/%d %T"), + `Patient Postcode [C] (Contact)` = readr::col_character(), + `Duration of Contact (measure)` = readr::col_double(), + Gender = readr::col_double(), + `Location of Contact` = readr::col_character(), + `Practice NHS Board Code 9 (Contact)` = readr::col_character(), + `Patient Council Area Code (Contact)` = readr::col_character(), + `Practice Code (Contact)` = readr::col_character(), + `NHS Board of Residence Code 9 (Contact)` = readr::col_character(), + `HSCP of Residence Code (Contact)` = readr::col_character(), + `Patient Data Zone 2011 (Contact)` = readr::col_character() ) ) %>% # rename diff --git a/R/read_extract_homelessness.R b/R/read_extract_homelessness.R index 32b7d6e86..64ebb639e 100644 --- a/R/read_extract_homelessness.R +++ b/R/read_extract_homelessness.R @@ -13,29 +13,29 @@ read_extract_homelessness <- function( extract_homelessness <- read_file(file_path, col_types = cols( - "Assessment Decision Date" = col_date(format = "%Y/%m/%d %T"), - "Case Closed Date" = col_date(format = "%Y/%m/%d %T"), - "Sending Local Authority Code 9" = col_character(), - "Client Unique Identifier" = col_character(), - "UPI Number [C]" = col_character(), - "Client DoB Date [C]" = col_date(format = "%Y/%m/%d %T"), - "Age at Assessment Decision Date" = col_integer(), - "Gender Code" = col_integer(), - "Client Postcode [C]" = col_character(), - "Main Applicant Flag" = col_character(), - "Application Reference Number" = col_character(), - "Property Type Code" = col_integer(), - "Financial Difficulties / Debt / Unemployment" = col_integer(), - "Physical Health Reasons" = col_integer(), - "Mental Health Reasons" = col_integer(), - "Unmet Need for Support from Housing / Social Work / Health Services" = col_integer(), - "Lack of Support from Friends / Family" = col_integer(), - "Difficulties Managing on Own" = col_integer(), - "Drug / Alcohol Dependency" = col_integer(), - "Criminal / Anti-Social Behaviour" = col_integer(), - "Not to do with Applicant Household" = col_integer(), - "Refused" = col_integer(), - "Person in Receipt of Universal Credit" = col_integer() + "Assessment Decision Date" = readr::col_date(format = "%Y/%m/%d %T"), + "Case Closed Date" = readr::col_date(format = "%Y/%m/%d %T"), + "Sending Local Authority Code 9" = readr::col_character(), + "Client Unique Identifier" = readr::col_character(), + "UPI Number [C]" = readr::col_character(), + "Client DoB Date [C]" = readr::col_date(format = "%Y/%m/%d %T"), + "Age at Assessment Decision Date" = readr::col_integer(), + "Gender Code" = readr::col_integer(), + "Client Postcode [C]" = readr::col_character(), + "Main Applicant Flag" = readr::col_character(), + "Application Reference Number" = readr::col_character(), + "Property Type Code" = readr::col_integer(), + "Financial Difficulties / Debt / Unemployment" = readr::col_integer(), + "Physical Health Reasons" = readr::col_integer(), + "Mental Health Reasons" = readr::col_integer(), + "Unmet Need for Support from Housing / Social Work / Health Services" = readr::col_integer(), + "Lack of Support from Friends / Family" = readr::col_integer(), + "Difficulties Managing on Own" = readr::col_integer(), + "Drug / Alcohol Dependency" = readr::col_integer(), + "Criminal / Anti-Social Behaviour" = readr::col_integer(), + "Not to do with Applicant Household" = readr::col_integer(), + "Refused" = readr::col_integer(), + "Person in Receipt of Universal Credit" = readr::col_integer() ) ) %>% dplyr::rename( diff --git a/R/read_extract_maternity.R b/R/read_extract_maternity.R index 49bda2fb5..d92295690 100644 --- a/R/read_extract_maternity.R +++ b/R/read_extract_maternity.R @@ -8,60 +8,60 @@ read_extract_maternity <- function( file_path = get_boxi_extract_path(year = year, type = "Maternity")) { # Read BOXI extract extract_maternity <- read_file(file_path, - col_type = cols( - "Costs Financial Year" = col_double(), - "Date of Admission Full Date" = col_date(format = "%Y/%m/%d %T"), - "Date of Discharge Full Date" = col_date(format = "%Y/%m/%d %T"), - "Pat UPI [C]" = col_character(), - "Pat Date Of Birth [C]" = col_date(format = "%Y/%m/%d %T"), - "Practice Location Code" = col_character(), - "Practice NHS Board Code - current" = col_character(), - "Geo Postcode [C]" = col_character(), - "NHS Board of Residence Code - current" = col_character(), - "HSCP of Residence Code - current" = col_character(), - "Geo Council Area Code" = col_character(), - "Treatment Location Code" = col_character(), - "Treatment NHS Board Code - current" = col_character(), - "Occupied Bed Days" = col_double(), - "Specialty Classification 1/4/97 Code" = col_character(), - "Significant Facility Code" = col_character(), - "Consultant/HCP Code" = col_character(), - "Management of Patient Code" = col_character(), - "Admission Reason Code" = col_character(), - "Admitted/Transfer from Code (new)" = col_character(), - "Admitted/transfer from - Location Code" = col_character(), - "Discharge Type Code" = col_character(), - "Discharge/Transfer to Code (new)" = col_character(), - "Discharged to - Location Code" = col_character(), - "Condition On Discharge Code" = col_double(), - "Continuous Inpatient Journey Marker" = col_double(), - "CIJ Planned Admission Code" = col_double(), - "CIJ Inpatient Day Case Identifier Code" = col_character(), - "CIJ Type of Admission Code" = col_character(), - "CIJ Admission Specialty Code" = col_character(), - "CIJ Discharge Specialty Code" = col_character(), - "CIJ Start Date" = col_date(format = "%Y/%m/%d %T"), - "CIJ End Date" = col_date(format = "%Y/%m/%d %T"), - "Total Net Costs" = col_double(), - "Diagnosis 1 Discharge Code" = col_character(), - "Diagnosis 2 Discharge Code" = col_character(), - "Diagnosis 3 Discharge Code" = col_character(), - "Diagnosis 4 Discharge Code" = col_character(), - "Diagnosis 5 Discharge Code" = col_character(), - "Diagnosis 6 Discharge Code" = col_character(), - "Operation 1A Code" = col_character(), - "Operation 2A Code" = col_character(), - "Operation 3A Code" = col_character(), - "Operation 4A Code" = col_character(), - "Date of Main Operation Full Date" = col_date(format = "%Y/%m/%d %T"), - "Age at Midpoint of Financial Year" = col_double(), - "NHS Hospital Flag" = col_character(), - "Community Hospital Flag" = col_character(), - "Alcohol Related AdmissioN" = col_character(), - "Substance Misuse Related Admission" = col_character(), - "Falls Related Admission" = col_character(), - "Self Harm Related Admission" = col_character(), - "Maternity Unique Record Identifier [C]" = col_character() + col_type = readr::cols( + "Costs Financial Year" = readr::col_double(), + "Date of Admission Full Date" = readr::col_date(format = "%Y/%m/%d %T"), + "Date of Discharge Full Date" = readr::col_date(format = "%Y/%m/%d %T"), + "Pat UPI [C]" = readr::col_character(), + "Pat Date Of Birth [C]" = readr::col_date(format = "%Y/%m/%d %T"), + "Practice Location Code" = readr::col_character(), + "Practice NHS Board Code - current" = readr::col_character(), + "Geo Postcode [C]" = readr::col_character(), + "NHS Board of Residence Code - current" = readr::col_character(), + "HSCP of Residence Code - current" = readr::col_character(), + "Geo Council Area Code" = readr::col_character(), + "Treatment Location Code" = readr::col_character(), + "Treatment NHS Board Code - current" = readr::col_character(), + "Occupied Bed Days" = readr::col_double(), + "Specialty Classification 1/4/97 Code" = readr::col_character(), + "Significant Facility Code" = readr::col_character(), + "Consultant/HCP Code" = readr::col_character(), + "Management of Patient Code" = readr::col_character(), + "Admission Reason Code" = readr::col_character(), + "Admitted/Transfer from Code (new)" = readr::col_character(), + "Admitted/transfer from - Location Code" = readr::col_character(), + "Discharge Type Code" = readr::col_character(), + "Discharge/Transfer to Code (new)" = readr::col_character(), + "Discharged to - Location Code" = readr::col_character(), + "Condition On Discharge Code" = readr::col_double(), + "Continuous Inpatient Journey Marker" = readr::col_double(), + "CIJ Planned Admission Code" = readr::col_double(), + "CIJ Inpatient Day Case Identifier Code" = readr::col_character(), + "CIJ Type of Admission Code" = readr::col_character(), + "CIJ Admission Specialty Code" = readr::col_character(), + "CIJ Discharge Specialty Code" = readr::col_character(), + "CIJ Start Date" = readr::col_date(format = "%Y/%m/%d %T"), + "CIJ End Date" = readr::col_date(format = "%Y/%m/%d %T"), + "Total Net Costs" = readr::col_double(), + "Diagnosis 1 Discharge Code" = readr::col_character(), + "Diagnosis 2 Discharge Code" = readr::col_character(), + "Diagnosis 3 Discharge Code" = readr::col_character(), + "Diagnosis 4 Discharge Code" = readr::col_character(), + "Diagnosis 5 Discharge Code" = readr::col_character(), + "Diagnosis 6 Discharge Code" = readr::col_character(), + "Operation 1A Code" = readr::col_character(), + "Operation 2A Code" = readr::col_character(), + "Operation 3A Code" = readr::col_character(), + "Operation 4A Code" = readr::col_character(), + "Date of Main Operation Full Date" = readr::col_date(format = "%Y/%m/%d %T"), + "Age at Midpoint of Financial Year" = readr::col_double(), + "NHS Hospital Flag" = readr::col_character(), + "Community Hospital Flag" = readr::col_character(), + "Alcohol Related AdmissioN" = readr::col_character(), + "Substance Misuse Related Admission" = readr::col_character(), + "Falls Related Admission" = readr::col_character(), + "Self Harm Related Admission" = readr::col_character(), + "Maternity Unique Record Identifier [C]" = readr::col_character() ) ) %>% # Rename variables in line with SLF variable names diff --git a/R/read_extract_mental_health.R b/R/read_extract_mental_health.R index 248316975..fa236ecb1 100644 --- a/R/read_extract_mental_health.R +++ b/R/read_extract_mental_health.R @@ -8,64 +8,64 @@ read_extract_mental_health <- function( file_path = get_boxi_extract_path(year = year, type = "MH")) { # Read BOXI extract extract_mental_health <- read_file(file_path, - col_types = cols_only( - "Costs Financial Year (04)" = col_double(), - "Costs Financial Month Number (04)" = col_double(), - "Date of Admission(04)" = col_date(format = "%Y/%m/%d %T"), - "Date of Discharge(04)" = col_date(format = "%Y/%m/%d %T"), - "Pat UPI" = col_character(), - "Pat Gender Code" = col_integer(), - "Pat Date Of Birth [C]" = col_date(format = "%Y/%m/%d %T"), - "Practice Location Code" = col_character(), - "Practice NHS Board Code - current" = col_character(), - "Geo Postcode [C]" = col_character(), - "NHS Board of Residence Code - current" = col_character(), - "Geo Council Area Code" = col_character(), - "Geo HSCP of Residence Code - current" = col_character(), - "Geo Data Zone 2011" = col_character(), - "Treatment Location Code" = col_character(), - "Treatment NHS Board Code - current" = col_character(), - "Occupied Bed Days (04)" = col_double(), - "Specialty Classificat. 1/4/97 Code" = col_character(), - "Significant Facility Code" = col_character(), - "Lead Consultant/HCP Code" = col_character(), - "Management of Patient Code" = col_character(), - "Patient Category Code" = col_character(), - "Admission Type Code" = col_character(), - "Admitted Trans From Code" = col_character(), - "Location Admitted Trans From Code" = col_character(), - "Discharge Type Code" = col_character(), - "Discharge Trans To Code" = col_character(), - "Location Discharged Trans To Code" = col_character(), - "Diagnosis 1 Code (6 char)" = col_character(), - "Diagnosis 2 Code (6 char)" = col_character(), - "Diagnosis 3 Code (6 char)" = col_character(), - "Diagnosis 4 Code (6 char)" = col_character(), - "Diagnosis 5 Code (6 char)" = col_character(), - "Diagnosis 6 Code (6 char)" = col_character(), - "Status on Admission Code" = col_integer(), - "Admission Diagnosis 1 Code (6 char)" = col_character(), - "Admission Diagnosis 2 Code (6 char)" = col_character(), - "Admission Diagnosis 3 Code (6 char)" = col_character(), - "Admission Diagnosis 4 Code (6 char)" = col_character(), - "Age at Midpoint of Financial Year (04)" = col_integer(), - "Continuous Inpatient Journey Marker (04)" = col_integer(), - "CIJ Planned Admission Code (04)" = col_integer(), - "CIJ Inpatient Day Case Identifier Code (04)" = col_character(), - "CIJ Type of Admission Code (04)" = col_character(), - "CIJ Admission Specialty Code (04)" = col_character(), - "CIJ Discharge Specialty Code (04)" = col_character(), - "CIJ Start Date (04)" = col_date(format = "%Y/%m/%d %T"), - "CIJ End Date (04)" = col_date(format = "%Y/%m/%d %T"), - "Total Net Costs (04)" = col_double(), - "Alcohol Related Admission (04)" = col_factor(levels = c("Y", "N")), - "Substance Misuse Related Admission (04)" = col_factor(levels = c("Y", "N")), - "Falls Related Admission (04)" = col_factor(levels = c("Y", "N")), - "Self Harm Related Admission (04)" = col_factor(levels = c("Y", "N")), - "Duplicate Record Flag (04)" = col_factor(levels = c("Y", "N")), - "NHS Hospital Flag (04)" = col_factor(levels = c("Y", "N")), - "Community Hospital Flag (04)" = col_factor(levels = c("Y", "N")), - "Unique Record Identifier" = col_character() + col_types = readr::cols_only( + "Costs Financial Year (04)" = readr::col_double(), + "Costs Financial Month Number (04)" = readr::col_double(), + "Date of Admission(04)" = readr::col_date(format = "%Y/%m/%d %T"), + "Date of Discharge(04)" = readr::col_date(format = "%Y/%m/%d %T"), + "Pat UPI" = readr::col_character(), + "Pat Gender Code" = readr::col_integer(), + "Pat Date Of Birth [C]" = readr::col_date(format = "%Y/%m/%d %T"), + "Practice Location Code" = readr::col_character(), + "Practice NHS Board Code - current" = readr::col_character(), + "Geo Postcode [C]" = readr::col_character(), + "NHS Board of Residence Code - current" = readr::col_character(), + "Geo Council Area Code" = readr::col_character(), + "Geo HSCP of Residence Code - current" = readr::col_character(), + "Geo Data Zone 2011" = readr::col_character(), + "Treatment Location Code" = readr::col_character(), + "Treatment NHS Board Code - current" = readr::col_character(), + "Occupied Bed Days (04)" = readr::col_double(), + "Specialty Classificat. 1/4/97 Code" = readr::col_character(), + "Significant Facility Code" = readr::col_character(), + "Lead Consultant/HCP Code" = readr::col_character(), + "Management of Patient Code" = readr::col_character(), + "Patient Category Code" = readr::col_character(), + "Admission Type Code" = readr::col_character(), + "Admitted Trans From Code" = readr::col_character(), + "Location Admitted Trans From Code" = readr::col_character(), + "Discharge Type Code" = readr::col_character(), + "Discharge Trans To Code" = readr::col_character(), + "Location Discharged Trans To Code" = readr::col_character(), + "Diagnosis 1 Code (6 char)" = readr::col_character(), + "Diagnosis 2 Code (6 char)" = readr::col_character(), + "Diagnosis 3 Code (6 char)" = readr::col_character(), + "Diagnosis 4 Code (6 char)" = readr::col_character(), + "Diagnosis 5 Code (6 char)" = readr::col_character(), + "Diagnosis 6 Code (6 char)" = readr::col_character(), + "Status on Admission Code" = readr::col_integer(), + "Admission Diagnosis 1 Code (6 char)" = readr::col_character(), + "Admission Diagnosis 2 Code (6 char)" = readr::col_character(), + "Admission Diagnosis 3 Code (6 char)" = readr::col_character(), + "Admission Diagnosis 4 Code (6 char)" = readr::col_character(), + "Age at Midpoint of Financial Year (04)" = readr::col_integer(), + "Continuous Inpatient Journey Marker (04)" = readr::col_integer(), + "CIJ Planned Admission Code (04)" = readr::col_integer(), + "CIJ Inpatient Day Case Identifier Code (04)" = readr::col_character(), + "CIJ Type of Admission Code (04)" = readr::col_character(), + "CIJ Admission Specialty Code (04)" = readr::col_character(), + "CIJ Discharge Specialty Code (04)" = readr::col_character(), + "CIJ Start Date (04)" = readr::col_date(format = "%Y/%m/%d %T"), + "CIJ End Date (04)" = readr::col_date(format = "%Y/%m/%d %T"), + "Total Net Costs (04)" = readr::col_double(), + "Alcohol Related Admission (04)" = readr::col_factor(levels = c("Y", "N")), + "Substance Misuse Related Admission (04)" = readr::col_factor(levels = c("Y", "N")), + "Falls Related Admission (04)" = readr::col_factor(levels = c("Y", "N")), + "Self Harm Related Admission (04)" = readr::col_factor(levels = c("Y", "N")), + "Duplicate Record Flag (04)" = readr::col_factor(levels = c("Y", "N")), + "NHS Hospital Flag (04)" = readr::col_factor(levels = c("Y", "N")), + "Community Hospital Flag (04)" = readr::col_factor(levels = c("Y", "N")), + "Unique Record Identifier" = readr::col_character() ) ) %>% # rename variables diff --git a/R/read_extract_nrs_deaths.R b/R/read_extract_nrs_deaths.R index 1734b23aa..efcc0f148 100644 --- a/R/read_extract_nrs_deaths.R +++ b/R/read_extract_nrs_deaths.R @@ -7,33 +7,33 @@ read_extract_nrs_deaths <- function( year, file_path = get_boxi_extract_path(year = year, type = "Deaths")) { extract_nrs_deaths <- read_file(file_path, - col_types = cols_only( - "Death Location Code" = col_character(), - "Geo Council Area Code" = col_character(), - "Geo Data Zone 2011" = col_character(), - "Geo Postcode [C]" = col_character(), - "Geo HSCP of Residence Code - current" = col_character(), - "NHS Board of Occurrence Code - current" = col_character(), - "NHS Board of Residence Code - current" = col_character(), - "Pat Date Of Birth [C]" = col_date(format = "%Y/%m/%d %T"), - "Date of Death(99)" = col_date(format = "%Y/%m/%d %T"), - "Pat Gender Code" = col_double(), - "Pat UPI" = col_character(), - "Place Death Occurred Code" = col_character(), - "Post Mortem Code" = col_character(), - "Prim Cause of Death Code (6 char)" = col_character(), - "Sec Cause of Death 0 Code (6 char)" = col_character(), - "Sec Cause of Death 1 Code (6 char)" = col_character(), - "Sec Cause of Death 2 Code (6 char)" = col_character(), - "Sec Cause of Death 3 Code (6 char)" = col_character(), - "Sec Cause of Death 4 Code (6 char)" = col_character(), - "Sec Cause of Death 5 Code (6 char)" = col_character(), - "Sec Cause of Death 6 Code (6 char)" = col_character(), - "Sec Cause of Death 7 Code (6 char)" = col_character(), - "Sec Cause of Death 8 Code (6 char)" = col_character(), - "Sec Cause of Death 9 Code (6 char)" = col_character(), - "Unique Record Identifier" = col_character(), - "GP practice code(99)" = col_character() + col_types = readr::cols_only( + "Death Location Code" = readr::col_character(), + "Geo Council Area Code" = readr::col_character(), + "Geo Data Zone 2011" = readr::col_character(), + "Geo Postcode [C]" = readr::col_character(), + "Geo HSCP of Residence Code - current" = readr::col_character(), + "NHS Board of Occurrence Code - current" = readr::col_character(), + "NHS Board of Residence Code - current" = readr::col_character(), + "Pat Date Of Birth [C]" = readr::col_date(format = "%Y/%m/%d %T"), + "Date of Death(99)" = readr::col_date(format = "%Y/%m/%d %T"), + "Pat Gender Code" = readr::col_double(), + "Pat UPI" = readr::col_character(), + "Place Death Occurred Code" = readr::col_character(), + "Post Mortem Code" = readr::col_character(), + "Prim Cause of Death Code (6 char)" = readr::col_character(), + "Sec Cause of Death 0 Code (6 char)" = readr::col_character(), + "Sec Cause of Death 1 Code (6 char)" = readr::col_character(), + "Sec Cause of Death 2 Code (6 char)" = readr::col_character(), + "Sec Cause of Death 3 Code (6 char)" = readr::col_character(), + "Sec Cause of Death 4 Code (6 char)" = readr::col_character(), + "Sec Cause of Death 5 Code (6 char)" = readr::col_character(), + "Sec Cause of Death 6 Code (6 char)" = readr::col_character(), + "Sec Cause of Death 7 Code (6 char)" = readr::col_character(), + "Sec Cause of Death 8 Code (6 char)" = readr::col_character(), + "Sec Cause of Death 9 Code (6 char)" = readr::col_character(), + "Unique Record Identifier" = readr::col_character(), + "GP practice code(99)" = readr::col_character() ) ) %>% dplyr::rename( diff --git a/R/read_extract_outpatients.R b/R/read_extract_outpatients.R index 44e02ca97..20b4880bf 100644 --- a/R/read_extract_outpatients.R +++ b/R/read_extract_outpatients.R @@ -8,42 +8,42 @@ read_extract_outpatients <- function( file_path = get_boxi_extract_path(year = year, type = "Outpatient")) { # Read BOXI extract extract_outpatients <- read_file(file_path, - col_type = cols( - "Clinic Date Fin Year" = col_double(), - "Clinic Date (00)" = col_date(format = "%Y/%m/%d %T"), - "Episode Record Key (SMR00) [C]" = col_character(), - "Pat UPI" = col_character(), - "Pat Gender Code" = col_double(), - "Pat Date Of Birth [C]" = col_date(format = "%Y/%m/%d %T"), - "Practice Location Code" = col_character(), - "Practice NHS Board Code - current" = col_character(), - "Geo Postcode [C]" = col_character(), - "NHS Board of Residence Code - current" = col_character(), - "Geo Council Area Code" = col_character(), - "Treatment Location Code" = col_character(), - "Treatment NHS Board Code - current" = col_character(), - "Operation 1A Code (4 char)" = col_character(), - "Operation 1B Code (4 char)" = col_character(), - "Date of Main Operation(00)" = col_date(format = "%Y/%m/%d %T"), - "Operation 2A Code (4 char)" = col_character(), - "Operation 2B Code (4 char)" = col_character(), - "Date of Operation 2 (00)" = col_date(format = "%Y/%m/%d %T"), - "Specialty Classificat. 1/4/97 Code" = col_character(), - "Significant Facility Code" = col_character(), - "Consultant/HCP Code" = col_character(), - "Patient Category Code" = col_character(), - "Referral Source Code" = col_character(), - "Referral Type Code" = col_double(), - "Clinic Type Code" = col_double(), - "Clinic Attendance (Status) Code" = col_double(), - "Age at Midpoint of Financial Year" = col_double(), - "Alcohol Related Admission" = col_character(), - "Substance Misuse Related Admission" = col_character(), - "Falls Related Admission" = col_character(), - "Self Harm Related Admission" = col_character(), - "NHS Hospital Flag" = col_character(), - "Community Hospital Flag" = col_character(), - "Total Net Costs" = col_double() + col_type = readr::cols( + "Clinic Date Fin Year" = readr::col_double(), + "Clinic Date (00)" = readr::col_date(format = "%Y/%m/%d %T"), + "Episode Record Key (SMR00) [C]" = readr::col_character(), + "Pat UPI" = readr::col_character(), + "Pat Gender Code" = readr::col_double(), + "Pat Date Of Birth [C]" = readr::col_date(format = "%Y/%m/%d %T"), + "Practice Location Code" = readr::col_character(), + "Practice NHS Board Code - current" = readr::col_character(), + "Geo Postcode [C]" = readr::col_character(), + "NHS Board of Residence Code - current" = readr::col_character(), + "Geo Council Area Code" = readr::col_character(), + "Treatment Location Code" = readr::col_character(), + "Treatment NHS Board Code - current" = readr::col_character(), + "Operation 1A Code (4 char)" = readr::col_character(), + "Operation 1B Code (4 char)" = readr::col_character(), + "Date of Main Operation(00)" = readr::col_date(format = "%Y/%m/%d %T"), + "Operation 2A Code (4 char)" = readr::col_character(), + "Operation 2B Code (4 char)" = readr::col_character(), + "Date of Operation 2 (00)" = readr::col_date(format = "%Y/%m/%d %T"), + "Specialty Classificat. 1/4/97 Code" = readr::col_character(), + "Significant Facility Code" = readr::col_character(), + "Consultant/HCP Code" = readr::col_character(), + "Patient Category Code" = readr::col_character(), + "Referral Source Code" = readr::col_character(), + "Referral Type Code" = readr::col_double(), + "Clinic Type Code" = readr::col_double(), + "Clinic Attendance (Status) Code" = readr::col_double(), + "Age at Midpoint of Financial Year" = readr::col_double(), + "Alcohol Related Admission" = readr::col_character(), + "Substance Misuse Related Admission" = readr::col_character(), + "Falls Related Admission" = readr::col_character(), + "Self Harm Related Admission" = readr::col_character(), + "NHS Hospital Flag" = readr::col_character(), + "Community Hospital Flag" = readr::col_character(), + "Total Net Costs" = readr::col_double() ) ) %>% # Rename variables diff --git a/R/read_extract_prescribing.R b/R/read_extract_prescribing.R index 4f834a44e..683484473 100644 --- a/R/read_extract_prescribing.R +++ b/R/read_extract_prescribing.R @@ -5,14 +5,14 @@ #' @export read_extract_prescribing <- function(year, file_path = get_it_prescribing_path(year)) { pis_file <- read_file(file_path, - col_type = cols_only( - "Pat UPI [C]" = col_character(), - "Pat DoB [C]" = col_date(format = "%d-%m-%Y"), - "Pat Gender" = col_double(), - "Pat Postcode [C]" = col_character(), - "Practice Code" = col_character(), - "Number of Paid Items" = col_double(), - "PD Paid GIC excl. BB" = col_double() + col_type = readr::cols_only( + "Pat UPI [C]" = readr::col_character(), + "Pat DoB [C]" = readr::col_date(format = "%d-%m-%Y"), + "Pat Gender" = readr::col_double(), + "Pat Postcode [C]" = readr::col_character(), + "Practice Code" = readr::col_character(), + "Number of Paid Items" = readr::col_double(), + "PD Paid GIC excl. BB" = readr::col_double() ) ) %>% # Rename variables diff --git a/R/read_it_chi_deaths.R b/R/read_it_chi_deaths.R index 35f502c60..aab56c86d 100644 --- a/R/read_it_chi_deaths.R +++ b/R/read_it_chi_deaths.R @@ -8,10 +8,10 @@ #' @family process extracts read_it_chi_deaths <- function(file_path = get_it_deaths_path()) { it_chi_deaths <- read_file(file_path, - col_type = cols( - "PATIENT_UPI [C]" = col_character(), - "PATIENT DoD DATE (NRS)" = col_date(format = "%d-%m-%Y"), - "PATIENT DoD DATE (CHI)" = col_date(format = "%d-%m-%Y") + col_type = readr::cols( + "PATIENT_UPI [C]" = readr::col_character(), + "PATIENT DoD DATE (NRS)" = readr::col_date(format = "%d-%m-%Y"), + "PATIENT DoD DATE (CHI)" = readr::col_date(format = "%d-%m-%Y") ) ) %>% dplyr::rename( diff --git a/R/read_lookup_ltc.R b/R/read_lookup_ltc.R index 0a1ce5957..7eb83a434 100644 --- a/R/read_lookup_ltc.R +++ b/R/read_lookup_ltc.R @@ -9,28 +9,28 @@ read_lookup_ltc <- function(file_path = get_it_ltc_path()) { # Read data------------------------------------------------ ltc_file <- read_file( file_path, - col_type = cols( - "PATIENT_UPI [C]" = col_character(), - "PATIENT_POSTCODE [C]" = col_character(), - "ARTHRITIS_DIAG_DATE" = col_date(format = "%d-%m-%Y"), - "ASTHMA_DIAG_DATE" = col_date(format = "%d-%m-%Y"), - "ATRIAL_FIB_DIAG_DATE" = col_date(format = "%d-%m-%Y"), - "CANCER_DIAG_DATE" = col_date(format = "%d-%m-%Y"), - "CEREBROVASC_DIS_DIAG_DATE" = col_date(format = "%d-%m-%Y"), - "CHRON_LIVER_DIS_DIAG_DATE" = col_date(format = "%d-%m-%Y"), - "COPD_DIAG_DATE" = col_date(format = "%d-%m-%Y"), - "DEMENTIA_DIAG_DATE" = col_date(format = "%d-%m-%Y"), - "DIABETES_DIAG_DATE" = col_date(format = "%d-%m-%Y"), - "EPILEPSY_DIAG_DATE" = col_date(format = "%d-%m-%Y"), - "HEART_DISEASE_DIAG_DATE" = col_date(format = "%d-%m-%Y"), - "HEART_FAILURE_DIAG_DATE" = col_date(format = "%d-%m-%Y"), - "MULT_SCLEROSIS_DIAG_DATE" = col_date(format = "%d-%m-%Y"), - "PARKINSONS_DIAG_DATE" = col_date(format = "%d-%m-%Y"), - "RENAL_FAILURE_DIAG_DATE" = col_date(format = "%d-%m-%Y"), - "CONGENITAL_PROB_DIAG_DATE" = col_date(format = "%d-%m-%Y"), - "BLOOD_AND_BFO_DIAG_DATE" = col_date(format = "%d-%m-%Y"), - "OTH_DIS_END_MET_DIAG_DATE" = col_date(format = "%d-%m-%Y"), - "OTH_DIS_DIG_SYS_DIAG_DATE" = col_date(format = "%d-%m-%Y") + col_type = readr::cols( + "PATIENT_UPI [C]" = readr::col_character(), + "PATIENT_POSTCODE [C]" = readr::col_character(), + "ARTHRITIS_DIAG_DATE" = readr::col_date(format = "%d-%m-%Y"), + "ASTHMA_DIAG_DATE" = readr::col_date(format = "%d-%m-%Y"), + "ATRIAL_FIB_DIAG_DATE" = readr::col_date(format = "%d-%m-%Y"), + "CANCER_DIAG_DATE" = readr::col_date(format = "%d-%m-%Y"), + "CEREBROVASC_DIS_DIAG_DATE" = readr::col_date(format = "%d-%m-%Y"), + "CHRON_LIVER_DIS_DIAG_DATE" = readr::col_date(format = "%d-%m-%Y"), + "COPD_DIAG_DATE" = readr::col_date(format = "%d-%m-%Y"), + "DEMENTIA_DIAG_DATE" = readr::col_date(format = "%d-%m-%Y"), + "DIABETES_DIAG_DATE" = readr::col_date(format = "%d-%m-%Y"), + "EPILEPSY_DIAG_DATE" = readr::col_date(format = "%d-%m-%Y"), + "HEART_DISEASE_DIAG_DATE" = readr::col_date(format = "%d-%m-%Y"), + "HEART_FAILURE_DIAG_DATE" = readr::col_date(format = "%d-%m-%Y"), + "MULT_SCLEROSIS_DIAG_DATE" = readr::col_date(format = "%d-%m-%Y"), + "PARKINSONS_DIAG_DATE" = readr::col_date(format = "%d-%m-%Y"), + "RENAL_FAILURE_DIAG_DATE" = readr::col_date(format = "%d-%m-%Y"), + "CONGENITAL_PROB_DIAG_DATE" = readr::col_date(format = "%d-%m-%Y"), + "BLOOD_AND_BFO_DIAG_DATE" = readr::col_date(format = "%d-%m-%Y"), + "OTH_DIS_END_MET_DIAG_DATE" = readr::col_date(format = "%d-%m-%Y"), + "OTH_DIS_DIG_SYS_DIAG_DATE" = readr::col_date(format = "%d-%m-%Y") ) ) %>% # Rename variables