epiverse-trace / sivirep

Data Wrangling and Automated Reports from 'SIVIGILA' source

Home Page:https://epiverse-trace.github.io/sivirep/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

geo_filter may have a problem filtering municipaloties

zmcucunuba opened this issue · comments

Hola Geral

  • [x ] I have the most recent version of sivirep and R
  • [x ] I have found a bug

Creo que he encontrado un bug pero no estoy segura cómo funciona porque el problema sólo ocurre con Cali en esta serie de ejemplos. Cuando uso el geofiltro para municipio Cali, me sale un total de 17 casos cuando deberían ser 13376. Pero lo probé para otros municipios del Valle y de Amazonas y no sale ese problema. No sé si sea algo con el nombre CALI. y tal vez pueda ocurrir con otros.

Dejo el código reproducible

library(sivirep)
dat <- import_data_event(year = 2020, nombre_event = "Dengue")
dat_clean <- limpiar_data_sivigila(data_event= dat)
dat_valle <- geo_filtro(data_event = dat_clean, dpto = "VALLE")
dat_cali  <- geo_filtro(data_event= dat_clean, dpto = "VALLE", mpio = "CALI")
dist_esp_mun <- agrupar_mpio(data_event = dat_valle, dpto = "VALLE")

NROW(dat_cali) # 17 casos 
dist_esp_mun %>% filter(municipio_ocurrencia == "CALI") # 13376 


dat_buga  <- geo_filtro(data_event= dat_clean, dpto = "VALLE", mpio = "BUGA")
NROW(dat_buga) # 1312 casos
dist_esp_mun %>% filter(municipio_ocurrencia == "BUGA") # 1312 casos

dat_amazonas <- geo_filtro(data_event = dat_clean, dpto = "AMAZONAS")
dat_leticia  <- geo_filtro(data_event= dat_clean, dpto = "AMAZONAS", mpio = "LETICIA")
dist_esp_amazonas_mun <- agrupar_mpio(data_event = dat_amazonas, dpto = "AMAZONAS")
NROW(dat_leticia) # 176 casos
dist_esp_amazonas_mun %>% filter(municipio_ocurrencia == "LETICIA") # 176 casos

¡Mil gracias!

Hola @zmcucunuba,

Muchas gracias por haber reportado este comportamiento de la función geo_filtro. Esto ya fue resuelto con el PR: #125.

En la siguiente imagen se pueden evidenciar que la función ya muestra los 13376 registros para Cali. Se realizó una prueba efectuando los mismos pasos con el código que compartiste:

image