Case classification analysis

Author

Raphael Saldanha

Last modification

February 19, 2024 | 10:01:36 +01:00

This is a descriptive report about dengue case classification and criteria.

Packages

library(tidyverse)
library(arrow)
library(knitr)
library(lubridate)
source("../functions.R")

Execution node

node_name()
[1] "rfsaldanha"

Load data

important_vars <- c("DT_SIN_PRI", "RESUL_SORO", "SOROTIPO", "CLASSI_FIN", "CRITERIO")

valid_interval <- interval(ymd("2011-01-01"), ymd("2022-12-31"))

dengue_files_list <- c(
  data_dir("dengue_data/parquets/dengue_2011.parquet"),
  data_dir("dengue_data/parquets/dengue_2012.parquet"),
  data_dir("dengue_data/parquets/dengue_2013.parquet"),
  data_dir("dengue_data/parquets/dengue_2014.parquet"),
  data_dir("dengue_data/parquets/dengue_2015.parquet"),
  data_dir("dengue_data/parquets/dengue_2016.parquet"),
  data_dir("dengue_data/parquets/dengue_2017.parquet"),
  data_dir("dengue_data/parquets/dengue_2018.parquet"),
  data_dir("dengue_data/parquets/dengue_2019.parquet"),
  data_dir("dengue_data/parquets/dengue_2020.parquet"),
  data_dir("dengue_data/parquets/dengue_2021.parquet"),
  data_dir("dengue_data/parquets/dengue_2022.parquet")
)

dengue <- open_dataset(sources = dengue_files_list) %>%
  select(all_of(important_vars)) %>%
  collect() %>%
  mutate(DT_SIN_PRI = ymd(DT_SIN_PRI)) %>%
  filter(DT_SIN_PRI %within% valid_interval) %>%
  filter(CLASSI_FIN != "6")

Final classification and criteria

dengue %>%
  group_by(CLASSI_FIN, CRITERIO) %>%
  summarise(freq = n()) %>%
  ungroup() %>%
  kable(
    format.args = list(big.mark = ".", decimal.mark = ",")
  )
`summarise()` has grouped output by 'CLASSI_FIN'. You can override using the
`.groups` argument.
CLASSI_FIN CRITERIO freq
Dengue Clínico epidemiológico 4.175.127
Dengue Em investigação 69.101
Dengue Laboratório 2.633.671
Dengue NA 24
Dengue clássico Clínico epidemiológico 1.439.136
Dengue clássico Em investigação 16.796
Dengue clássico Laboratório 880.966
Dengue clássico NA 7
Dengue com complicações Clínico epidemiológico 8.249
Dengue com complicações Em investigação 595
Dengue com complicações Laboratório 9.973
Dengue com sinais de alarme Clínico epidemiológico 50.756
Dengue com sinais de alarme Em investigação 2.553
Dengue com sinais de alarme Laboratório 47.633
Dengue grave Clínico epidemiológico 1.770
Dengue grave Em investigação 488
Dengue grave Laboratório 6.662
Descartado Clínico epidemiológico 2.495.885
Descartado Em investigação 9.383
Descartado Laboratório 2.845.372
Descartado NA 26
Febre hemorrágica do dengue Clínico epidemiológico 2
Febre hemorrágica do dengue Em investigação 230
Febre hemorrágica do dengue Laboratório 5.041
Inconclusivo Clínico epidemiológico 19.689
Inconclusivo Em investigação 62.982
Inconclusivo Laboratório 8.654
Inconclusivo NA 2.052.830
Síndrome do choque do dengue Clínico epidemiológico 5
Síndrome do choque do dengue Em investigação 17
Síndrome do choque do dengue Laboratório 273
dengue_classifications <- c("Febre hemorrágica do dengue", "Síndrome do choque do dengue", "Dengue com sinais de alarme",
  "Dengue clássico", "Dengue com complicações", "Dengue",
  "Dengue grave")
dengue_cases_classification <- dengue %>% 
  mutate(CLASSI_FIN = case_when(
    CLASSI_FIN %in% dengue_classifications ~ "Confirmed",
    CLASSI_FIN == "Descartado" ~ "Discarded",
    CLASSI_FIN == "Inconclusivo" ~ "Inconclusive",
    CLASSI_FIN == 6 ~ "Invalid",
    is.na(CLASSI_FIN) ~ "Missing",
    .default = CLASSI_FIN
  )) %>%
  mutate(DT_SIN_PRI = lubridate::ceiling_date(x = DT_SIN_PRI, unit = "month")) %>%
  group_by(DT_SIN_PRI, CLASSI_FIN) %>%
  summarise(freq = n()) %>%
  ungroup() 
`summarise()` has grouped output by 'DT_SIN_PRI'. You can override using the
`.groups` argument.
write_parquet(x = dengue_cases_classification, sink = data_dir("dengue_data/parquet_classification/dengue_cases_classification.parquet"))
ggplot(data =  dengue_cases_classification, aes(x = DT_SIN_PRI, weight = freq, fill = CLASSI_FIN)) +
  geom_bar() +
  scale_fill_hue(direction = 1) +
  scale_y_continuous(labels = scales::comma) +
  labs(fill = "Classificação") +
  theme_minimal() +
  theme(legend.position = "bottom") +
  labs(x = "Month of first symptom's onset", y = "Records", fill = "Classification")

ggsave(filename = "dengue_cases_classification.pdf")
Saving 7 x 5 in image

Sorological examination

dengue %>%
  filter(CLASSI_FIN %in% dengue_classifications) %>%
  group_by(SOROTIPO) %>%
  summarise(freq = n()) %>%
  ungroup()
# A tibble: 5 × 2
  SOROTIPO    freq
  <chr>      <int>
1 DEN 1      46707
2 DEN 2      18891
3 DEN 3        213
4 DEN 4       6141
5 <NA>     9277123

Session info

sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.4 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_CA.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_CA.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_CA.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C       

time zone: Europe/Paris
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] knitr_1.45      arrow_14.0.0.2  lubridate_1.9.3 forcats_1.0.0  
 [5] stringr_1.5.1   dplyr_1.1.4     purrr_1.0.2     readr_2.1.5    
 [9] tidyr_1.3.1     tibble_3.2.1    ggplot2_3.4.4   tidyverse_2.0.0

loaded via a namespace (and not attached):
 [1] bit_4.0.5         gtable_0.3.4      jsonlite_1.8.8    compiler_4.3.2   
 [5] tidyselect_1.2.0  assertthat_0.2.1  textshaping_0.3.7 systemfonts_1.0.5
 [9] scales_1.3.0      yaml_2.3.8        fastmap_1.1.1     R6_2.5.1         
[13] labeling_0.4.3    generics_0.1.3    htmlwidgets_1.6.4 munsell_0.5.0    
[17] pillar_1.9.0      tzdb_0.4.0        rlang_1.1.3       utf8_1.2.4       
[21] stringi_1.8.3     xfun_0.42         bit64_4.0.5       timechange_0.3.0 
[25] cli_3.6.2         withr_3.0.0       magrittr_2.0.3    digest_0.6.34    
[29] grid_4.3.2        hms_1.1.3         lifecycle_1.0.4   vctrs_0.6.5      
[33] evaluate_0.23     glue_1.7.0        farver_2.1.1      ragg_1.2.7       
[37] fansi_1.0.6       colorspace_2.1-0  rmarkdown_2.25    tools_4.3.2      
[41] pkgconfig_2.0.3   htmltools_0.5.7  
Back to top