67 lines
2.1 KiB
R
67 lines
2.1 KiB
R
suppressMessages({
|
|
require(tidyverse)
|
|
require(AMR)
|
|
})
|
|
|
|
source('config.R')
|
|
source('anonymize.R')
|
|
|
|
|
|
# moved from 4D_archive.R
|
|
createAbMapping = function() {
|
|
options(AMR_locale = 'nl')
|
|
abOpm = readxl::read_xlsx('data/ab_glims_2022-09-02.xlsx',
|
|
sheet = 1)
|
|
ab2 = readxl::read_xlsx('ab_glims_2022-09-02.xlsx',
|
|
sheet = 'codes uit Glims 2022-09-02')
|
|
|
|
# first try to retrieve the AB from Naam
|
|
ab2 = ab2 %>%
|
|
select(Mnemonic, Naam, Toelichting) %>%
|
|
mutate(Naam = str_replace(Naam, 'clavulaanzuur', 'clavulanic acid'),
|
|
`EARS-Net.Mnemonic` = as.ab(Naam),
|
|
`EARS-Net.Name` = ab_name(Naam)) %>%
|
|
left_join(abOpm %>% select(name4d, Opm.Greetje), by = c('Mnemonic' = 'name4d'))
|
|
|
|
# secondly, try to retrieve the AB from Mnemonic
|
|
ab2 = ab2 %>%
|
|
mutate(`EARS-Net.Mnemonic` = replace(`EARS-Net.Mnemonic`,
|
|
is.na(`EARS-Net.Mnemonic`),
|
|
as.ab(Mnemonic)),
|
|
`EARS-Net.Name` = replace(`EARS-Net.Name`,
|
|
is.na(`EARS-Net.Name`), ab_name(Mnemonic)))
|
|
}
|
|
|
|
is_icu = function(departmentName) {
|
|
if (!is_empty(departmentName)) {
|
|
departmentName %in%
|
|
c('KINN', 'KINZ', 'KICW', 'KICN', 'KINW', # NICU IC
|
|
'KICG', 'KICR', 'KICB', 'KICK', # Kinder IC
|
|
'THIC', 'ICV2', # old and new name
|
|
'NCIC', 'ICV1', # old and new name
|
|
'E1IC', 'ICV3', # old and new name
|
|
'CICA', 'CICB', 'CICD', 'CHIC', 'ICV4' # old and new name
|
|
)
|
|
} else {
|
|
F
|
|
}
|
|
}
|
|
|
|
is_clinical = function(departmentName) {
|
|
is_icu(departmentName) |
|
|
str_ends(departmentName, 'VA') |
|
|
departmentName %in%
|
|
c('L1SC', 'CIVZ', 'NEUC', 'L1KV', 'OZOK', 'BOA0', 'C1CC', 'BOB0')
|
|
}
|
|
|
|
is_outward = function(departmentName) {
|
|
str_ends(departmentName, 'P') |
|
|
str_detect(departmentName, 'DB')
|
|
}
|
|
|
|
readGlimsFinalResults = function() {
|
|
cat(paste0('Reading ', radarDataFilename, '\n'))
|
|
return(read_rds(radarDataFilename))
|
|
}
|
|
|