V1.1 Projecto Estimacion de la sensibilidad del sistema de vigilancia epidemiologica PPC Autor Alfredo Acosta PhD alfredoacosta@alumni.usp.br EPIDAT University of Sao Paulo Preventive veterinary medicine department https://github.com/alfredojavier55/Preparing_agro_data
library(dplyr);library(lubridate);library(ggplot2); library(scales)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
##
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
setwd("~/Dropbox/0.USP/1 Projeto/Conferir-dados/2021")
# Archivos de general ----
vge1 <- readxl::read_excel("VEPG02_REP_GENERAL_BASICO 2014.xls")
vge2 <- readxl::read_excel("VEPG02_REP_GENERAL_BASICO 2015.xls")
vge3 <- readxl::read_excel("VEPG02_REP_GENERAL_BASICO 2016.xls")
vge4 <- readxl::read_excel("VEPG02_REP_GENERAL_BASICO 2017.xls")
vge5 <- readxl::read_excel("VEPG02_REP_GENERAL_BASICO 2018.xls")
vge6 <- readxl::read_excel("VEPG02_REP_GENERAL_BASICO 2019.xls")
vge7 <- readxl::read_excel("VEPG02_REP_GENERAL_BASICO 2020.xls")
vge8 <- readxl::read_excel("VEPG02_REP_GENERAL_BASICO 2021.xls")
vge9 <- readxl::read_excel("VEPG02_REP_GENERAL_BASICO 2022.xls")
vge10 <- readxl::read_excel("VEPG02_REP_GENERAL_BASICO 2023.xls")
colnames(vge1) <- colnames(vge9)
colnames(vge2) <- colnames(vge9)
colnames(vge3) <- colnames(vge9)
colnames(vge4) <- colnames(vge9)
colnames(vge5) <- colnames(vge9)
colnames(vge6) <- colnames(vge9)
colnames(vge7) <- colnames(vge9)
colnames(vge8) <- colnames(vge9)
vge <- rbind(vge1, vge2, vge3, vge4, vge5, vge6, vge7, vge8, vge9, vge10)
# Archivos de resultados ----
vr1 <- readxl::read_excel("VEPG02_REP_RESULTADOS 2014.xls")
## New names:
## • `F. REGISTRO` -> `F. REGISTRO...3`
## • `PATOLOGÍA` -> `PATOLOGÍA...18`
## • `ESPECIE` -> `ESPECIE...20`
## • `REGISTRO` -> `REGISTRO...27`
## • `ESPECIE` -> `ESPECIE...31`
## • `PATOLOGÍA` -> `PATOLOGÍA...32`
## • `REGISTRO` -> `REGISTRO...40`
## • `F. REGISTRO` -> `F. REGISTRO...41`
vr2 <- readxl::read_excel("VEPG02_REP_RESULTADOS 2015.xls")
## New names:
## • `F. REGISTRO` -> `F. REGISTRO...3`
## • `PATOLOGÍA` -> `PATOLOGÍA...18`
## • `ESPECIE` -> `ESPECIE...20`
## • `REGISTRO` -> `REGISTRO...27`
## • `ESPECIE` -> `ESPECIE...31`
## • `PATOLOGÍA` -> `PATOLOGÍA...32`
## • `REGISTRO` -> `REGISTRO...40`
## • `F. REGISTRO` -> `F. REGISTRO...41`
vr3 <- readxl::read_excel("VEPG02_REP_RESULTADOS 2016.xls")
## New names:
## • `F. REGISTRO` -> `F. REGISTRO...3`
## • `PATOLOGÍA` -> `PATOLOGÍA...18`
## • `ESPECIE` -> `ESPECIE...20`
## • `REGISTRO` -> `REGISTRO...27`
## • `ESPECIE` -> `ESPECIE...31`
## • `PATOLOGÍA` -> `PATOLOGÍA...32`
## • `REGISTRO` -> `REGISTRO...40`
## • `F. REGISTRO` -> `F. REGISTRO...41`
vr4 <- readxl::read_excel("VEPG02_REP_RESULTADOS 2017.xls")
## New names:
## • `F. REGISTRO` -> `F. REGISTRO...3`
## • `PATOLOGÍA` -> `PATOLOGÍA...18`
## • `ESPECIE` -> `ESPECIE...20`
## • `REGISTRO` -> `REGISTRO...27`
## • `ESPECIE` -> `ESPECIE...31`
## • `PATOLOGÍA` -> `PATOLOGÍA...32`
## • `REGISTRO` -> `REGISTRO...40`
## • `F. REGISTRO` -> `F. REGISTRO...41`
vr5 <- readxl::read_excel("VEPG02_REP_RESULTADOS 2018.xls")
## New names:
## • `F. REGISTRO` -> `F. REGISTRO...3`
## • `PATOLOGÍA` -> `PATOLOGÍA...18`
## • `ESPECIE` -> `ESPECIE...20`
## • `REGISTRO` -> `REGISTRO...27`
## • `ESPECIE` -> `ESPECIE...31`
## • `PATOLOGÍA` -> `PATOLOGÍA...32`
## • `REGISTRO` -> `REGISTRO...40`
## • `F. REGISTRO` -> `F. REGISTRO...41`
vr6 <- readxl::read_excel("VEPG02_REP_RESULTADOS 2019.xls")
## New names:
## • `F. REGISTRO` -> `F. REGISTRO...3`
## • `PATOLOGÍA` -> `PATOLOGÍA...18`
## • `ESPECIE` -> `ESPECIE...20`
## • `REGISTRO` -> `REGISTRO...27`
## • `ESPECIE` -> `ESPECIE...31`
## • `PATOLOGÍA` -> `PATOLOGÍA...32`
## • `REGISTRO` -> `REGISTRO...40`
## • `F. REGISTRO` -> `F. REGISTRO...41`
vr7 <- readxl::read_excel("VEPG02_REP_RESULTADOS 2020.xls")
## New names:
## • `F. REGISTRO` -> `F. REGISTRO...3`
## • `PATOLOGÍA` -> `PATOLOGÍA...18`
## • `ESPECIE` -> `ESPECIE...20`
## • `REGISTRO` -> `REGISTRO...27`
## • `ESPECIE` -> `ESPECIE...31`
## • `PATOLOGÍA` -> `PATOLOGÍA...32`
## • `REGISTRO` -> `REGISTRO...40`
## • `F. REGISTRO` -> `F. REGISTRO...41`
vr8 <- readxl::read_excel("VEPG02_REP_RESULTADOS 2021.xls")
## New names:
## • `F. REGISTRO` -> `F. REGISTRO...3`
## • `PATOLOGÍA` -> `PATOLOGÍA...18`
## • `ESPECIE` -> `ESPECIE...20`
## • `REGISTRO` -> `REGISTRO...27`
## • `ESPECIE` -> `ESPECIE...31`
## • `PATOLOGÍA` -> `PATOLOGÍA...32`
## • `REGISTRO` -> `REGISTRO...40`
## • `F. REGISTRO` -> `F. REGISTRO...41`
vr9 <- readxl::read_excel("VEPG02_REP_RESULTADOS 2022.xls")
vr10 <- readxl::read_excel("VEPG02_REP_RESULTADOS 2023.xls")
# reemplazar colnames incorrectos (vr1-vr7) por correctos (vr8) especie...18 a especie de notificacion
colnames(vr1) <- colnames(vr9)
colnames(vr2) <- colnames(vr9)
colnames(vr3) <- colnames(vr9)
colnames(vr4) <- colnames(vr9)
colnames(vr5) <- colnames(vr9)
colnames(vr6) <- colnames(vr9)
colnames(vr7) <- colnames(vr9)
colnames(vr8) <- colnames(vr9)
vr <- rbind(vr1, vr2, vr3, vr4, vr5, vr6, vr7, vr8, vr9, vr10)
# Archivos de cierre ----
vc1 <- readxl::read_excel("VEPG02_REP_CIERRE 2014.xls")
## New names:
## • `ESPECIE` -> `ESPECIE...22`
## • `ESPECIE` -> `ESPECIE...31`
vc2 <- readxl::read_excel("VEPG02_REP_CIERRE 2015.xls")
## New names:
## • `ESPECIE` -> `ESPECIE...22`
## • `ESPECIE` -> `ESPECIE...31`
vc3 <- readxl::read_excel("VEPG02_REP_CIERRE 2016.xls")
## New names:
## • `ESPECIE` -> `ESPECIE...22`
## • `ESPECIE` -> `ESPECIE...31`
vc4 <- readxl::read_excel("VEPG02_REP_CIERRE 2017.xls")
## New names:
## • `ESPECIE` -> `ESPECIE...22`
## • `ESPECIE` -> `ESPECIE...31`
vc5 <- readxl::read_excel("VEPG02_REP_CIERRE 2018.xls")
## New names:
## • `ESPECIE` -> `ESPECIE...22`
## • `ESPECIE` -> `ESPECIE...31`
vc6 <- readxl::read_excel("VEPG02_REP_CIERRE 2019.xls")
## New names:
## • `ESPECIE` -> `ESPECIE...22`
## • `ESPECIE` -> `ESPECIE...31`
vc7 <- readxl::read_excel("VEPG02_REP_CIERRE 2020.xls")
## New names:
## • `ESPECIE` -> `ESPECIE...22`
## • `ESPECIE` -> `ESPECIE...31`
vc8 <- readxl::read_excel("VEPG02_REP_CIERRE 2021.xls")
## New names:
## • `ESPECIE` -> `ESPECIE...22`
## • `ESPECIE` -> `ESPECIE...31`
vc9 <- readxl::read_excel("VEPG02_REP_CIERRE 2022.xls")
## New names:
## • `ESPECIE` -> `ESPECIE...22`
## • `ESPECIE` -> `ESPECIE...31`
vc10 <- readxl::read_excel("VEPG02_REP_CIERRE 2023.xls")
## New names:
## • `ESPECIE` -> `ESPECIE...22`
## • `ESPECIE` -> `ESPECIE...31`
colnames(vc9)[22] <- colnames(vr)[20]
colnames(vc9)[31] <- "ESPECIE_F"
colnames(vc1) <- colnames(vc9)
colnames(vc2) <- colnames(vc9)
colnames(vc3) <- colnames(vc9)
colnames(vc4) <- colnames(vc9)
colnames(vc5) <- colnames(vc9)
colnames(vc6) <- colnames(vc9)
colnames(vc7) <- colnames(vc9)
colnames(vc8) <- colnames(vc9)
colnames(vc10) <- colnames(vc9)
vc <- rbind(vc1, vc2, vc3, vc4, vc5, vc6, vc7, vc8, vc9, vc10)
# -- Vigilancia general ----
v0 <- full_join(vc, vr)
## Joining, by = c("# ORDEN", "# ALERTA", "SEMANA", "PROVINCIA", "CANTÓN",
## "PARROQUIA", "UTM WGS-84", "C.C/C.I/RUC", "PROPIETARIO", "PREDIO", "T.
## EXPLOTACIÓN", "NOTIFICADOR", "F. 1er ENFERMO", "F. NOTIFICACIÓN", "F. 1era
## VISITA", "SÍNDROME PRESUNTIVO", "RESULTADO", "ESPECIE E. SANITARIO", "EDAD",
## "ESTADO", "¿SUPERVISADO?")
v1 <- full_join(v0,vge)
## Joining, by = c("# ORDEN", "# ALERTA", "F. REGISTRO", "SEMANA", "PROVINCIA",
## "CANTÓN", "PARROQUIA", "UTM WGS-84", "C.C/C.I/RUC", "PROPIETARIO", "PREDIO",
## "T. EXPLOTACIÓN", "NOTIFICADOR", "F. 1er ENFERMO", "F. NOTIFICACIÓN", "F. 1era
## VISITA", "SÍNDROME PRESUNTIVO", "PATOLOGÍA", "RESULTADO", "EDAD", "ESTADO",
## "¿SUPERVISADO?", "MUESTREO POR EEB", "T. ALIMENTACIÓN", "RAZÓN MUESTREO")
# Cambiando nombres de columna
colnames(v1) <- tolower(colnames(v1))
colnames(v1) <- gsub(" ", "_", colnames(v1))
colnames(v1) <- gsub("\\.", "", colnames(v1))
colnames(v1) <- gsub("#_", "", colnames(v1))
colnames(v1) <- gsub("\\?", "", colnames(v1))
colnames(v1) <- gsub("\\¿", "", colnames(v1))
#Banco Resultados de eventos
v1$cant_muestras <- as.numeric(v1$cant_muestras)
v1$positivos <- as.numeric(v1$positivos)
v1$negativos <- as.numeric(v1$negativos)
v1$reactivos <- as.numeric(v1$reactivos)
v1$indeterminados <- as.numeric(v1$indeterminados)
v1$existentes <- as.numeric(v1$existentes)
v1$enfermos <- as.numeric(v1$enfermos)
v1$muertos <- as.numeric(v1$muertos)
v1$sacrificados <- as.numeric(v1$sacrificados)
table(v1$especie)
##
## ABEJAS AVES BOVINOS BUBALINOS CAMELIDOS CAPRINOS
## 789 108 16139 13 4 193
## CERVIDOS CONEJOS CUYES EQUINOS GATOS MURCIELAGOS
## 1 2 63 1067 7 1
## NO APLICA OVINOS PERROS PORCINOS
## 1 154 14 4690
rm(vc1,vc3,vc4,vc5,vc6,vc7,vc8, vc9, vc10)
rm(vge1,vge3,vge4,vge5,vge6,vge7,vge8, vge9, vge10)
rm(vr1,vr2,vr3,vr4,vr5,vr6,vr7,vr8,vr9, vr10)
colnames(v1)
## [1] "orden" "alerta"
## [3] "f_registro" "semana"
## [5] "f_cierre" "días_en_cerrar"
## [7] "provincia" "cantón"
## [9] "parroquia" "utm_wgs-84"
## [11] "cc/ci/ruc" "propietario"
## [13] "predio" "t_explotación"
## [15] "notificador" "f_1er_enfermo"
## [17] "f_notificación" "f_1era_visita"
## [19] "síndrome_presuntivo" "patología"
## [21] "resultado" "especie_e_sanitario"
## [23] "edad" "estado"
## [25] "supervisado" "vacunó"
## [27] "focal" "dosis_focal"
## [29] "perifocal" "dosis_perifocal"
## [31] "especie_f" "existentes"
## [33] "enfermos" "muertos"
## [35] "sacrificados" "registro_inicial"
## [37] "f_registro_e_sanitario" "patología_notificación"
## [39] "muestreo_por_eeb" "t_alimentación"
## [41] "razón_muestreo" "registro_e_sanitario"
## [43] "colecta" "visita"
## [45] "f_informe" "especie_informe_resultados"
## [47] "patología_informe_resultados" "prueba_solicitada"
## [49] "laboratorio" "cant_muestras"
## [51] "positivos" "negativos"
## [53] "indeterminados" "reactivos"
## [55] "registro_informe_resultados" "f_registro_resultado"
## [57] "liberado" "f_liberado"
## [59] "días_en_liberar" "recomendaciones"
## [61] "responsable_liberar_resultado" "especie"
## [63] "registro"
# detalle diagnóstico antiguo es ahora patologìa_notificacion
v2 <- v1 %>%
group_by(orden, provincia, cantón, parroquia, `cc/ci/ruc`, propietario, semana, `utm_wgs-84`, predio,t_explotación, notificador,
f_1er_enfermo, f_notificación, f_1era_visita, síndrome_presuntivo,
patología, especie, especie_informe_resultados, edad, f_registro, f_cierre,
patología_notificación,
registro, vacunó, focal, dosis_focal, perifocal, dosis_perifocal,
especie_f, colecta)%>%
summarise(existente=mean(existentes)+ mean(muertos) + mean(sacrificados),
enfermo=mean(enfermos),
mortos=mean(muertos),
sacrifi=mean(sacrificados),
afetados=sum(mortos, sacrifi),
pos=sum(positivos),
total_muestras=sum(cant_muestras),
reactivo=sum(reactivos))
## `summarise()` has grouped output by 'orden', 'provincia', 'cantón',
## 'parroquia', 'cc/ci/ruc', 'propietario', 'semana', 'utm_wgs-84', 'predio',
## 't_explotación', 'notificador', 'f_1er_enfermo', 'f_notificación',
## 'f_1era_visita', 'síndrome_presuntivo', 'patología', 'especie',
## 'especie_informe_resultados', 'edad', 'f_registro', 'f_cierre',
## 'patología_notificación', 'registro', 'vacunó', 'focal', 'dosis_focal',
## 'perifocal', 'dosis_perifocal', 'especie_f'. You can override using the
## `.groups` argument.
# Agregando ano
v2$ano <- year(dmy(v2$f_1er_enfermo))
v2$month <- month(dmy(v2$f_1er_enfermo))
length(unique(v2$orden))
## [1] 11097
v2$f_1er_enfermo <- dmy(v2$f_1er_enfermo)
# Changing to floor date week
v2$week <- floor_date(v2$f_1er_enfermo, "week")
# Best visualizations by month
v2$Month <- floor_date(v2$f_1er_enfermo, "month")
# Numero de ordenes
v2 %>%
group_by(ano)%>%
# filter(ano >2020)%>%
summarise(notifi=length(unique(orden)))
## # A tibble: 15 × 2
## ano notifi
## <dbl> <int>
## 1 1902 2
## 2 1904 1
## 3 1921 1
## 4 2012 1
## 5 2013 7
## 6 2014 358
## 7 2015 1037
## 8 2016 1300
## 9 2017 1489
## 10 2018 2068
## 11 2019 1479
## 12 2020 989
## 13 2021 1062
## 14 2022 1001
## 15 2023 302
v2 %>%
# group_by(month)%>%
group_by(especie_f)%>%
filter(ano >2013)%>%
summarise(notifi_geral=length(unique(orden)))%>%
arrange(desc(notifi_geral))
## # A tibble: 17 × 2
## especie_f notifi_geral
## <chr> <int>
## 1 BOVINOS 7195
## 2 <NA> 2636
## 3 PORCINOS 2155
## 4 EQUINOS 611
## 5 ABEJAS 583
## 6 CAPRINOS 110
## 7 OVINOS 93
## 8 CUYES 44
## 9 AVES 25
## 10 BUBALINOS 6
## 11 PERROS 6
## 12 CAMELIDOS 4
## 13 GATOS 3
## 14 CONEJOS 2
## 15 CERVIDOS 1
## 16 MURCIELAGOS 1
## 17 NO APLICA 1
v2 %>%
# group_by(month)%>%
group_by(especie_f)%>%
filter(ano >2013)%>%
summarise(notifi_geral=length(unique(orden)))%>%
arrange(desc(notifi_geral))
## # A tibble: 17 × 2
## especie_f notifi_geral
## <chr> <int>
## 1 BOVINOS 7195
## 2 <NA> 2636
## 3 PORCINOS 2155
## 4 EQUINOS 611
## 5 ABEJAS 583
## 6 CAPRINOS 110
## 7 OVINOS 93
## 8 CUYES 44
## 9 AVES 25
## 10 BUBALINOS 6
## 11 PERROS 6
## 12 CAMELIDOS 4
## 13 GATOS 3
## 14 CONEJOS 2
## 15 CERVIDOS 1
## 16 MURCIELAGOS 1
## 17 NO APLICA 1
# Número de notificaciones por especie alta notificacion
v2 %>%
# group_by(month)%>%
group_by(ano, especie_f)%>%
filter(ano >2013)%>%
filter(especie_f=="BOVINOS" | especie_f == "PORCINOS"
| especie_f == "OVINOS" | especie_f == "EQUINOS" | especie_f == "ABEJAS")%>%
summarise(notifi_geral=length(unique(orden)))%>%
arrange(desc(notifi_geral))%>%
ggplot()+
geom_col(aes(ano,notifi_geral), colour="#377EB8")+
geom_text(aes(ano, notifi_geral, label=(notifi_geral)), nudge_y = 200)+
facet_grid(rows = vars(especie_f))+
scale_y_continuous(breaks= pretty_breaks())+
labs(y="Notificaciones vigilancia general",
x="Año")+
theme_minimal() +
theme(text = element_text(size = 10))
## `summarise()` has grouped output by 'ano'. You can override using the `.groups`
## argument.
v2 %>%
# group_by(month)%>%
group_by(ano, especie_f)%>%
filter(ano >2013)%>%
filter(especie_f =="CAPRINOS" | especie_f == "OVINOS"
| especie_f == "CUYES" | especie_f == "AVES"
| especie_f == "PERROS" | especie_f == "CAMELIDOS" | especie_f == "GATOS")%>%
summarise(notifi_geral=length(unique(orden)))%>%
arrange(desc(notifi_geral))%>%
ggplot()+
geom_col(aes(ano,notifi_geral), colour="#377EB8")+
geom_text(aes(ano, notifi_geral, label=(notifi_geral)), nudge_y = 10)+
facet_grid(rows = vars(especie_f))+
# scale_y_continuous(breaks= pretty_breaks())+
labs(y="Notificaciones vigilancia general",
x="Año")+
theme_minimal() +
theme(text = element_text(size = 10))
## `summarise()` has grouped output by 'ano'. You can override using the `.groups`
## argument.
v2 %>%
# group_by(month)%>%
group_by(ano, especie_f)%>%
filter(ano >2013)%>%
filter(especie_f =="CERVIDOS" | especie_f == "CONEJOS"
| especie_f == "MURCIELAGOS" | especie_f == "NO APLICA" | especie_f == "BUBALINOS")%>%
summarise(notifi_geral=length(unique(orden)))%>%
arrange(desc(notifi_geral))%>%
ggplot()+
geom_col(aes(ano,notifi_geral))+
geom_text(aes(ano, notifi_geral, label=(notifi_geral)), nudge_y = 1)+
facet_grid(rows = vars(especie_f))+
# scale_y_continuous(breaks= pretty_breaks())+
labs(y="Notificaciones vigilancia general",
x="Año")+
theme_minimal() +
theme(text = element_text(size = 10))
## `summarise()` has grouped output by 'ano'. You can override using the `.groups`
## argument.
v2 %>%
# group_by(month)%>%
group_by(ano, especie_f)%>%
# filter(ano <2020)%>%
filter(ano >2013)%>%
filter(especie_f=="BOVINOS" | especie_f == "PORCINOS"
| especie_f == "OVINOS" | especie_f == "EQUINOS" | especie_f == "ABEJAS")%>%
summarise(notifi_geral=length(unique(orden)))%>%
arrange(desc(notifi_geral))%>%
ggplot()+
geom_col(aes(ano,notifi_geral), colour="#4DAF4A")+
geom_text(aes(ano, notifi_geral, label=(notifi_geral)), nudge_y = 200)+
facet_grid(rows = vars(especie_f))+
labs(y="Numero",
title="Notificaciones vigilancia general por especies 2014-2021",
x="Año")+
theme_minimal() +
theme(text = element_text(size = 12))
## `summarise()` has grouped output by 'ano'. You can override using the `.groups`
## argument.
v2 %>%
# group_by(month)%>%
group_by(ano, especie_f)%>%
filter(ano <2020)%>%
filter(ano >2013)%>%
filter(especie_f =="CAPRINOS" | especie_f == "OVINOS"
| especie_f == "CUYES" | especie_f == "AVES"
| especie_f == "PERROS" | especie_f == "CAMELIDOS" | especie_f == "GATOS")%>%
summarise(notifi_geral=length(unique(orden)))%>%
arrange(desc(notifi_geral))%>%
ggplot()+
geom_col(aes(ano,notifi_geral), colour="#4DAF4A")+
geom_text(aes(ano, notifi_geral, label=(notifi_geral)), nudge_y = 10)+
facet_grid(rows = vars(especie_f))+
labs(y="Numero",
title="Notificaciones vigilancia general por especies 2014-2021",
x="Año")+
theme_minimal() +
theme(text = element_text(size = 6))
## `summarise()` has grouped output by 'ano'. You can override using the `.groups`
## argument.
v2 %>%
# group_by(month)%>%
group_by(ano, especie_f)%>%
# filter(ano <2020)%>%
filter(ano >2013)%>%
filter(especie_f =="CERVIDOS" | especie_f == "CONEJOS"
| especie_f == "MURCIELAGOS" | especie_f == "NO APLICA" | especie_f == "BUBALINOS")%>%
summarise(notifi_geral=length(unique(orden)))%>%
arrange(desc(notifi_geral))%>%
ggplot()+
geom_col(aes(ano,notifi_geral),colour="#4DAF4A")+
geom_text(aes(ano, notifi_geral, label=(notifi_geral)), nudge_y = 1)+
facet_grid(rows = vars(especie_f))+
labs(y="Numero",
title="Notificaciones vigilancia general por especies 2014-2021",
x="Año")+
theme_minimal() +
theme(text = element_text(size = 10))
## `summarise()` has grouped output by 'ano'. You can override using the `.groups`
## argument.
v2 %>%
# group_by(month)%>%
group_by(Month,síndrome_presuntivo, especie_f)%>%
# filter(ano <2020)%>%
filter(ano >2013)%>%
filter(especie_f=="BOVINOS" | especie_f == "PORCINOS"
| especie_f == "OVINOS" | especie_f == "EQUINOS" | especie_f == "ABEJAS")%>%
summarise(notifi_geral=length(unique(orden)),
casos=sum(pos >= 1, na.rm = TRUE))%>%
ggplot()+
geom_col(aes(Month,notifi_geral,fill=síndrome_presuntivo))+
facet_grid(rows = vars(especie_f))+
scale_y_continuous(breaks= pretty_breaks())+
labs(y=NULL,
title="Notificaciones por sindrome presuntivo",
x=NULL)+
theme_minimal() +
theme(text = element_text(size = 10))
## `summarise()` has grouped output by 'Month', 'síndrome_presuntivo'. You can
## override using the `.groups` argument.
v2 %>%
# group_by(month)%>%
group_by(Month,síndrome_presuntivo, especie_f)%>%
# filter(ano <2020)%>%
filter(ano >2013)%>%
filter(especie_f=="BOVINOS")%>%
summarise(notifi_geral=length(unique(orden)),
casos=sum(pos >= 1, na.rm = TRUE))%>%
ggplot()+
geom_col(aes(Month,notifi_geral,fill=síndrome_presuntivo))+
facet_grid(rows = vars(especie_f))+
scale_y_continuous(breaks= pretty_breaks())+
labs(y=NULL,
title="Notificaciones por sindrome presuntivo",
x=NULL)+
theme_minimal() +
theme(text = element_text(size = 10))
## `summarise()` has grouped output by 'Month', 'síndrome_presuntivo'. You can
## override using the `.groups` argument.
v2 %>%
# group_by(month)%>%
group_by(Month, ano, patología, especie_f)%>%
# filter(ano >2020)%>%
filter(especie_f=="BOVINOS")%>%
summarise(notifi_geral=length(unique(orden)))%>%
arrange(desc(notifi_geral))%>%
head(.,40)%>%
ggplot()+
geom_col(aes(Month,notifi_geral, fill=patología))+
facet_grid(rows = vars(ano))+
scale_y_continuous(breaks= pretty_breaks())+
labs(y=NULL,
title="Notificaciones por sindrome presuntivo",
x=NULL)+
theme_minimal() +
theme(text = element_text(size = 8))
## `summarise()` has grouped output by 'Month', 'ano', 'patología'. You can
## override using the `.groups` argument.
Vigilancia General
La vigilancia general no se centra en una enfermedad en particular, pero puede usarse para detectar cualquier enfermedad o patógeno. Por ejemplo, el sistema de notificación de enfermedades de los agricultores es un sistema de vigilancia general, ya que se puede notificar cualquier enfermedad. Sin embargo, no todas las enfermedades se notificarán con la misma fiabilidad.
Es más probable que los agricultores notifiquen enfermedades que muestran signos claros y tienen un impacto significativo (por ejemplo, muchos animales están infectados o la enfermedad provoca la muerte, como la septicemia hemorrágica) que las enfermedades que muestran pocos signos o que no lo hacen. resultar en un impacto económico inmediato (como el causado por infecciones parasitarias intestinales).
Algunas pruebas de laboratorio, como la histopatología, permiten la detección de muchas enfermedades diferentes, en lugar de una sola enfermedad.
Una característica importante de la vigilancia general es que no solo puede detectar enfermedades conocidas de interés, sino que también puede detectar enfermedades endémicas nuevas, emergentes, exóticas o desconocidas. En otras palabras, no es necesario estar buscando una enfermedad específica para encontrarla. (Cameron, 2014).
# Filtrando porcinos
v2 <- v1 %>%
filter(especie_f == "PORCINOS")
v2 <- v2 %>%
group_by(orden, provincia, cantón, parroquia, `cc/ci/ruc`, propietario, semana, `utm_wgs-84`, predio,t_explotación, notificador,
f_1er_enfermo, f_notificación, f_1era_visita, síndrome_presuntivo,
patología, especie, especie_informe_resultados, edad, f_registro, f_cierre,
registro, vacunó, focal, dosis_focal, perifocal, dosis_perifocal,
especie_f, colecta)%>%
summarise(existente=mean(existentes)+ mean(muertos) + mean(sacrificados),
enfermo=mean(enfermos),
mortos=mean(muertos),
sacrifi=mean(sacrificados),
afetados=sum(mortos, sacrifi),
pos=sum(positivos),
total_muestras=sum(cant_muestras),
reactivo=sum(reactivos))
## `summarise()` has grouped output by 'orden', 'provincia', 'cantón',
## 'parroquia', 'cc/ci/ruc', 'propietario', 'semana', 'utm_wgs-84', 'predio',
## 't_explotación', 'notificador', 'f_1er_enfermo', 'f_notificación',
## 'f_1era_visita', 'síndrome_presuntivo', 'patología', 'especie',
## 'especie_informe_resultados', 'edad', 'f_registro', 'f_cierre', 'registro',
## 'vacunó', 'focal', 'dosis_focal', 'perifocal', 'dosis_perifocal', 'especie_f'.
## You can override using the `.groups` argument.
# Agregando ano
v2$ano <- year(dmy(v2$f_1er_enfermo))
v2$month <- month(dmy(v2$f_1er_enfermo))
# Borrar bovinos
v2 <- v2[v2$orden != "1",] #0700860679 loja paltas casamba
v2 <- v2[v2$orden != "2382",]
v2 <- v2[v2$orden != "1096",]
v2 <- v2[v2$orden != "4114",]
v2 <- v2[v2$orden != "6270",]
length(unique(v2$orden))
## [1] 2153
#1758 com atualizacao 10/10/2021 todas as patologias
#1863 com atualizacao 10/12/2021 todas as patologias
#2153 com atualizacao 3/04/2023 todas as patologias
# Nmero de notificaciones generales por especie
# Asignando columna de fechas para graficos
v2$f_1er_enfermo <- dmy(v2$f_1er_enfermo)
# Changing to floor date week
v2$week <- floor_date(v2$f_1er_enfermo, "week")
# Best visualizations by month
v2$Month <- floor_date(v2$f_1er_enfermo, "month")
v2 %>%
group_by(ano)%>%
summarise(notifi=length(unique(orden)))
## # A tibble: 10 × 2
## ano notifi
## <dbl> <int>
## 1 2014 59
## 2 2015 346
## 3 2016 199
## 4 2017 291
## 5 2018 304
## 6 2019 271
## 7 2020 201
## 8 2021 199
## 9 2022 228
## 10 2023 55
v2 %>%
group_by(especie_informe_resultados)%>%
summarise(notifi=length(unique(orden)))
## # A tibble: 2 × 2
## especie_informe_resultados notifi
## <chr> <int>
## 1 PORCINOS 1443
## 2 <NA> 710
v2 %>%
group_by(ano, especie_f)%>%
summarise(notifi=length(unique(orden)))
## `summarise()` has grouped output by 'ano'. You can override using the `.groups`
## argument.
## # A tibble: 10 × 3
## # Groups: ano [10]
## ano especie_f notifi
## <dbl> <chr> <int>
## 1 2014 PORCINOS 59
## 2 2015 PORCINOS 346
## 3 2016 PORCINOS 199
## 4 2017 PORCINOS 291
## 5 2018 PORCINOS 304
## 6 2019 PORCINOS 271
## 7 2020 PORCINOS 201
## 8 2021 PORCINOS 199
## 9 2022 PORCINOS 228
## 10 2023 PORCINOS 55
sum(as.numeric(v2$total_muestras), na.rm=TRUE)
## [1] 19089
v2 %>%
# group_by(month)%>%
group_by(Month)%>%
# filter(ano <2020)%>%
# filter(ano >2016)%>%
summarise(notifi_geral=length(unique(orden)),
casos=sum(pos >= 1, na.rm = TRUE))%>%
ggplot()+
geom_col(aes(Month,notifi_geral), fill="#377EB8")+
scale_y_continuous(breaks= pretty_breaks())+
labs(y="Notificaciones vigilancia general porcinos",
x="Meses")+
theme_minimal() +
theme(text = element_text(size = 14))
v2 %>%
# group_by(month)%>%
group_by(Month, patología)%>%
# filter(ano <2020)%>%
# filter(ano >2016)%>%
summarise(notifi_geral=length(unique(orden)),
casos=sum(pos >= 1, na.rm = TRUE))%>%
ggplot()+
geom_col(aes(Month,notifi_geral, fill=patología))+
scale_y_continuous(breaks= pretty_breaks())+
labs(y="Notificaciones vigilancia general porcinos",
x="Meses")+
theme_minimal() +
theme(text = element_text(size = 8))
## `summarise()` has grouped output by 'Month'. You can override using the
## `.groups` argument.
v2 %>%
# group_by(month)%>%
group_by(Month,síndrome_presuntivo)%>%
# filter(ano <2020)%>%
# filter(ano >2016)%>%
summarise(notifi_geral=length(unique(orden)),
casos=sum(pos >= 1, na.rm = TRUE))%>%
ggplot()+
geom_col(aes(Month,notifi_geral,fill=síndrome_presuntivo))+
scale_y_continuous(breaks= pretty_breaks())+
labs(y="Notificaciones vigilancia general porcinos",
x="Meses")+
theme_minimal() +
theme(text = element_text(size = 10))
## `summarise()` has grouped output by 'Month'. You can override using the
## `.groups` argument.
Vigilancia dirigida El término vigilancia dirigida se puede utilizar refiriéndose a la vigilancia dirigida a una enfermedad específica (Cameron, 2014).
La distinción entre vigilancia general y dirigida depende del sistema de detección de enfermedades que se utilice. La vigilancia dirigida se basa en el uso de pruebas que pueden dar una respuesta sí / no para una enfermedad específica. Ejemplos incluyen:
• reacción en cadena de la polimerasa (PCR) • ensayo inmunoabsorbente ligado a enzimas (ELISA) • Agar gel de inmunodifusión (AGID).
Necesito llegar a los mismos resultados sin tener la columna de DIAGNOSTICO DEFINITIVO en el sizse. Filtro la especie porcinos, luego la prueba solicitada diferente a Anticuerpo, luego el detalle diagnostico, luego en prueba solicitada unicamente los que inicien con PESTE PORCINA…. (aqui hay antigeno, PCR qPCR y PCR out), al final asigno una nueva columna que indica cada linea como caso o notificacion.
#criando o v2 novo com as notificações extra
# Linkage dos reportes
library(stringr)
v0 <- full_join(vc, vr)
## Joining, by = c("# ORDEN", "# ALERTA", "SEMANA", "PROVINCIA", "CANTÓN",
## "PARROQUIA", "UTM WGS-84", "C.C/C.I/RUC", "PROPIETARIO", "PREDIO", "T.
## EXPLOTACIÓN", "NOTIFICADOR", "F. 1er ENFERMO", "F. NOTIFICACIÓN", "F. 1era
## VISITA", "SÍNDROME PRESUNTIVO", "RESULTADO", "ESPECIE E. SANITARIO", "EDAD",
## "ESTADO", "¿SUPERVISADO?")
v1 <- full_join(v0,vge)
## Joining, by = c("# ORDEN", "# ALERTA", "F. REGISTRO", "SEMANA", "PROVINCIA",
## "CANTÓN", "PARROQUIA", "UTM WGS-84", "C.C/C.I/RUC", "PROPIETARIO", "PREDIO",
## "T. EXPLOTACIÓN", "NOTIFICADOR", "F. 1er ENFERMO", "F. NOTIFICACIÓN", "F. 1era
## VISITA", "SÍNDROME PRESUNTIVO", "PATOLOGÍA", "RESULTADO", "EDAD", "ESTADO",
## "¿SUPERVISADO?", "MUESTREO POR EEB", "T. ALIMENTACIÓN", "RAZÓN MUESTREO")
colnames(v1) <- tolower(colnames(v1))
colnames(v1) <- gsub(" ", "_", colnames(v1))
colnames(v1) <- gsub("\\.", "", colnames(v1))
colnames(v1) <- gsub("#_", "", colnames(v1))
colnames(v1) <- gsub("\\?", "", colnames(v1))
colnames(v1) <- gsub("\\¿", "", colnames(v1))
# Filtro porcinos
v2 <- v1 %>%
filter(especie == "PORCINOS")
#Filtro vigilancia especifica ppc.
# Todas aquellas notificaciones en las cuales se requirio prueba para PPC
v2 <- v2 %>%
filter(prueba_solicitada != "PESTE PORCINA CLÁSICA (AC.)")
###
v2 <- v2 %>%
filter(str_detect(prueba_solicitada, "PESTE PORCINA"))%>%
group_by(orden, provincia, cantón, parroquia, `cc/ci/ruc`, propietario, semana, `utm_wgs-84`, predio,t_explotación, notificador, f_1er_enfermo, f_notificación, f_1era_visita, síndrome_presuntivo, patología, especie, especie_informe_resultados, edad, f_registro, f_cierre, registro, vacunó, focal, dosis_focal, perifocal, dosis_perifocal, especie_f, colecta)%>%
summarise(existente=mean(existentes)+ mean(muertos) + mean(sacrificados),
enfermo=mean(enfermos),
mortos=mean(muertos),
sacrifi=mean(sacrificados),
afetados=sum(mortos, sacrifi),
pos=sum(positivos),
total_muestras=sum(cant_muestras),
reactivo=sum(reactivos)) %>%
mutate(definitivo=ifelse(pos>=1,"caso", "notifi"))
## `summarise()` has grouped output by 'orden', 'provincia', 'cantón',
## 'parroquia', 'cc/ci/ruc', 'propietario', 'semana', 'utm_wgs-84', 'predio',
## 't_explotación', 'notificador', 'f_1er_enfermo', 'f_notificación',
## 'f_1era_visita', 'síndrome_presuntivo', 'patología', 'especie',
## 'especie_informe_resultados', 'edad', 'f_registro', 'f_cierre', 'registro',
## 'vacunó', 'focal', 'dosis_focal', 'perifocal', 'dosis_perifocal', 'especie_f'.
## You can override using the `.groups` argument.
# summarise(existente=sum(existentes, muertos, sacrificados), enfermo=sum(enfermos), mortos=sum(muertos),
# sacrifi=sum(sacrificados), afetados=sum(muertos,sacrificados),
# pos=sum(positivos), total_muestras=sum(cant_muestras),
# indeterm=sum(indeterminados), reactivo=sum(reactivos))%>%
# mutate(definitivo=ifelse(pos>=1,"caso", "notifi"))
#agregando ano
v2$ano <- year(dmy(v2$f_1er_enfermo))
v2$month <- month(dmy(v2$f_1er_enfermo))
# Borrar bovinos
v2 <- v2[v2$orden != "1",] #0700860679 loja paltas casamba
v2 <- v2[v2$orden != "2382",]
v2 <- v2[v2$orden != "1096",]
v2 <- v2[v2$orden != "4114",]
v2 <- v2[v2$orden != "6270",]
# Asignando columna de fechas para graficos
v2$f_1er_enfermo <- dmy(v2$f_1er_enfermo)
# Changing to floor date week
v2$week <- floor_date(v2$f_1er_enfermo, "week")
# Best visualizations by month
v2$Month <- floor_date(v2$f_1er_enfermo, "month")
length(unique(v2$orden))
## [1] 1190
table(v2$definitivo)
##
## caso notifi
## 324 866
plot(v2$existente)
hist(log(v2$existente))
table(v2$existente)
##
## 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
## 4 76 96 77 58 76 55 46 38 53 57 33 25 24 31 32
## 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
## 24 26 19 17 13 15 20 7 12 6 8 9 6 10 11 8
## 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 48
## 7 5 2 6 5 5 5 2 6 6 1 5 6 4 2 3
## 49 50 51 52 53 55 56 57 58 59 60 61 62 63 64 65
## 2 3 3 5 3 4 4 1 3 1 2 6 5 2 2 3
## 66 67 69 70 72 73 74 75 78 79 80 83 84 87 89 90
## 1 2 1 1 1 2 1 3 1 2 1 1 2 3 2 3
## 93 94 95 98 99 100 102 106 107 108 111 114 116 119 120 123
## 2 1 1 2 2 2 1 1 2 1 2 1 1 1 1 1
## 130 134 136 139 142 171 190 197 198 199 204 227 232 260 277 289
## 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1
## 302 309 324 335 382 384 406 500 509 891 1034 1300 2795
## 1 1 1 1 1 1 1 1 1 1 1 1 1
summary(v2$existente)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.00 4.00 10.00 27.17 21.00 2795.00
length(unique(v2$orden))
## [1] 1190
#1089 com atualizacao 10/12/2021 todas as patologias
#1190 04/2023
##Numero de notificaciones y casos confirmados
library(tidyr)
v2 %>%
# filter(ano <2023) %>%
group_by(definitivo)%>%
summarise(numero=n())%>%
spread(value="numero", key="definitivo")
## # A tibble: 1 × 2
## caso notifi
## <int> <int>
## 1 324 866
v2 %>%
group_by(ano, definitivo)%>%
summarise(numero=n())%>%
spread(value="numero", key="definitivo")
## `summarise()` has grouped output by 'ano'. You can override using the `.groups`
## argument.
## # A tibble: 10 × 3
## # Groups: ano [10]
## ano caso notifi
## <dbl> <int> <int>
## 1 2014 24 14
## 2 2015 84 138
## 3 2016 30 96
## 4 2017 39 121
## 5 2018 60 117
## 6 2019 34 125
## 7 2020 21 80
## 8 2021 11 100
## 9 2022 16 57
## 10 2023 5 18
v2 %>%
group_by(ano) %>%
summarise(atack_rate=sum(pos)/sum(existente))
## # A tibble: 10 × 2
## ano atack_rate
## <dbl> <dbl>
## 1 2014 0.0484
## 2 2015 0.0371
## 3 2016 0.0555
## 4 2017 0.0233
## 5 2018 0.0549
## 6 2019 0.0303
## 7 2020 0.0259
## 8 2021 0.0229
## 9 2022 0.0350
## 10 2023 0.0421
# Eventos cuyas poblaciones son 0,
# 10759,10893,11063
#Existen eventos donde los afectados son menores a los positivos
# correcting
v2 <- data.frame(v2 %>% mutate(existente_cor = ifelse(existente < pos, pos, existente)))
# v2 <- data.frame(v2 %>% mutate(afectados_cor = ifelse(afectados < pos & definitivo == "caso", pos, afectados)))
v2$afectados_cor <- v2$mortos +v2$sacrifi - v2$pos
v2 <- data.frame(v2 %>% mutate(afectados_cor2 = ifelse(afectados_cor < 0 , -(afectados_cor), afectados_cor)))
library(RSurveillance)
ap <- ap(v2$pos, v2$total_muestras, type = "wilson", conf = 0.95)
v2$ap <- ap$proportion
v2$l <- ap$lower
v2$u <- ap$upper
sum(v2$afetados)/sum(v2$existente)
## [1] 0.1858084
v2 %>%
group_by(ano)%>%
summarise(notifi=length(unique(orden)),
brotes=sum(definitivo == 'caso'),
casos=sum(pos),
muestras=sum(total_muestras),
poblacion=sum(existente_cor),
prev=round(mean(ap, na.rm = TRUE)*100,2),
l=round(mean(l, na.rm = TRUE)*100,2),
u=round(mean(u, na.rm = TRUE)*100,2))
## # A tibble: 10 × 9
## ano notifi brotes casos muestras poblacion prev l u
## <dbl> <int> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 2014 38 24 90 199 1861 48.4 21.6 78.5
## 2 2015 222 84 267 1561 7194 27.2 10.6 61.4
## 3 2016 126 30 125 835 2254 12.7 5.19 55.7
## 4 2017 160 39 149 1000 6396 12.8 4.97 60.0
## 5 2018 177 60 215 1206 3917 18.2 6.44 63.1
## 6 2019 159 34 129 951 4271 11.8 5.13 57.2
## 7 2020 101 21 58 625 2237 10.2 3.88 56.2
## 8 2021 111 11 48 780 2094 5.12 2.19 45.8
## 9 2022 73 16 61 596 1753 11.8 4.64 52.3
## 10 2023 23 5 16 98 380 17.2 6.9 64.5
v2 %>%
group_by(ano)%>%
filter(definitivo == "caso") %>%
summarise(notifi=length(unique(orden)),
casos=sum(pos),
muestras=sum(total_muestras),
poblacion=sum(existente),
mortalidad=sum(afectados_cor2)/sum(existente_cor))
## # A tibble: 10 × 6
## ano notifi casos muestras poblacion mortalidad
## <dbl> <int> <dbl> <dbl> <dbl> <dbl>
## 1 2014 24 90 152 1726 0.232
## 2 2015 84 267 450 1686 0.308
## 3 2016 30 125 267 885 0.427
## 4 2017 39 149 547 921 0.334
## 5 2018 60 215 763 1765 0.282
## 6 2019 34 129 403 852 0.235
## 7 2020 21 58 248 408 0.174
## 8 2021 11 48 103 276 0.467
## 9 2022 16 61 240 756 0.460
## 10 2023 5 16 36 42 0.333
v2 %>%
# group_by(month)%>%
group_by(Month)%>%
# filter(ano <2020)%>%
# filter(ano >2016)%>%
summarise(notifi_geral=length(unique(orden)),
casos=sum(definitivo == 'caso'))%>%
ggplot()+
geom_col(aes(Month,notifi_geral), fill="#984EA3")+
scale_y_continuous(breaks= pretty_breaks())+
labs(y="Notificaciones vigilancia especifica PPC",
x="Meses")+
theme_minimal() +
theme(text = element_text(size = 14))
# notificaciones por ano
v2 %>%
# group_by(Month)%>%
group_by(ano)%>%
# group_by(week)%>%
filter(ano > 2013)%>%
# filter(ano >2016)%>%
summarise(notifi_geral=length(unique(orden)),
casos=sum(definitivo == 'caso'))%>%
ggplot()+
geom_col(aes(ano,notifi_geral), fill="#984EA3")+
geom_text(aes(ano, notifi_geral, label=(notifi_geral)), nudge_y = 7)+
scale_y_continuous(breaks= pretty_breaks())+
labs(y="Notificaciones vigilancia dirigida PPC",
x="Anos")+
theme_minimal() +
theme(text = element_text(size = 14))
v2 %>%
# group_by(Month)%>%
group_by(ano)%>%
# group_by(week)%>%
# filter(ano > 2014)%>%
# filter(ano >2016)%>%
summarise(notifi_geral=length(unique(orden)),
casos=sum(definitivo == 'caso'))%>%
ggplot()+
geom_col(aes(ano,notifi_geral), fill="#377EB8")+
geom_col(aes(ano,casos), fill="#984EA3")+
geom_text(aes(ano, notifi_geral, label=(notifi_geral)), nudge_y = 7)+
geom_text(aes(ano, casos, label=(casos)), nudge_y = 6)+
scale_y_continuous(breaks= pretty_breaks())+
labs(y="Notificaciones y casos vigilancia PPC",
x="Anos")+
theme_minimal() +
theme(text = element_text(size = 14))
v2 %>%
# group_by(Month)%>%
group_by(ano)%>%
# group_by(week)%>%
filter(ano > 2014)%>%
# filter(ano >2016)%>%
summarise(notificacion_vigilancia_dirigida=length(unique(orden)),
casos=sum(definitivo == 'caso'))
## # A tibble: 9 × 3
## ano notificacion_vigilancia_dirigida casos
## <dbl> <int> <int>
## 1 2015 222 84
## 2 2016 126 30
## 3 2017 160 39
## 4 2018 177 60
## 5 2019 159 34
## 6 2020 101 21
## 7 2021 111 11
## 8 2022 73 16
## 9 2023 23 5
# Casos por meses
v2 %>%
group_by(month)%>%
# group_by(ano)%>%
# group_by(week)%>%
filter(ano > 2014)%>%
# filter(ano >2016)%>%
summarise(notifi_geral=length(unique(orden)),
casos=sum(definitivo == 'caso'))%>%
ggplot()+
geom_col(aes(month,casos), fill="#984EA3")+
geom_text(aes(month, casos, label=(casos)), nudge_y = 3)+
scale_y_continuous(breaks= pretty_breaks())+
labs(y="Casos PPC",
x="Meses")+
theme_minimal() +
theme(text = element_text(size = 14))
# Casos por meses
v2 %>%
group_by(Month)%>%
# group_by(ano)%>%
# group_by(week)%>%
# filter(ano > 2013)%>%
# filter(ano >2016)%>%
summarise(notifi_geral=length(unique(orden)),
casos=sum(definitivo == 'caso'))%>%
ggplot()+
geom_col(aes(Month,casos), fill="#984EA3")+
geom_text(aes(Month, casos, label=(casos)), nudge_y = 3)+
scale_y_continuous(breaks= pretty_breaks())+
labs(y="Casos PPC",
x="Meses")+
theme_minimal() +
theme(text = element_text(size = 14))
# Casos por meses
v2 %>%
group_by(Month)%>%
filter(definitivo == "caso") %>%
# group_by(ano)%>%
# group_by(week)%>%
# filter(ano > 2013)%>%
# filter(ano >2016)%>%
summarise(notifi_geral=length(unique(orden)),
afectados=sum(afetados))%>%
ggplot()+
geom_col(aes(Month,afectados), fill="#984EA3")+
# geom_text(aes(Month, afectados, label=(afectados)), nudge_y = 3)+
scale_y_continuous(breaks= pretty_breaks())+
labs(y="Casos PPC",
x="Meses")+
theme_minimal() +
theme(text = element_text(size = 10))
library(tidyr)
v2 %>%
group_by(definitivo, week)%>%
filter(ano > 2019) %>%
summarise(Casos=sum(pos),
Total_muestras=sum(total_muestras),
brotes=sum(definitivo == 'caso')) %>%
mutate(brotes=ifelse(brotes==0,NA,brotes)) %>%
ggplot()+
geom_col(aes(week, Total_muestras), fill="#377EB8")+
# geom_col(aes(week, Casos), fill="#984EA3") +
# geom_point(aes(week, brotes*30), size=0.2)+
scale_y_continuous(
sec.axis = sec_axis(trans = ~. /30, name="Número de brotes")) +
labs(fill="",
x="Semana epidemiologica (2021)",
y="Total de animales muestreados por semana")+
theme_minimal()
## `summarise()` has grouped output by 'definitivo'. You can override using the
## `.groups` argument.
Considerando la sensibilidad del sistema de vigilancia
library(tidyr)
v2 %>%
group_by(definitivo, week)%>%
# filter(ano > 2020) %>%
summarise(Casos=sum(pos),
Total_muestras=sum(total_muestras),
brotes=sum(definitivo == 'caso')) %>%
mutate(brotes=ifelse(brotes==0,NA,brotes)) %>%
ggplot()+
geom_col(aes(week, Total_muestras), fill="#377EB8", alpha=0.5)+
geom_col(aes(week, Casos), fill="black", alpha=0.5) +
geom_col(aes(week, (Casos*95)/5), fill="red", alpha=0.3) +
geom_point(aes(week, brotes), size=0.2)+
geom_point(aes(week, (((brotes*2)*95)/5)), size=0.2, alpha = 0.5)+
scale_y_continuous(
sec.axis = sec_axis(trans = ~. /30, name="Número de brotes")) +
labs(fill="",
x="Semana epidemiologica (2021)",
y="Total muestreados semana simulando Se real")+
theme_minimal()
## `summarise()` has grouped output by 'definitivo'. You can override using the
## `.groups` argument.
## Warning: Removed 349 rows containing missing values (geom_point).
## Removed 349 rows containing missing values (geom_point).
library(tidyr)
v2 %>%
group_by(definitivo, Month)%>%
summarise(Casos=sum(pos),
Total_muestras=sum(total_muestras),
brotes=sum(definitivo == 'caso')) %>%
mutate(brotes=ifelse(brotes==0,NA,brotes)) %>%
ggplot()+
geom_col(aes(Month, Total_muestras), fill="#7AD151FF")+
geom_col(aes(Month, Casos), fill="#440154FF") +
geom_point(aes(Month, brotes*20), size=0.4, color="#2a788eff")+
scale_y_continuous(
sec.axis = sec_axis(trans = ~. /20, name="Number of outbreaks")) +
labs(fill="",
x=NULL,
y="Montly processed samples")+
theme_minimal()+
theme(text = element_text(size = 14))
## `summarise()` has grouped output by 'definitivo'. You can override using the
## `.groups` argument.
## Warning: Removed 98 rows containing missing values (geom_point).
Vigilancia dirigida El término vigilancia dirigida se puede utilizar refiriéndose a la vigilancia dirigida a una enfermedad específica (Cameron, 2014). La distinción entre vigilancia general y dirigida depende del sistema de detección de enfermedades que se utilice. La vigilancia dirigida se basa en el uso de pruebas que pueden dar una respuesta sí / no para una enfermedad específica. Ejemplos incluyen:
• Reacción en cadena de la polimerasa (PCR) • Ensayo inmunoabsorbente ligado a enzimas (ELISA)
Necesito llegar a los mismos resultados sin tener la columna de DIAGNOSTICO DEFINITIVO en el sizse. Filtro la especie porcinos, luego la prueba solicitada diferente a Anticuerpo, luego el detalle diagnostico, luego en prueba solicitada unicamente los que inicien con PESTE PORCINA…. (aqui hay antigeno, PCR qPCR y PCR out), al final asigno una nueva columna que indica cada linea como caso o notificacion.
#criando o v2 novo com as notificações extra
# Linkage dos reportes
library(stringr)
v0 <- full_join(vc, vr)
## Joining, by = c("# ORDEN", "# ALERTA", "SEMANA", "PROVINCIA", "CANTÓN",
## "PARROQUIA", "UTM WGS-84", "C.C/C.I/RUC", "PROPIETARIO", "PREDIO", "T.
## EXPLOTACIÓN", "NOTIFICADOR", "F. 1er ENFERMO", "F. NOTIFICACIÓN", "F. 1era
## VISITA", "SÍNDROME PRESUNTIVO", "RESULTADO", "ESPECIE E. SANITARIO", "EDAD",
## "ESTADO", "¿SUPERVISADO?")
v1 <- full_join(v0,vge)
## Joining, by = c("# ORDEN", "# ALERTA", "F. REGISTRO", "SEMANA", "PROVINCIA",
## "CANTÓN", "PARROQUIA", "UTM WGS-84", "C.C/C.I/RUC", "PROPIETARIO", "PREDIO",
## "T. EXPLOTACIÓN", "NOTIFICADOR", "F. 1er ENFERMO", "F. NOTIFICACIÓN", "F. 1era
## VISITA", "SÍNDROME PRESUNTIVO", "PATOLOGÍA", "RESULTADO", "EDAD", "ESTADO",
## "¿SUPERVISADO?", "MUESTREO POR EEB", "T. ALIMENTACIÓN", "RAZÓN MUESTREO")
colnames(v1) <- tolower(colnames(v1))
colnames(v1) <- gsub(" ", "_", colnames(v1))
colnames(v1) <- gsub("\\.", "", colnames(v1))
colnames(v1) <- gsub("#_", "", colnames(v1))
colnames(v1) <- gsub("\\?", "", colnames(v1))
colnames(v1) <- gsub("\\¿", "", colnames(v1))
# table(v1$especie)
# table(v1$prueba_solicitada)
# Filtro porcinos
v2 <- v1 %>%
filter(especie == "PORCINOS")
#Filtro vigilancia especifica PRRS.
# Todas aquellas notificaciones en las cuales el detalle diagnóstico fue PRRS
v2 <- v2 %>%
filter(patología_notificación == "SÍNDROME DISGENÉSICO Y RESPIRATORIO PORCINO")%>%
group_by(orden, provincia, cantón, parroquia, `cc/ci/ruc`, propietario, semana, `utm_wgs-84`, predio, t_explotación, notificador, f_1er_enfermo, f_notificación, f_1era_visita, síndrome_presuntivo,
patología, especie, especie_informe_resultados, edad, f_registro, f_cierre, prueba_solicitada, registro, vacunó, focal, dosis_focal, perifocal, dosis_perifocal,
especie_f, colecta)%>%
group_by(orden, provincia, cantón, parroquia, `cc/ci/ruc`, propietario, semana, `utm_wgs-84`, predio, t_explotación, notificador,
f_1er_enfermo, f_notificación, f_1era_visita, síndrome_presuntivo,
patología, especie, especie_informe_resultados, edad, f_registro, f_cierre,
registro, vacunó, focal, dosis_focal, perifocal, dosis_perifocal,
especie_f, colecta)%>%
summarise(existente=sum(existentes, muertos, sacrificados), enfermo=sum(enfermos), mortos=sum(muertos),
sacrifi=sum(sacrificados), afetados=sum(muertos,sacrificados),
pos=sum(positivos), total_muestras=sum(cant_muestras),
indeterm=sum(indeterminados), reactivo=sum(reactivos))%>%
mutate(definitivo=ifelse(pos>=1,"caso", "notifi"))
## `summarise()` has grouped output by 'orden', 'provincia', 'cantón',
## 'parroquia', 'cc/ci/ruc', 'propietario', 'semana', 'utm_wgs-84', 'predio',
## 't_explotación', 'notificador', 'f_1er_enfermo', 'f_notificación',
## 'f_1era_visita', 'síndrome_presuntivo', 'patología', 'especie',
## 'especie_informe_resultados', 'edad', 'f_registro', 'f_cierre', 'registro',
## 'vacunó', 'focal', 'dosis_focal', 'perifocal', 'dosis_perifocal', 'especie_f'.
## You can override using the `.groups` argument.
length(unique(v2$orden))
## [1] 17
table(v2$definitivo)
##
## caso notifi
## 15 2
plot(v2$existente)
hist(log(v2$existente))
table(v2$existente)
##
## 15 19 54 78 120 156 200 202 410 508 1198 1287 1680 2655 2835 3489
## 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## 5714
## 1
summary(v2$existente)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 15 120 410 1213 1680 5714
#agregando ano
v2$ano <- year(dmy(v2$f_1er_enfermo))
v2$month <- month(dmy(v2$f_1er_enfermo))
# Asignando columna de fechas para graficos
v2$f_1er_enfermo <- dmy(v2$f_1er_enfermo)
# Changing to floor date week
v2$week <- floor_date(v2$f_1er_enfermo, "week")
# Best visualizations by month
v2$Month <- floor_date(v2$f_1er_enfermo, "month")
length(unique(v2$orden))
## [1] 17
#64 com atualizacao 10/12/2021 todas as patologias
library(tidyr)
v2 %>%
group_by(ano, definitivo)%>%
summarise(numero=n())%>%
spread(value="numero", key="definitivo")
## `summarise()` has grouped output by 'ano'. You can override using the `.groups`
## argument.
## # A tibble: 5 × 3
## # Groups: ano [5]
## ano caso notifi
## <dbl> <int> <int>
## 1 2015 1 NA
## 2 2017 6 NA
## 3 2018 4 NA
## 4 2021 4 1
## 5 2022 NA 1
v2 %>%
# group_by(month)%>%
group_by(Month)%>%
# filter(ano <2020)%>%
# filter(ano >2016)%>%
summarise(notifi_geral=length(unique(orden)),
casos=sum(definitivo == 'caso'))%>%
ggplot()+
geom_col(aes(Month,notifi_geral), fill="#f98e09")+
scale_y_continuous(breaks= pretty_breaks())+
labs(y="Notif vigilancia especifica PRRS",
x="Meses")+
theme_minimal() +
theme(text = element_text(size = 14))
# notificaciones por ano
v2 %>%
# group_by(Month)%>%
group_by(ano)%>%
# group_by(week)%>%
filter(ano > 2014)%>%
# filter(ano >2016)%>%
summarise(notifi_geral=length(unique(orden)),
casos=sum(definitivo == 'caso'))%>%
ggplot()+
geom_col(aes(ano,notifi_geral), fill="#f98e09")+
geom_text(aes(ano, notifi_geral, label=(notifi_geral)), nudge_y = 1)+
scale_y_continuous(breaks= pretty_breaks())+
labs(y="Notificaciones vigilancia dirigida PRRS",
x="Anos")+
theme_minimal() +
theme(text = element_text(size = 14))
v2 %>%
# group_by(Month)%>%
group_by(ano)%>%
# group_by(week)%>%
filter(ano > 2014)%>%
# filter(ano >2016)%>%
summarise(notifi_geral=length(unique(orden)),
casos=sum(definitivo == 'caso'))%>%
ggplot()+
geom_col(aes(ano,notifi_geral), fill="#fcffa4")+
geom_col(aes(ano,casos), fill="#f98e09")+
geom_text(aes(ano, notifi_geral, label=(notifi_geral)), nudge_y = 1)+
geom_text(aes(ano, casos, label=(casos)), nudge_y = 0.5)+
scale_y_continuous(breaks= pretty_breaks())+
labs(y="Notificaciones y casos vigilancia PRRS",
x="Anos")+
theme_minimal() +
theme(text = element_text(size = 14))
v2 %>%
# group_by(Month)%>%
group_by(ano)%>%
# group_by(week)%>%
# filter(ano > 2014)%>%
# filter(ano >2016)%>%
summarise(notificacion_vigilancia_dirigida=length(unique(orden)),
casos=sum(definitivo == 'caso'))
## # A tibble: 5 × 3
## ano notificacion_vigilancia_dirigida casos
## <dbl> <int> <int>
## 1 2015 1 1
## 2 2017 6 6
## 3 2018 4 4
## 4 2021 5 4
## 5 2022 1 0
# Casos por meses
v2 %>%
group_by(month)%>%
# group_by(ano)%>%
# group_by(week)%>%
filter(ano > 2014)%>%
# filter(ano >2016)%>%
summarise(notifi_geral=length(unique(orden)),
casos=sum(definitivo == 'caso'))%>%
ggplot()+
geom_col(aes(month,casos), fill="#f98e09")+
geom_text(aes(month, casos, label=(casos)), nudge_y = 0.2)+
scale_y_continuous(breaks= pretty_breaks())+
labs(y="Casos PRRS",
x="Meses")+
theme_minimal() +
theme(text = element_text(size = 14))
# Casos por meses
v2 %>%
group_by(Month)%>%
# group_by(ano)%>%
# group_by(week)%>%
# filter(ano > 2013)%>%
# filter(ano >2016)%>%
summarise(notifi_geral=length(unique(orden)),
casos=sum(definitivo == 'caso'))%>%
ggplot()+
geom_col(aes(Month,casos), fill="#f98e09")+
geom_text(aes(Month, casos, label=(casos)), nudge_y = 0.2) +
scale_y_continuous(breaks= pretty_breaks())+
labs(y="Casos PRRS",
x="Meses")+
theme_minimal() +
theme(text = element_text(size = 14))
# Casos por meses
v2 %>%
group_by(Month)%>%
filter(definitivo == "caso") %>%
# group_by(ano)%>%
# group_by(week)%>%
# filter(ano > 2013)%>%
# filter(ano >2016)%>%
summarise(notifi_geral=length(unique(orden)),
afectados=sum(afetados))%>%
ggplot()+
geom_col(aes(Month,afectados), fill="#f98e09")+
# geom_text(aes(Month, afectados, label=(afectados)), nudge_y = 3)+
scale_y_continuous(breaks= pretty_breaks())+
labs(y="Casos PRRS (número de animales afectados)",
x="Meses")+
theme_minimal() +
theme(text = element_text(size = 10))
library(tidyr)
v2 %>%
group_by(orden, month)%>%
summarise(Casos=sum(pos),
Total_muestras=sum(total_muestras),
Prevalencia=100*(round((Casos/Total_muestras),3))) %>%
ggplot()+
geom_boxplot(aes(month, Total_muestras, group=factor(month))) + scale_color_brewer(palette="PiYG")+
labs(x="meses",
y="Total de muestras",
fill=NULL)+
theme_minimal()
## `summarise()` has grouped output by 'orden'. You can override using the
## `.groups` argument.
# refazer
# v2 %>%
# group_by(Month, definitivo)%>%
# summarise(nu=n()) %>%
# ggplot()+
# geom_col(aes(Month, nu, fill=definitivo))+
# labs(y="Número de eventos sanitarios",
# x="",
# fill="") +
# theme_minimal() +
# theme(text = element_text(size = 14))+
# scale_fill_brewer(palette="PuOr", direction = -1)
library(tidyr)
v2 %>%
group_by(definitivo, week)%>%
summarise(Casos=sum(pos),
Total_muestras=sum(total_muestras),
brotes=sum(definitivo == 'caso')) %>%
mutate(brotes=ifelse(brotes==0,NA,brotes)) %>%
ggplot()+
geom_col(aes(week, Total_muestras), fill="#fcffa4")+
geom_col(aes(week, Casos), fill="#f98e09") +
geom_point(aes(week, brotes*55), size=0.4)+
scale_y_continuous(
sec.axis = sec_axis(trans = ~. /55, name="Número de brotes")) +
labs(fill="",
x="Semana epidemiologica (2014-2021)",
y="Total de animales muestreados por semana")+
theme_minimal()
## `summarise()` has grouped output by 'definitivo'. You can override using the
## `.groups` argument.
## Warning: Removed 2 rows containing missing values (geom_point).
library(tidyr)
v2 %>%
group_by(ano,definitivo, week)%>%
filter(ano > 2014) %>%
summarise(Casos=sum(pos),
Total_muestras=sum(total_muestras),
brotes=sum(definitivo == 'caso')) %>%
mutate(brotes=ifelse(brotes==0,NA,brotes)) %>%
ggplot()+
geom_col(aes(week, Total_muestras), fill="#fcffa4")+
geom_col(aes(week, Casos), fill="#f98e09") +
geom_point(aes(week, brotes*55), size=0.4)+
scale_y_continuous(
sec.axis = sec_axis(trans = ~. /55, name="Número de brotes")) +
labs(fill="",
x="Semana epidemiologica",
y="Total de animales muestreados por semana")+
theme_minimal()+
facet_grid(rows = vars(ano))
## `summarise()` has grouped output by 'ano', 'definitivo'. You can override using
## the `.groups` argument.
## Warning: Removed 2 rows containing missing values (geom_point).
library(tidyr)
v2 %>%
group_by(definitivo, Month)%>%
summarise(Casos=sum(pos),
Total_muestras=sum(total_muestras),
brotes=sum(definitivo == 'caso')) %>%
mutate(brotes=ifelse(brotes==0,NA,brotes)) %>%
ggplot()+
geom_col(aes(Month, Total_muestras), fill="#fcffa4")+
geom_col(aes(Month, Casos), fill="#f98e09") +
geom_point(aes(Month, brotes*55), size=0.2)+
scale_y_continuous(
sec.axis = sec_axis(trans = ~. /55, name="Número de brotes")) +
labs(fill="",
x="Semana epidemiologica (2014-2021)",
y="Total de animales muestreados por mes")+
theme_minimal()
## `summarise()` has grouped output by 'definitivo'. You can override using the
## `.groups` argument.
## Warning: Removed 2 rows containing missing values (geom_point).
##Prevalencia media por meses
library(tidyr)
v2 %>%
group_by(ano, Month)%>%
summarise(Casos=sum(pos),
Total_muestras=sum(total_muestras),
Prevalencia=100*(round((Casos/Total_muestras),3))) %>%
ggplot()+
geom_boxplot(aes(ano, Prevalencia, group=Month),fill="#f98e09")
## `summarise()` has grouped output by 'ano'. You can override using the `.groups`
## argument.
Vigilancia General para Lengua azul
La vigilancia general no se centra en una enfermedad en particular, pero puede usarse para detectar cualquier enfermedad o patógeno. Por ejemplo, el sistema de notificación de enfermedades de los agricultores es un sistema de vigilancia general, ya que se puede notificar cualquier enfermedad. Sin embargo, no todas las enfermedades se notificarán con la misma fiabilidad.
Es más probable que los agricultores notifiquen enfermedades que muestran signos claros y tienen un impacto significativo (por ejemplo, muchos animales están infectados o la enfermedad provoca la muerte, como la septicemia hemorrágica) que las enfermedades que muestran pocos signos o que no lo hacen, o pueden no resultar en un impacto económico inmediato (como el causado por infecciones parasitarias intestinales).
Algunas pruebas de laboratorio, como la histopatología, permiten la detección de muchas enfermedades diferentes, en lugar de una sola enfermedad.
Una característica importante de la vigilancia general es que no solo puede detectar enfermedades conocidas de interés, sino que también puede detectar enfermedades endémicas nuevas, emergentes, exóticas o desconocidas. En otras palabras, no es necesario estar buscando una enfermedad específica para encontrarla. (Cameron, 2014). Este es el caso en lengua azul, que ha sido detectada al ser diferencial de otras enfermedades vesiculares sin estar buscándola.
# Filtrando LENGUA AZUL
# v2 <- v1 %>%
# filter(especie == "BOVINOS")
v2 <- v1 %>%
filter(patología_notificación == "LENGUA AZUL")%>%
# filter(stringr::str_detect(prueba_solicitada, "LENGUA"))%>%
group_by(orden, provincia, cantón, parroquia, `cc/ci/ruc`, propietario, semana, `utm_wgs-84`, predio,t_explotación, notificador,
f_1er_enfermo, f_notificación, f_1era_visita, síndrome_presuntivo,
especie, especie_informe_resultados, edad, f_registro, f_cierre,
registro, vacunó, focal, dosis_focal, perifocal, dosis_perifocal,
especie_f, colecta)%>%
summarise(existente=sum(existentes, muertos, sacrificados), enfermo=sum(enfermos), mortos=sum(muertos),
sacrifi=sum(sacrificados), afetados=sum(muertos,sacrificados),
pos=sum(positivos), total_muestras=sum(cant_muestras), reactivo=sum(reactivos))
## `summarise()` has grouped output by 'orden', 'provincia', 'cantón',
## 'parroquia', 'cc/ci/ruc', 'propietario', 'semana', 'utm_wgs-84', 'predio',
## 't_explotación', 'notificador', 'f_1er_enfermo', 'f_notificación',
## 'f_1era_visita', 'síndrome_presuntivo', 'especie',
## 'especie_informe_resultados', 'edad', 'f_registro', 'f_cierre', 'registro',
## 'vacunó', 'focal', 'dosis_focal', 'perifocal', 'dosis_perifocal', 'especie_f'.
## You can override using the `.groups` argument.
# Agregando ano
v2$ano <- year(dmy(v2$f_1er_enfermo))
v2$month <- month(dmy(v2$f_1er_enfermo))
v1 %>%
filter(síndrome_presuntivo == "VESICULARES") %>%
group_by(patología_notificación) %>%
summarise(numero=length(unique(orden)))
## # A tibble: 14 × 2
## patología_notificación numero
## <chr> <int>
## 1 DESESTIMADO 2
## 2 DIARREA VIRAL BOVINA 80
## 3 ENFERMEDAD VESICULAR 1
## 4 ENFERMEDAD VESICULAR PORCINA 1
## 5 ESTOMATITIS VESICULAR 22
## 6 ESTOMATITIS VESICULAR INDIANA 48
## 7 ESTOMATITIS VESICULAR NEWJERSEY 98
## 8 FIEBRE AFTOSA 36
## 9 LENGUA AZUL 111
## 10 NEGATIVO A FIEBRE AFTOSA Y ESTOMATITIS VESICULAR 22
## 11 NO APLICA 568
## 12 RINOTRAQUEÍTIS INFECCIOSA BOVINA/VULVOVAGINITIS PUSTULAR INFECCIOSA 167
## 13 TRAUMATISMO 2
## 14 <NA> 177
length(unique(v2$orden))
## [1] 118
#1758 com atualizacao 10/10/2021 todas as patologias
#1863 com atualizacao 10/12/2021 todas as patologias
# Nmero de notificaciones generales por especie
# Asignando columna de fechas para graficos
v2$f_1er_enfermo <- dmy(v2$f_1er_enfermo)
# Changing to floor date week
v2$week <- floor_date(v2$f_1er_enfermo, "week")
# Best visualizations by month
v2$Month <- floor_date(v2$f_1er_enfermo, "month")
v2 %>%
group_by(ano)%>%
# filter(ano >2020)%>%
summarise(notifi=length(unique(orden)))
## # A tibble: 10 × 2
## ano notifi
## <dbl> <int>
## 1 2014 8
## 2 2015 16
## 3 2016 30
## 4 2017 14
## 5 2018 21
## 6 2019 15
## 7 2020 7
## 8 2021 2
## 9 2022 2
## 10 2023 3
v2 %>%
group_by(ano, especie)%>%
# filter(ano >2020)%>%
summarise(notifi=length(unique(orden)))
## `summarise()` has grouped output by 'ano'. You can override using the `.groups`
## argument.
## # A tibble: 12 × 3
## # Groups: ano [10]
## ano especie notifi
## <dbl> <chr> <int>
## 1 2014 BOVINOS 7
## 2 2014 <NA> 1
## 3 2015 BOVINOS 16
## 4 2016 BOVINOS 29
## 5 2016 OVINOS 1
## 6 2017 BOVINOS 14
## 7 2018 BOVINOS 21
## 8 2019 BOVINOS 15
## 9 2020 BOVINOS 7
## 10 2021 BOVINOS 2
## 11 2022 BOVINOS 2
## 12 2023 BOVINOS 3
v2 %>%
# group_by(month)%>%
group_by(Month)%>%
# filter(ano <2020)%>%
# filter(ano >2016)%>%
summarise(notifi_geral=length(unique(orden)),
casos=sum(pos >= 1, na.rm = TRUE))%>%
ggplot()+
geom_col(aes(Month,notifi_geral), fill="#377EB8")+
scale_y_continuous(breaks= pretty_breaks())+
labs(y="Notificaciones vigilancia general BTV",
x="Meses")+
theme_minimal() +
theme(text = element_text(size = 14))
v2 %>%
# group_by(month)%>%
group_by(Month)%>%
# filter(ano <2020)%>%
# filter(ano >2016)%>%
summarise(notifi_geral=length(unique(orden)),
casos=sum(pos >= 1, na.rm = TRUE))%>%
ggplot()+
geom_col(aes(Month,notifi_geral, color=notifi_geral))+
scale_y_continuous(breaks= pretty_breaks())+
labs(y="Notificaciones vigilancia general BTV",
x="Meses")+
theme_minimal() +
theme(text = element_text(size = 8))
v2 %>%
# group_by(month)%>%
group_by(Month,síndrome_presuntivo)%>%
# filter(ano <2020)%>%
# filter(ano >2016)%>%
summarise(notifi_geral=length(unique(orden)),
casos=sum(pos >= 1, na.rm = TRUE))%>%
ggplot()+
geom_col(aes(Month,notifi_geral,fill=síndrome_presuntivo))+
scale_y_continuous(breaks= pretty_breaks())+
labs(y="Notificaciones vigilancia general BTV",
x="Meses")+
theme_minimal() +
theme(text = element_text(size = 10))
## `summarise()` has grouped output by 'Month'. You can override using the
## `.groups` argument.
El término vigilancia dirigida se puede utilizar refiriéndose a la vigilancia dirigida a una enfermedad específica (Cameron, 2014).
La distinción entre vigilancia general y dirigida depende del sistema de detección de enfermedades que se utilice. La vigilancia dirigida se basa en el uso de pruebas que pueden dar una respuesta sí / no para una enfermedad específica. Ejemplos incluyen:
• reacción en cadena de la polimerasa (PCR) • ensayo inmunoabsorbente ligado a enzimas (ELISAc) en el caso de Lengua azul.
Existe columna de DIAGNOSTICO DEFINITIVO en el sizse?.
#criando o v2 novo com as notificações extra
# Linkage dos reportes
library(stringr)
#Filtro vigilancia especifica BTV.
# Todas aquellas notificaciones en las cuales
# se requirio prueba para PPC
# v2 <- v1 %>%
# filter(stringr::str_detect(prueba_solicitada, "LENGUA"))
###
v2 <- v1 %>%
group_by(orden, provincia, cantón, parroquia, `cc/ci/ruc`, propietario, semana, t_explotación, notificador, f_1er_enfermo, f_notificación, f_1era_visita, síndrome_presuntivo,
patología, especie, especie_informe_resultados, edad, f_registro, f_cierre, prueba_solicitada,
registro, vacunó, focal, dosis_focal, perifocal, dosis_perifocal,
especie_f, colecta)%>%
filter(str_detect(prueba_solicitada, "LENGUA"))%>%
group_by(orden, provincia, cantón, parroquia, `cc/ci/ruc`, propietario, semana, `utm_wgs-84`, predio,t_explotación, notificador,
f_1er_enfermo, f_notificación, f_1era_visita, síndrome_presuntivo,
patología, especie, especie_informe_resultados, edad, f_registro, f_cierre,
registro, vacunó, focal, dosis_focal, perifocal, dosis_perifocal,
especie_f, colecta)%>%
summarise(existente=sum(existentes, muertos, sacrificados), enfermo=sum(enfermos), mortos=sum(muertos),
sacrifi=sum(sacrificados), afetados=sum(muertos,sacrificados),
pos=sum(positivos), total_muestras=sum(cant_muestras),
indeterm=sum(indeterminados), reactivo=sum(reactivos))%>%
mutate(definitivo=ifelse(pos>=1,"caso", ".no caso"))
## `summarise()` has grouped output by 'orden', 'provincia', 'cantón',
## 'parroquia', 'cc/ci/ruc', 'propietario', 'semana', 'utm_wgs-84', 'predio',
## 't_explotación', 'notificador', 'f_1er_enfermo', 'f_notificación',
## 'f_1era_visita', 'síndrome_presuntivo', 'patología', 'especie',
## 'especie_informe_resultados', 'edad', 'f_registro', 'f_cierre', 'registro',
## 'vacunó', 'focal', 'dosis_focal', 'perifocal', 'dosis_perifocal', 'especie_f'.
## You can override using the `.groups` argument.
length(unique(v2$orden))
## [1] 381
table(v2$definitivo)
##
## .no caso caso
## 57 324
plot(v2$existente)
hist(log(v2$existente))
table(v2$existente)
##
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
## 7 16 17 16 18 20 13 14 15 17 5 11 9 10 11 5
## 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
## 9 6 5 10 6 5 5 10 4 4 2 5 3 6 3 4
## 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
## 1 2 1 2 1 2 2 1 1 2 3 2 1 4 1 3
## 49 50 51 53 54 55 56 57 58 60 63 65 69 71 74 80
## 2 3 2 1 4 1 1 2 1 1 1 1 3 1 1 1
## 81 85 87 93 94 100 105 114 116 121 122 124 129 130 132 162
## 1 1 3 2 1 2 1 2 1 1 1 2 1 1 1 1
## 170 176 206 216 229 351 375 384 456 800 1210 1611 4755
## 1 1 1 1 1 1 1 1 1 1 1 1 1
summary(v2$existente)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.00 7.00 15.00 51.59 31.00 4755.00
#agregando ano
v2$ano <- year(dmy(v2$f_1er_enfermo))
v2$month <- month(dmy(v2$f_1er_enfermo))
v2$week <- week(dmy(v2$f_1er_enfermo))
# Asignando columna de fechas para graficos
v2$f_1er_enfermo <- dmy(v2$f_1er_enfermo)
# Changing to floor date week
v2$Week <- floor_date(v2$f_1er_enfermo, "week")
# Best visualizations by month
v2$Month <- floor_date(v2$f_1er_enfermo, "month")
length(unique(v2$orden))
## [1] 381
#380 com atualizacao 10/12/2021 todas as patologias
length(unique(paste(v2$`cc/ci/ruc`, v2$predio)))
## [1] 380
#380 com atualizacao 10/12/2021 todas as patologias
library(tidyr)
v2 %>%
group_by(ano)%>%
summarise(Notificaciones=length(unique(orden)),
Casos=sum(definitivo == "2 caso"),
porcentaje_positivos=round((Casos/Notificaciones),2))
## # A tibble: 9 × 4
## ano Notificaciones Casos porcentaje_positivos
## <dbl> <int> <int> <dbl>
## 1 2014 1 0 0
## 2 2015 38 0 0
## 3 2016 82 0 0
## 4 2017 55 0 0
## 5 2018 149 0 0
## 6 2019 28 0 0
## 7 2020 19 0 0
## 8 2021 8 0 0
## 9 2022 1 0 0
library(tidyr)
v2 %>%
group_by(ano)%>%
summarise(Notificaciones=length(unique(paste(`cc/ci/ruc`, predio))),
Casos=sum(definitivo == "2 caso"),
prev=round((Casos/Notificaciones),2))
## # A tibble: 9 × 4
## ano Notificaciones Casos prev
## <dbl> <int> <int> <dbl>
## 1 2014 1 0 0
## 2 2015 38 0 0
## 3 2016 82 0 0
## 4 2017 55 0 0
## 5 2018 148 0 0
## 6 2019 28 0 0
## 7 2020 19 0 0
## 8 2021 8 0 0
## 9 2022 1 0 0
# Casos por meses
v2 %>%
group_by(month, definitivo)%>%
summarise(nu=n()) %>%
ggplot()+
geom_col(aes(month, nu, fill=definitivo))+
labs(y="Número de eventos sanitarios",
x="",
fill="")+
theme_minimal() +
theme(text = element_text(size = 14))+
scale_fill_brewer(palette="Blues")
## `summarise()` has grouped output by 'month'. You can override using the
## `.groups` argument.
v2 %>%
# group_by(month)%>%
group_by(Month)%>%
# filter(ano <2020)%>%
# filter(ano >2016)%>%
summarise(notifi_geral=length(unique(orden)),
casos=sum(definitivo == 'caso'))%>%
ggplot()+
geom_col(aes(Month,notifi_geral), fill="#4287f5")+
scale_y_continuous(breaks= pretty_breaks())+
labs(y="Notificaciones vigilancia BTV",
x="Meses")+
theme_minimal() +
theme(text = element_text(size = 14))
# notificaciones por ano
v2 %>%
# group_by(Month)%>%
group_by(ano)%>%
# group_by(week)%>%
filter(ano > 2014)%>%
# filter(ano >2016)%>%
summarise(notifi_geral=length(unique(orden)),
casos=sum(definitivo == 'caso'))%>%
ggplot()+
geom_col(aes(ano,notifi_geral), fill="#4287f5")+
geom_text(aes(ano, notifi_geral, label=(notifi_geral)), nudge_y = 7)+
scale_y_continuous(breaks= pretty_breaks())+
labs(y="Notificaciones vigilancia pasiva vesiculares",
x="Anos")+
theme_minimal() +
theme(text = element_text(size = 14))
v2 %>%
group_by(ano, definitivo)%>%
summarise(nu=n()) %>%
ggplot()+
geom_col(aes(ano, nu, fill=definitivo))+
labs(y="Número de eventos sanitarios",
x="",
fill="")+
theme_minimal() +
theme(text = element_text(size = 14))+
scale_fill_brewer(palette="Blues")
## `summarise()` has grouped output by 'ano'. You can override using the `.groups`
## argument.
v2 %>%
group_by(Month, definitivo)%>%
summarise(nu=n()) %>%
ggplot()+
geom_col(aes(Month, nu, fill=definitivo))+
labs(y="Número de eventos sanitarios",
x="",
fill="")+
theme_minimal() +
theme(text = element_text(size = 14))+
scale_fill_brewer(palette="Blues")
## `summarise()` has grouped output by 'Month'. You can override using the
## `.groups` argument.
v2 %>%
# group_by(Month)%>%
group_by(ano)%>%
# group_by(week)%>%
filter(ano > 2014)%>%
# filter(ano >2016)%>%
summarise(Vigilancia_vesiculares=length(unique(orden)),
BTV=sum(definitivo == 'caso'))
## # A tibble: 8 × 3
## ano Vigilancia_vesiculares BTV
## <dbl> <int> <int>
## 1 2015 38 35
## 2 2016 82 73
## 3 2017 55 48
## 4 2018 149 123
## 5 2019 28 23
## 6 2020 19 15
## 7 2021 8 6
## 8 2022 1 0
# Casos por meses
v2 %>%
group_by(Month)%>%
# group_by(ano)%>%
# group_by(week)%>%
filter(ano > 2014)%>%
# filter(ano >2016)%>%
summarise(notifi_geral=length(unique(orden)),
casos=sum(definitivo == 'caso'))%>%
ggplot()+
geom_col(aes(Month,casos), fill="#4287f5")+
# geom_text(aes(Month, casos, label=(casos)), nudge_y = 3)+
scale_y_continuous(breaks= pretty_breaks())+
labs(y="Casos BTV",
x="Meses")+
theme_minimal()
v2 %>%
group_by(month)%>%
summarise(no_casos=sum(definitivo == "no caso"),
casos=sum(definitivo == 'caso'))
## # A tibble: 12 × 3
## month no_casos casos
## <dbl> <int> <int>
## 1 1 0 52
## 2 2 0 19
## 3 3 0 16
## 4 4 0 16
## 5 5 0 16
## 6 6 0 16
## 7 7 0 42
## 8 8 0 31
## 9 9 0 22
## 10 10 0 34
## 11 11 0 32
## 12 12 0 28
library(tidyr)
v2 %>%
group_by(ano)%>%
summarise(Casos=sum(pos),
Total_muestras=sum(total_muestras),
Prevalencia=100*(round((Casos/Total_muestras),3)))
## # A tibble: 9 × 4
## ano Casos Total_muestras Prevalencia
## <dbl> <dbl> <dbl> <dbl>
## 1 2014 43 43 100
## 2 2015 1006 1087 92.5
## 3 2016 1587 1782 89.1
## 4 2017 773 850 90.9
## 5 2018 1345 1590 84.6
## 6 2019 176 253 69.6
## 7 2020 157 187 84
## 8 2021 74 109 67.9
## 9 2022 0 17 0
library(tidyr)
v2 %>%
group_by(orden, month)%>%
summarise(Casos=sum(pos),
Total_muestras=sum(total_muestras),
Prevalencia=100*(round((Casos/Total_muestras),3))) %>%
ggplot()+
geom_boxplot(aes(month, Total_muestras, group=factor(month), fill="blue"))+
scale_fill_brewer(palette="BuPu")+
labs(x="meses",
y="Total de muestras",
fill=NULL)+
theme_minimal()
## `summarise()` has grouped output by 'orden'. You can override using the
## `.groups` argument.
library(tidyr)
v2 %>%
group_by(ano, month, definitivo)%>%
summarise(Casos=sum(pos),
Total_muestras=sum(total_muestras),
Prevalencia=100*(round((Casos/Total_muestras),3))) %>%
arrange(month)
## `summarise()` has grouped output by 'ano', 'month'. You can override using the
## `.groups` argument.
## # A tibble: 93 × 6
## # Groups: ano, month [64]
## ano month definitivo Casos Total_muestras Prevalencia
## <dbl> <dbl> <chr> <dbl> <dbl> <dbl>
## 1 2015 1 caso 11 11 100
## 2 2016 1 .no caso 0 1 0
## 3 2016 1 caso 657 720 91.2
## 4 2017 1 caso 135 153 88.2
## 5 2018 1 .no caso 0 1 0
## 6 2018 1 caso 95 95 100
## 7 2019 1 .no caso 0 14 0
## 8 2019 1 caso 33 39 84.6
## 9 2020 1 .no caso 0 12 0
## 10 2020 1 caso 24 33 72.7
## # … with 83 more rows
library(tidyr)
v2 %>%
group_by(ano, definitivo, month)%>%
summarise(Casos=sum(pos),
Total_muestras=sum(total_muestras),
Prevalencia=100*(round((Casos/Total_muestras),3))) %>%
ggplot()+
geom_boxplot(aes(month, Total_muestras, group=factor(month), fill=definitivo))+
facet_grid(rows=vars(definitivo), scales = "free_y")+
labs(fill="",
x="Meses",
y="Total de muestras por año")+
scale_fill_brewer(palette="BuPu")+
theme_minimal()
## `summarise()` has grouped output by 'ano', 'definitivo'. You can override using
## the `.groups` argument.
library(tidyr)
v2 %>%
group_by(orden, definitivo, month)%>%
summarise(Casos=sum(pos),
Total_muestras=sum(total_muestras),
Prevalencia=100*(round((Casos/Total_muestras),3))) %>%
ggplot()+
geom_boxplot(aes(month, Total_muestras, group=factor(month), fill=definitivo))+
facet_grid(rows=vars(definitivo), scales = "free_y")+
labs(fill="",
x="Meses",
y="Total de muestras por predio")+
scale_fill_brewer(palette="BuPu")+
theme_minimal()
## `summarise()` has grouped output by 'orden', 'definitivo'. You can override
## using the `.groups` argument.
## Total de muestras mensuales caso y no caso
library(tidyr)
v2 %>%
group_by(ano, definitivo, month)%>%
summarise(Casos=sum(pos),
Total_muestras=sum(total_muestras),
Prevalencia=100*(round((Casos/Total_muestras),3))) %>%
ggplot()+
geom_col(aes(month, Total_muestras, group=factor(month), fill=definitivo))+
facet_grid(rows=vars(definitivo), scales = "free_y")+
labs(fill="",
x="Meses",
y="Total de muestras")+
scale_fill_brewer(palette="Blues")+
theme_minimal()
## `summarise()` has grouped output by 'ano', 'definitivo'. You can override using
## the `.groups` argument.
library(RColorBrewer)
display.brewer.all()
display.brewer.pal(n=3, name = 'Blues')
brewer.pal(n=3, name = 'Blues')
## [1] "#DEEBF7" "#9ECAE1" "#3182BD"
library(tidyr)
v2 %>%
group_by(definitivo, month)%>%
summarise(Casos=sum(pos),
Total_muestras=sum(total_muestras)) %>%
ggplot()+
geom_col(aes(month, Total_muestras, group=factor(month)), fill="#DEEBF7")+
geom_col(aes(month, Casos, group=factor(month)), fill="#9ECAE1")+
labs(fill="",
x="Meses",
y="Total de animales muestreados por mes")+
theme_minimal()
## `summarise()` has grouped output by 'definitivo'. You can override using the
## `.groups` argument.
## Total de animales muestreados por semana epidemiològica
library(tidyr)
v2 %>%
group_by(definitivo, week)%>%
summarise(Casos=sum(pos),
Total_muestras=sum(total_muestras),
brotes=sum(definitivo == 'caso')) %>%
ggplot()+
geom_col(aes(week, Total_muestras), fill="#DEEBF7")+
geom_col(aes(week, Casos), fill="#9ECAE1") +
labs(fill="",
x="Semana epidemiologica",
y="Total de animales muestreados por semana")+
theme_minimal()
## `summarise()` has grouped output by 'definitivo'. You can override using the
## `.groups` argument.
v2 %>%
group_by(definitivo, week)%>%
summarise(Casos=sum(pos),
Total_muestras=sum(total_muestras),
brotes=sum(definitivo == 'caso'))
## `summarise()` has grouped output by 'definitivo'. You can override using the
## `.groups` argument.
## # A tibble: 81 × 5
## # Groups: definitivo [2]
## definitivo week Casos Total_muestras brotes
## <chr> <dbl> <dbl> <dbl> <int>
## 1 .no caso 2 0 1 0
## 2 .no caso 3 0 20 0
## 3 .no caso 4 0 2 0
## 4 .no caso 5 0 5 0
## 5 .no caso 6 0 17 0
## 6 .no caso 7 0 15 0
## 7 .no caso 8 0 24 0
## 8 .no caso 9 0 22 0
## 9 .no caso 11 0 5 0
## 10 .no caso 16 0 2 0
## # … with 71 more rows
library(tidyr)
v2 %>%
group_by(definitivo, week)%>%
summarise(Casos=sum(pos),
Total_muestras=sum(total_muestras),
brotes=sum(definitivo == 'caso')) %>%
mutate(brotes=ifelse(brotes==0,NA,brotes)) %>%
ggplot()+
geom_col(aes(week, Total_muestras), fill="#DEEBF7")+
geom_col(aes(week, Casos), fill="#9ECAE1") +
geom_point(aes(week, brotes*20), size=0.4)+
scale_y_continuous(
sec.axis = sec_axis(trans = ~. /20, name="Número de brotes")) +
labs(fill="",
x="Semana epidemiologica (2014-2021)",
y="Total de animales muestreados por semana")+
theme_minimal()
## `summarise()` has grouped output by 'definitivo'. You can override using the
## `.groups` argument.
## Warning: Removed 29 rows containing missing values (geom_point).
## Número de animales muestreados y brotes por semana epidemiológica y
año
library(tidyr)
v2 %>%
group_by(ano,definitivo, week)%>%
summarise(Casos=sum(pos),
Total_muestras=sum(total_muestras),
brotes=sum(definitivo == 'caso')) %>%
mutate(brotes=ifelse(brotes==0,NA,brotes)) %>%
ggplot()+
geom_col(aes(week, Total_muestras), fill="#DEEBF7")+
geom_col(aes(week, Casos), fill="#9ECAE1") +
geom_point(aes(week, brotes*20), size=0.4)+
scale_y_continuous(
sec.axis = sec_axis(trans = ~. /20, name="Número de brotes")) +
labs(fill="",
x="Semana epidemiologica",
y="Total de animales muestreados por semana")+
theme_minimal()+
facet_grid(rows = vars(ano))
## `summarise()` has grouped output by 'ano', 'definitivo'. You can override using
## the `.groups` argument.
## Warning: Removed 41 rows containing missing values (geom_point).
library(tidyr)
v2 %>%
group_by(definitivo, Month)%>%
summarise(Casos=sum(pos),
Total_muestras=sum(total_muestras),
brotes=sum(definitivo == 'caso')) %>%
mutate(brotes=ifelse(brotes==0,NA,brotes)) %>%
ggplot()+
geom_col(aes(Month, Total_muestras), fill="#DEEBF7")+
geom_col(aes(Month, Casos), fill="#9ECAE1") +
geom_point(aes(Month, brotes*20), size=0.4)+
scale_y_continuous(
sec.axis = sec_axis(trans = ~. /20, name="Número de brotes")) +
labs(fill="",
x="Semana epidemiologica (2014-2021)",
y="Total de animales muestreados por mes")+
theme_minimal()
## `summarise()` has grouped output by 'definitivo'. You can override using the
## `.groups` argument.
## Warning: Removed 31 rows containing missing values (geom_point).
##Prevalencia media por meses
library(tidyr)
v2 %>%
group_by(ano, Month)%>%
summarise(Casos=sum(pos),
Total_muestras=sum(total_muestras),
Prevalencia=100*(round((Casos/Total_muestras),3))) %>%
ggplot()+
geom_boxplot(aes(ano, Prevalencia, group=Month),fill="#4287f5")
## `summarise()` has grouped output by 'ano'. You can override using the `.groups`
## argument.
R Markdown This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
Acosta, A. PhD1 Burbano, A. DVM2, Salas, J. DVM2, Imbacuan, C. DVM2,, Zambrano C. ENG2. Universidad São Paulo1: Proyecto Análisis del sistema de vigilancia de la Peste porcina clásica en el Ecuador https://shorturl.at/ejny7. Agencia de regulación y control-AGROCALIDAD2. Apoyo: Asociación de porcicultores https://aspe.org.ec/. Jornadas de transferencia tecnológica para la erradicación de la PPC 2023 https://alfredojavier55.github.io/JTTPPC/
Visitas a este site