title: “Reportes de Vigilancia epidemiológica Agrocalidad (RVEA)
output: html_document
Análisis de reportes SIZSE Vigilancia Pasiva
V 1.3
1.3 (28.09.2022) modificación de búsqueda de casos eliminando falsos
positivos que tuvieron diagnóstico positivo a antígeno y posteriormente
negativo a PCR.
Autor Alfredo Acosta PhD
Asesor epidemiología aplicada
Departamento de medicina veterinaria preventiva Universidad São
Paulo
library(dplyr);library(lubridate);library(ggplot2); library(scales); library(readxl); library(tidyr)
##
## 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
Juntar archivos vigilancia (join-vig) —-
setwd("~/Dropbox/1.Epidat/Consultoria Agro/")
# Excel 2019 ----
vge19 <- read_excel("GENERAL_2019.xls")
vr19 <- read_excel("RESULTADOS_2019.xls", col_names = TRUE)
## 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`
vc19 <- read_excel("CIERRE_2019.xls")
## New names:
## • `ESPECIE` -> `ESPECIE...22`
## • `ESPECIE` -> `ESPECIE...31`
# Excel 2020 ----
vge20 <- read_excel("GENERAL_2020.xls")
vr20 <- read_excel("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`
vc20 <- read_excel("CIERRE_2020.xls")
## New names:
## • `ESPECIE` -> `ESPECIE...22`
## • `ESPECIE` -> `ESPECIE...31`
# Excel 2021 ----
vge21 <- read_excel("GENERAL_2021.xls")
vr21 <- read_excel("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`
vc21 <- read_excel("CIERRE_2021.xls")
## New names:
## • `ESPECIE` -> `ESPECIE...22`
## • `ESPECIE` -> `ESPECIE...31`
Reorganizar vge para enlazar 2019-2021 —-
colnames(vge19)
## [1] "# ORDEN" "# ALERTA" "F. REGISTRO"
## [4] "SEMANA" "PROVINCIA" "CANTÓN"
## [7] "PARROQUIA" "UTM WGS-84" "C.C/C.I/RUC"
## [10] "PROPIETARIO" "PREDIO" "T. EXPLOTACIÓN"
## [13] "NOTIFICADOR" "F. 1er ENFERMO" "F. NOTIFICACIÓN"
## [16] "F. 1era VISITA" "SÍNDROME PRESUNTIVO" "PATOLOGÍA"
## [19] "RESULTADO" "ESPECIE" "EDAD"
## [22] "MUESTREO POR EEB" "T. ALIMENTACIÓN" "RAZÓN MUESTREO"
## [25] "ESTADO" "¿SUPERVISADO?" "REGISTRO"
colnames(vge20)
## [1] "# ORDEN" "# ALERTA" "F. REGISTRO"
## [4] "SEMANA" "PROVINCIA" "CANTÓN"
## [7] "PARROQUIA" "UTM WGS-84" "C.C/C.I/RUC"
## [10] "PROPIETARIO" "PREDIO" "T. EXPLOTACIÓN"
## [13] "NOTIFICADOR" "F. 1er ENFERMO" "F. NOTIFICACIÓN"
## [16] "F. 1era VISITA" "SÍNDROME PRESUNTIVO" "PATOLOGÍA"
## [19] "RESULTADO" "ESPECIE" "EDAD"
## [22] "MUESTREO POR EEB" "T. ALIMENTACIÓN" "RAZÓN MUESTREO"
## [25] "ESTADO" "¿SUPERVISADO?" "REGISTRO"
colnames(vge21)
## [1] "# ORDEN" "# ALERTA" "F. REGISTRO"
## [4] "SEMANA" "PROVINCIA" "CANTÓN"
## [7] "PARROQUIA" "UTM WGS-84" "C.C/C.I/RUC"
## [10] "PROPIETARIO" "PREDIO" "T. EXPLOTACIÓN"
## [13] "NOTIFICADOR" "F. 1er ENFERMO" "F. NOTIFICACIÓN"
## [16] "F. 1era VISITA" "SÍNDROME PRESUNTIVO" "PATOLOGÍA"
## [19] "RESULTADO" "ESPECIE" "EDAD"
## [22] "MUESTREO POR EEB" "T. ALIMENTACIÓN" "RAZÓN MUESTREO"
## [25] "ESTADO" "¿SUPERVISADO?" "REGISTRO"
vge <- rbind(vge19,vge20,vge21)
colnames(vge) <-tolower(iconv(colnames(vge), to='ASCII//TRANSLIT'))
colnames(vge) <- gsub(" ","_", colnames(vge))
colnames(vge) <- gsub("#","n", colnames(vge))
colnames(vge)
## [1] "n_orden" "n_alerta" "f._registro"
## [4] "semana" "provincia" "canton"
## [7] "parroquia" "utm_wgs-84" "c.c/c.i/ruc"
## [10] "propietario" "predio" "t._explotacion"
## [13] "notificador" "f._1er_enfermo" "f._notificacion"
## [16] "f._1era_visita" "sindrome_presuntivo" "patologia"
## [19] "resultado" "especie" "edad"
## [22] "muestreo_por_eeb" "t._alimentacion" "razon_muestreo"
## [25] "estado" "?supervisado?" "registro"
Reorganizar vr para enlazar 2019-2021 —-
colnames(vr19)
## [1] "# ORDEN" "# ALERTA" "F. REGISTRO...3"
## [4] "SEMANA" "PROVINCIA" "CANTÓN"
## [7] "PARROQUIA" "UTM WGS-84" "C.C/C.I/RUC"
## [10] "PROPIETARIO" "PREDIO" "T. EXPLOTACIÓN"
## [13] "NOTIFICADOR" "F. 1er ENFERMO" "F. NOTIFICACIÓN"
## [16] "F. 1era VISITA" "SÍNDROME PRESUNTIVO" "PATOLOGÍA...18"
## [19] "RESULTADO" "ESPECIE...20" "EDAD"
## [22] "MUESTREO POR EEB" "T. ALIMENTACIÓN" "RAZÓN MUESTREO"
## [25] "ESTADO" "¿SUPERVISADO?" "REGISTRO...27"
## [28] "¿COLECTA?" "# VISITA" "F. INFORME"
## [31] "ESPECIE...31" "PATOLOGÍA...32" "PRUEBA SOLICITADA"
## [34] "LABORATORIO" "CANT. MUESTRAS" "POSITIVOS"
## [37] "NEGATIVOS" "INDETERMINADOS" "REACTIVOS"
## [40] "REGISTRO...40" "F. REGISTRO...41" "¿LIBERADO?"
## [43] "F. LIBERADO" "DÍAS EN LIBERAR" "RECOMENDACIONES"
## [46] "RESPONSABLE"
colnames(vr20)
## [1] "# ORDEN" "# ALERTA" "F. REGISTRO...3"
## [4] "SEMANA" "PROVINCIA" "CANTÓN"
## [7] "PARROQUIA" "UTM WGS-84" "C.C/C.I/RUC"
## [10] "PROPIETARIO" "PREDIO" "T. EXPLOTACIÓN"
## [13] "NOTIFICADOR" "F. 1er ENFERMO" "F. NOTIFICACIÓN"
## [16] "F. 1era VISITA" "SÍNDROME PRESUNTIVO" "PATOLOGÍA...18"
## [19] "RESULTADO" "ESPECIE...20" "EDAD"
## [22] "MUESTREO POR EEB" "T. ALIMENTACIÓN" "RAZÓN MUESTREO"
## [25] "ESTADO" "¿SUPERVISADO?" "REGISTRO...27"
## [28] "¿COLECTA?" "# VISITA" "F. INFORME"
## [31] "ESPECIE...31" "PATOLOGÍA...32" "PRUEBA SOLICITADA"
## [34] "LABORATORIO" "CANT. MUESTRAS" "POSITIVOS"
## [37] "NEGATIVOS" "INDETERMINADOS" "REACTIVOS"
## [40] "REGISTRO...40" "F. REGISTRO...41" "¿LIBERADO?"
## [43] "F. LIBERADO" "DÍAS EN LIBERAR" "RECOMENDACIONES"
## [46] "RESPONSABLE"
colnames(vr21)
## [1] "# ORDEN" "# ALERTA" "F. REGISTRO...3"
## [4] "SEMANA" "PROVINCIA" "CANTÓN"
## [7] "PARROQUIA" "UTM WGS-84" "C.C/C.I/RUC"
## [10] "PROPIETARIO" "PREDIO" "T. EXPLOTACIÓN"
## [13] "NOTIFICADOR" "F. 1er ENFERMO" "F. NOTIFICACIÓN"
## [16] "F. 1era VISITA" "SÍNDROME PRESUNTIVO" "PATOLOGÍA...18"
## [19] "RESULTADO" "ESPECIE...20" "EDAD"
## [22] "MUESTREO POR EEB" "T. ALIMENTACIÓN" "RAZÓN MUESTREO"
## [25] "ESTADO" "¿SUPERVISADO?" "REGISTRO...27"
## [28] "¿COLECTA?" "# VISITA" "F. INFORME"
## [31] "ESPECIE...31" "PATOLOGÍA...32" "PRUEBA SOLICITADA"
## [34] "LABORATORIO" "CANT. MUESTRAS" "POSITIVOS"
## [37] "NEGATIVOS" "INDETERMINADOS" "REACTIVOS"
## [40] "REGISTRO...40" "F. REGISTRO...41" "¿LIBERADO?"
## [43] "F. LIBERADO" "DÍAS EN LIBERAR" "RECOMENDACIONES"
## [46] "RESPONSABLE"
vr <- rbind(vr19,vr20,vr21)
colnames(vr) <-tolower(iconv(colnames(vr), to='ASCII//TRANSLIT'))
colnames(vr) <- gsub(" ","_", colnames(vr))
colnames(vr) <- gsub("#","n", colnames(vr))
colnames(vr)
## [1] "n_orden" "n_alerta" "f._registro...3"
## [4] "semana" "provincia" "canton"
## [7] "parroquia" "utm_wgs-84" "c.c/c.i/ruc"
## [10] "propietario" "predio" "t._explotacion"
## [13] "notificador" "f._1er_enfermo" "f._notificacion"
## [16] "f._1era_visita" "sindrome_presuntivo" "patologia...18"
## [19] "resultado" "especie...20" "edad"
## [22] "muestreo_por_eeb" "t._alimentacion" "razon_muestreo"
## [25] "estado" "?supervisado?" "registro...27"
## [28] "?colecta?" "n_visita" "f._informe"
## [31] "especie...31" "patologia...32" "prueba_solicitada"
## [34] "laboratorio" "cant._muestras" "positivos"
## [37] "negativos" "indeterminados" "reactivos"
## [40] "registro...40" "f._registro...41" "?liberado?"
## [43] "f._liberado" "dias_en_liberar" "recomendaciones"
## [46] "responsable"
Reorganizar vr para enlazar 2019-2021 —-
colnames(vc19)
## [1] "# ORDEN" "# ALERTA" "F. REGISTRO"
## [4] "SEMANA" "F. CIERRE" "DÍAS EN CERRAR"
## [7] "PROVINCIA" "CANTÓN" "PARROQUIA"
## [10] "UTM WGS-84" "C.C/C.I/RUC" "PROPIETARIO"
## [13] "PREDIO" "T. EXPLOTACIÓN" "NOTIFICADOR"
## [16] "F. 1er ENFERMO" "F. NOTIFICACIÓN" "F. 1era VISITA"
## [19] "SÍNDROME PRESUNTIVO" "PATOLOGÍA" "RESULTADO"
## [22] "ESPECIE...22" "EDAD" "ESTADO"
## [25] "¿SUPERVISADO?" "¿VACUNÓ?" "FOCAL"
## [28] "DOSIS FOCAL" "PERIFOCAL" "DOSIS PERIFOCAL"
## [31] "ESPECIE...31" "# EXISTENTES" "# ENFERMOS"
## [34] "# MUERTOS" "# SACRIFICADOS" "REGISTRO INICIAL"
colnames(vc20)
## [1] "# ORDEN" "# ALERTA" "F. REGISTRO"
## [4] "SEMANA" "F. CIERRE" "DÍAS EN CERRAR"
## [7] "PROVINCIA" "CANTÓN" "PARROQUIA"
## [10] "UTM WGS-84" "C.C/C.I/RUC" "PROPIETARIO"
## [13] "PREDIO" "T. EXPLOTACIÓN" "NOTIFICADOR"
## [16] "F. 1er ENFERMO" "F. NOTIFICACIÓN" "F. 1era VISITA"
## [19] "SÍNDROME PRESUNTIVO" "PATOLOGÍA" "RESULTADO"
## [22] "ESPECIE...22" "EDAD" "ESTADO"
## [25] "¿SUPERVISADO?" "¿VACUNÓ?" "FOCAL"
## [28] "DOSIS FOCAL" "PERIFOCAL" "DOSIS PERIFOCAL"
## [31] "ESPECIE...31" "# EXISTENTES" "# ENFERMOS"
## [34] "# MUERTOS" "# SACRIFICADOS" "REGISTRO INICIAL"
colnames(vc21)
## [1] "# ORDEN" "# ALERTA" "F. REGISTRO"
## [4] "SEMANA" "F. CIERRE" "DÍAS EN CERRAR"
## [7] "PROVINCIA" "CANTÓN" "PARROQUIA"
## [10] "UTM WGS-84" "C.C/C.I/RUC" "PROPIETARIO"
## [13] "PREDIO" "T. EXPLOTACIÓN" "NOTIFICADOR"
## [16] "F. 1er ENFERMO" "F. NOTIFICACIÓN" "F. 1era VISITA"
## [19] "SÍNDROME PRESUNTIVO" "PATOLOGÍA" "RESULTADO"
## [22] "ESPECIE...22" "EDAD" "ESTADO"
## [25] "¿SUPERVISADO?" "¿VACUNÓ?" "FOCAL"
## [28] "DOSIS FOCAL" "PERIFOCAL" "DOSIS PERIFOCAL"
## [31] "ESPECIE...31" "# EXISTENTES" "# ENFERMOS"
## [34] "# MUERTOS" "# SACRIFICADOS" "REGISTRO INICIAL"
vc <- rbind(vc19,vc20,vc21)
colnames(vc) <-tolower(iconv(colnames(vc), to='ASCII//TRANSLIT'))
colnames(vc) <- gsub(" ","_", colnames(vc))
colnames(vc) <- gsub("#","n", colnames(vc))
colnames(vc)
## [1] "n_orden" "n_alerta" "f._registro"
## [4] "semana" "f._cierre" "dias_en_cerrar"
## [7] "provincia" "canton" "parroquia"
## [10] "utm_wgs-84" "c.c/c.i/ruc" "propietario"
## [13] "predio" "t._explotacion" "notificador"
## [16] "f._1er_enfermo" "f._notificacion" "f._1era_visita"
## [19] "sindrome_presuntivo" "patologia" "resultado"
## [22] "especie...22" "edad" "estado"
## [25] "?supervisado?" "?vacuno?" "focal"
## [28] "dosis_focal" "perifocal" "dosis_perifocal"
## [31] "especie...31" "n_existentes" "n_enfermos"
## [34] "n_muertos" "n_sacrificados" "registro_inicial"
# Eliminar no necesarios
rm(vr19,vr20,vr21,vge19,vge20,vge21,vc19,vc20,vc21)
Revisión de datos exportados —
Revisando columnas duplicadas resultados
#no son iguales se refiere al registro del lab
table(ifelse(vr$f._registro...3 == vr$f._registro...41, 1,0))
##
## 0
## 1410
# 936 iguales, 447 no iguales porque,
table(ifelse(vr$patologia...18 == vr$patologia...32,1,0))
##
## 0 1
## 447 963
# No son iguales, a que se refiere
table(ifelse(vr$registro...27 == vr$registro...40, 1,0))
##
## 0
## 1410
#Son iguales podrian eliminarse?
table(ifelse(vr$especie...20 == vr$especie...31, 1,0))
##
## 1
## 1410
#Revisando columnas duplicadas cierre
#todos iguales
table(ifelse(vc$especie...22 == vc$especie...22, 1,0))
##
## 1
## 706
Juntar archivos vigilancia (join-vig) —-
# -- Vigilancia general ----
v0 <- left_join(vc, vr)
## Joining, by = c("n_orden", "n_alerta", "semana", "provincia", "canton",
## "parroquia", "utm_wgs-84", "c.c/c.i/ruc", "propietario", "predio",
## "t._explotacion", "notificador", "f._1er_enfermo", "f._notificacion",
## "f._1era_visita", "sindrome_presuntivo", "resultado", "edad", "estado",
## "?supervisado?", "especie...31")
v1 <- left_join(v0,vge)
## Joining, by = c("n_orden", "n_alerta", "f._registro", "semana", "provincia",
## "canton", "parroquia", "utm_wgs-84", "c.c/c.i/ruc", "propietario", "predio",
## "t._explotacion", "notificador", "f._1er_enfermo", "f._notificacion",
## "f._1era_visita", "sindrome_presuntivo", "patologia", "resultado", "edad",
## "estado", "?supervisado?", "muestreo_por_eeb", "t._alimentacion",
## "razon_muestreo")
colnames(v1)
## [1] "n_orden" "n_alerta" "f._registro"
## [4] "semana" "f._cierre" "dias_en_cerrar"
## [7] "provincia" "canton" "parroquia"
## [10] "utm_wgs-84" "c.c/c.i/ruc" "propietario"
## [13] "predio" "t._explotacion" "notificador"
## [16] "f._1er_enfermo" "f._notificacion" "f._1era_visita"
## [19] "sindrome_presuntivo" "patologia" "resultado"
## [22] "especie...22" "edad" "estado"
## [25] "?supervisado?" "?vacuno?" "focal"
## [28] "dosis_focal" "perifocal" "dosis_perifocal"
## [31] "especie...31" "n_existentes" "n_enfermos"
## [34] "n_muertos" "n_sacrificados" "registro_inicial"
## [37] "f._registro...3" "patologia...18" "especie...20"
## [40] "muestreo_por_eeb" "t._alimentacion" "razon_muestreo"
## [43] "registro...27" "?colecta?" "n_visita"
## [46] "f._informe" "patologia...32" "prueba_solicitada"
## [49] "laboratorio" "cant._muestras" "positivos"
## [52] "negativos" "indeterminados" "reactivos"
## [55] "registro...40" "f._registro...41" "?liberado?"
## [58] "f._liberado" "dias_en_liberar" "recomendaciones"
## [61] "responsable" "especie" "registro"
Juntando tres reportes general, resultados, cierre
v2 <- v1 %>%
# filter(patologia == "Peste porcina clásica")%>%
# filter(prueba_solicitada == "PESTE PORCINA CLÁSICA (AG.)" |
# prueba_solicitada == "PESTE PORCINA CLÁSICA (PCR)")%>%
group_by(n_orden, provincia, canton, parroquia, f._1er_enfermo, f._notificacion, especie...22, patologia...32,
prueba_solicitada, resultado, notificador, t._explotacion) %>%
summarise(poblacion=sum(n_existentes, n_muertos, n_sacrificados), enfermos=sum(n_enfermos), muertos=sum(n_muertos),
sacrificados=sum(n_sacrificados), afectados=sum(n_muertos, n_sacrificados), positivos=sum(positivos),
total_muestras=sum(cant._muestras), indeterminado=sum(indeterminados), reactivo=sum(reactivos)) %>%
mutate(ano=year(dmy(f._1er_enfermo))) %>%
mutate(mes=month(dmy(f._1er_enfermo)))
## `summarise()` has grouped output by 'n_orden', 'provincia', 'canton',
## 'parroquia', 'f._1er_enfermo', 'f._notificacion', 'especie...22',
## 'patologia...32', 'prueba_solicitada', 'resultado', 'notificador'. You can
## override using the `.groups` argument.
Total de eventos
length(unique(v2$n_orden))
## [1] 706
# Changing to floor date week
v2$semana <- floor_date(dmy(v2$f._1er_enfermo), "week")
Total de notificaciones vigilancia general (enfermedades
porcinas)
length(unique(v2$n_orden))
## [1] 706
# Numero de ordenes
v2 %>%
group_by(ano)%>%
summarise(notifi=length(unique(n_orden)))
| 2017 |
2 |
| 2018 |
17 |
| 2019 |
271 |
| 2020 |
201 |
| 2021 |
215 |
Notificaciones por provincia
length(unique(v2$n_orden))
## [1] 706
# Numero de ordenes
v2 %>%
group_by(ano)%>%
summarise(notifi=length(unique(n_orden)))
| 2017 |
2 |
| 2018 |
17 |
| 2019 |
271 |
| 2020 |
201 |
| 2021 |
215 |
Total de notificaciones por provincia
v2 %>%
group_by(ano, provincia)%>%
summarise(notificaciones=length(unique(n_orden)))%>%
arrange(desc(notificaciones))%>%
spread(key = ano, value = notificaciones)
## `summarise()` has grouped output by 'ano'. You can override using the `.groups`
## argument.
| AZUAY |
NA |
NA |
12 |
6 |
5 |
| BOLIVAR |
NA |
1 |
29 |
27 |
18 |
| CAÑAR |
NA |
NA |
8 |
3 |
8 |
| CARCHI |
NA |
NA |
1 |
NA |
4 |
| CHIMBORAZO |
NA |
NA |
2 |
4 |
2 |
| COTOPAXI |
NA |
NA |
11 |
4 |
9 |
| EL ORO |
2 |
1 |
3 |
NA |
7 |
| ESMERALDAS |
NA |
NA |
9 |
14 |
7 |
| GUAYAS |
NA |
2 |
10 |
13 |
12 |
| IMBABURA |
NA |
NA |
10 |
3 |
5 |
| LOJA |
NA |
1 |
14 |
22 |
22 |
| LOS RIOS |
NA |
NA |
18 |
6 |
17 |
| MANABI |
NA |
3 |
8 |
10 |
15 |
| MORONA SANTIAGO |
NA |
1 |
11 |
7 |
7 |
| NAPO |
NA |
4 |
34 |
18 |
8 |
| ORELLANA |
NA |
NA |
10 |
10 |
7 |
| PASTAZA |
NA |
2 |
18 |
7 |
2 |
| PICHINCHA |
NA |
NA |
26 |
24 |
21 |
| SANTA ELENA |
NA |
NA |
8 |
3 |
8 |
| SANTO DOMINGO DE LOS TSACHILAS |
NA |
NA |
6 |
4 |
5 |
| SUCUMBIOS |
NA |
2 |
2 |
6 |
6 |
| TUNGURAHUA |
NA |
NA |
7 |
4 |
3 |
| ZAMORA CHINCHIPE |
NA |
NA |
14 |
6 |
17 |
Total de notificaciones por provincia organizadas por número y
año
v2 %>%
group_by(ano, provincia)%>%
filter(ano == 2021)%>%
summarise(notificaciones=length(unique(n_orden)))%>%
arrange(desc(notificaciones))
## `summarise()` has grouped output by 'ano'. You can override using the `.groups`
## argument.
| 2021 |
LOJA |
22 |
| 2021 |
PICHINCHA |
21 |
| 2021 |
BOLIVAR |
18 |
| 2021 |
LOS RIOS |
17 |
| 2021 |
ZAMORA CHINCHIPE |
17 |
| 2021 |
MANABI |
15 |
| 2021 |
GUAYAS |
12 |
| 2021 |
COTOPAXI |
9 |
| 2021 |
CAÑAR |
8 |
| 2021 |
NAPO |
8 |
| 2021 |
SANTA ELENA |
8 |
| 2021 |
EL ORO |
7 |
| 2021 |
ESMERALDAS |
7 |
| 2021 |
MORONA SANTIAGO |
7 |
| 2021 |
ORELLANA |
7 |
| 2021 |
SUCUMBIOS |
6 |
| 2021 |
AZUAY |
5 |
| 2021 |
IMBABURA |
5 |
| 2021 |
SANTO DOMINGO DE LOS TSACHILAS |
5 |
| 2021 |
CARCHI |
4 |
| 2021 |
TUNGURAHUA |
3 |
| 2021 |
CHIMBORAZO |
2 |
| 2021 |
PASTAZA |
2 |
Total de notificaciones por provincia organizadas por número
v2 %>%
group_by(ano, provincia)%>%
filter(ano == 2021)%>%
summarise(notificaciones=length(unique(n_orden)))%>%
arrange(notificaciones)
## `summarise()` has grouped output by 'ano'. You can override using the `.groups`
## argument.
| 2021 |
CHIMBORAZO |
2 |
| 2021 |
PASTAZA |
2 |
| 2021 |
TUNGURAHUA |
3 |
| 2021 |
CARCHI |
4 |
| 2021 |
AZUAY |
5 |
| 2021 |
IMBABURA |
5 |
| 2021 |
SANTO DOMINGO DE LOS TSACHILAS |
5 |
| 2021 |
SUCUMBIOS |
6 |
| 2021 |
EL ORO |
7 |
| 2021 |
ESMERALDAS |
7 |
| 2021 |
MORONA SANTIAGO |
7 |
| 2021 |
ORELLANA |
7 |
| 2021 |
CAÑAR |
8 |
| 2021 |
NAPO |
8 |
| 2021 |
SANTA ELENA |
8 |
| 2021 |
COTOPAXI |
9 |
| 2021 |
GUAYAS |
12 |
| 2021 |
MANABI |
15 |
| 2021 |
LOS RIOS |
17 |
| 2021 |
ZAMORA CHINCHIPE |
17 |
| 2021 |
BOLIVAR |
18 |
| 2021 |
PICHINCHA |
21 |
| 2021 |
LOJA |
22 |
Grafico número de notificaciones por provincia
v2 %>%
group_by(ano, provincia)%>%
summarise(Notificaciones=length(unique(n_orden)))%>%
ggplot(aes(x=provincia,y=Notificaciones))+
geom_col(fill="#377EB8")+
facet_grid(vars(ano))+
theme_minimal()+
theme(axis.text.x = element_text(angle = 90, size=6))
## `summarise()` has grouped output by 'ano'. You can override using the `.groups`
## argument.

v2 %>%
group_by(ano, provincia, patologia...32)%>%
summarise(notificaciones=length(unique(n_orden)))%>%
arrange(desc(notificaciones))%>%
ggplot(aes(x=patologia...32,y=notificaciones))+
geom_col(fill="#377EB8")+
facet_grid(vars(ano))+
theme_minimal()+
theme(axis.text.x = element_text(angle = 90, size=7))
## `summarise()` has grouped output by 'ano', 'provincia'. You can override using
## the `.groups` argument.

Notificações por tipo de notificador
v2 %>%
group_by(ano, notificador)%>%
summarise(notificaciones=length(unique(n_orden)))%>%
arrange(desc(notificaciones))%>%
spread(key = ano, value = notificaciones)
## `summarise()` has grouped output by 'ano'. You can override using the `.groups`
## argument.
| ADMINISTRADOR DEL PREDIO |
NA |
NA |
NA |
NA |
15 |
| FUNCIONARIO DE AGROCALIDAD |
1 |
NA |
8 |
5 |
12 |
| INFORMANTE ZOOSANITARIO |
NA |
5 |
91 |
46 |
63 |
| OTROS |
1 |
2 |
9 |
10 |
3 |
| PROPIETARIO DEL PREDIO |
NA |
10 |
163 |
140 |
122 |
v2 %>%
group_by(ano, notificador)%>%
summarise(notificaciones=length(unique(n_orden)))%>%
arrange(desc(notificaciones))%>%
ggplot(aes(x=notificador,y=notificaciones))+
geom_col(fill="#377EB8")+
facet_grid(vars(ano))+
theme_minimal()+
theme(axis.text.x = element_text(angle = 90, size=6))
## `summarise()` has grouped output by 'ano'. You can override using the `.groups`
## argument.

Notificações por tipo de explotación
v2 %>%
group_by(ano, t._explotacion)%>%
summarise(notificaciones=length(unique(n_orden)))%>%
arrange(desc(notificaciones))%>%
spread(key = ano, value = notificaciones)
## `summarise()` has grouped output by 'ano'. You can override using the `.groups`
## argument.
| CARNE |
NA |
NA |
2 |
NA |
2 |
| COMERCIAL |
1 |
2 |
33 |
15 |
22 |
| FAMILIAR |
NA |
6 |
49 |
29 |
4 |
| INDUSTRIAL |
1 |
1 |
4 |
1 |
6 |
| MIXTA |
NA |
NA |
4 |
2 |
1 |
| PORCINOS |
NA |
NA |
1 |
1 |
NA |
| TRASPATIO |
NA |
8 |
178 |
153 |
180 |
v2 %>%
group_by(ano, t._explotacion)%>%
summarise(Notificaciones=length(unique(n_orden)))%>%
arrange(desc(Notificaciones))%>%
ggplot(aes(x=t._explotacion,y=Notificaciones))+
geom_col(fill="#377EB8")+
facet_grid(vars(ano))+
theme(axis.text.x = element_text(angle = 90, size=6))
## `summarise()` has grouped output by 'ano'. You can override using the `.groups`
## argument.

Total de notificaciones por ano vigilancia dirigida PPC
v2 %>%
group_by(ano)%>%
filter(prueba_solicitada == "PESTE PORCINA CLÁSICA (AG.)" |
prueba_solicitada == "PESTE PORCINA CLÁSICA (PCR)") %>%
summarise(notifi=length(unique(n_orden)))
| 2018 |
1 |
| 2019 |
159 |
| 2020 |
101 |
| 2021 |
125 |
Total de brotes por ano
# Todos los eventos con diganostico positivo
v2 <- v1 %>%
filter(prueba_solicitada != "PESTE PORCINA CLÁSICA (AC)" &
prueba_solicitada == "PESTE PORCINA CLÁSICA (AG.)" |
prueba_solicitada == "PESTE PORCINA CLÁSICA (PCR)")%>%
group_by(n_orden, provincia, canton, parroquia, f._1er_enfermo, f._notificacion,
especie...22, resultado, prueba_solicitada) %>%
summarise(poblacion=sum(n_existentes, n_muertos, n_sacrificados),enfermos=sum(n_enfermos),
muertos=sum(n_muertos), sacrificados=sum(n_sacrificados),
afectados=sum(n_muertos,n_sacrificados), positivos=sum(positivos),
total_muestras=sum(cant._muestras), indeterminado=sum(indeterminados),
reactivo=sum(reactivos))%>%
mutate(ano=year(dmy(f._1er_enfermo)))%>%
mutate(mes=month(dmy(f._1er_enfermo)))%>%
mutate(semana=floor_date(dmy(f._1er_enfermo), "week"))%>%
mutate(definitivo=ifelse(positivos>=1,"caso", "notifi"))
## `summarise()` has grouped output by 'n_orden', 'provincia', 'canton',
## 'parroquia', 'f._1er_enfermo', 'f._notificacion', 'especie...22', 'resultado'.
## You can override using the `.groups` argument.
length(unique(v2$n_orden))
## [1] 386
# Todos los eventos confirmados negativos a PCR
v3 <- v1 %>%
filter(prueba_solicitada != "PESTE PORCINA CLÁSICA (AC)" &
prueba_solicitada == "PESTE PORCINA CLÁSICA (PCR)")%>%
group_by(n_orden, provincia, canton, parroquia, f._1er_enfermo, f._notificacion,
especie...22, resultado, prueba_solicitada) %>%
summarise(poblacion=sum(n_existentes, n_muertos, n_sacrificados),enfermos=sum(n_enfermos),
muertos=sum(n_muertos), sacrificados=sum(n_sacrificados),
afectados=sum(n_muertos,n_sacrificados), positivos=sum(positivos),
negativos=sum(negativos),
total_muestras=sum(cant._muestras), indeterminado=sum(indeterminados),
reactivo=sum(reactivos))%>%
mutate(ano=year(dmy(f._1er_enfermo)))%>%
mutate(mes=month(dmy(f._1er_enfermo)))%>%
mutate(semana=floor_date(dmy(f._1er_enfermo), "week"))%>%
mutate(definitivo=ifelse(positivos>=1,"caso", "notifi"))%>%
filter(negativos >=1)%>%
filter(positivos ==0)
## `summarise()` has grouped output by 'n_orden', 'provincia', 'canton',
## 'parroquia', 'f._1er_enfermo', 'f._notificacion', 'especie...22', 'resultado'.
## You can override using the `.groups` argument.
length(unique(v3$n_orden))
## [1] 44
# Eventos sin retiro de PCR negativos
# v2 %>%
# group_by(ano, definitivo)%>%
# summarise(eventos=length(unique(n_orden)))
Filtrando los PCR negativos confirmatorios de eventos positivos a
antigeno
v2$PCR_negative <- v2$n_orden %in% v3$n_orden
v2 <- v2 %>%
mutate(definitivo2=ifelse(PCR_negative == TRUE & definitivo == "caso","notifi",definitivo))
v2$definitivo2[v2$n_orden == "6992"] <- "caso"
# Comparo ajuste de diagnóstico
table(v2$definitivo)
##
## caso notifi
## 81 354
table(v2$definitivo2)
##
## caso notifi
## 71 364
Agrego la recomendación para confirmar (caso 6992 aun no se
clasifica correctamente)
v2$recomendation <- vr$recomendaciones[match(v2$n_orden, vr$n_orden)]
#Número de casos y notificaciones
v2 %>%
group_by(ano, definitivo2)%>%
summarise(eventos=length(unique(n_orden)))%>%
spread(key = "definitivo2", value="eventos")
## `summarise()` has grouped output by 'ano'. You can override using the `.groups`
## argument.
| 2018 |
NA |
1 |
| 2019 |
30 |
130 |
| 2020 |
15 |
86 |
| 2021 |
14 |
111 |
#Orden de casos Número de casos
v2 %>%
group_by(ano, n_orden, provincia, f._1er_enfermo)%>%
filter(definitivo2 == "caso")%>%
summarise(casos=length(unique(n_orden)))
## `summarise()` has grouped output by 'ano', 'n_orden', 'provincia'. You can
## override using the `.groups` argument.
| 2019 |
6466 |
PASTAZA |
01/01/2019 |
1 |
| 2019 |
6484 |
LOS RIOS |
07/01/2019 |
1 |
| 2019 |
6578 |
LOS RIOS |
01/02/2019 |
1 |
| 2019 |
6599 |
CAÑAR |
06/02/2019 |
1 |
| 2019 |
6601 |
CAÑAR |
06/02/2019 |
1 |
| 2019 |
6661 |
AZUAY |
20/02/2019 |
1 |
| 2019 |
6670 |
PICHINCHA |
15/02/2019 |
1 |
| 2019 |
6746 |
IMBABURA |
14/03/2019 |
1 |
| 2019 |
6763 |
LOS RIOS |
07/03/2019 |
1 |
| 2019 |
6967 |
GUAYAS |
07/04/2019 |
1 |
| 2019 |
6971 |
LOS RIOS |
29/04/2019 |
1 |
| 2019 |
6992 |
MORONA SANTIAGO |
12/05/2019 |
1 |
| 2019 |
6993 |
MANABI |
10/05/2019 |
1 |
| 2019 |
7163 |
PICHINCHA |
04/06/2019 |
1 |
| 2019 |
7166 |
GUAYAS |
07/06/2019 |
1 |
| 2019 |
7253 |
PASTAZA |
28/06/2019 |
1 |
| 2019 |
7323 |
BOLIVAR |
10/07/2019 |
1 |
| 2019 |
7397 |
ZAMORA CHINCHIPE |
04/08/2019 |
1 |
| 2019 |
7474 |
ZAMORA CHINCHIPE |
23/08/2019 |
1 |
| 2019 |
7493 |
LOS RIOS |
04/08/2019 |
1 |
| 2019 |
7506 |
MORONA SANTIAGO |
21/08/2019 |
1 |
| 2019 |
7509 |
LOS RIOS |
03/09/2019 |
1 |
| 2019 |
7609 |
BOLIVAR |
25/09/2019 |
1 |
| 2019 |
7616 |
MANABI |
18/09/2019 |
1 |
| 2019 |
7624 |
LOS RIOS |
03/09/2019 |
1 |
| 2019 |
7692 |
ESMERALDAS |
27/10/2019 |
1 |
| 2019 |
7839 |
MORONA SANTIAGO |
18/11/2019 |
1 |
| 2019 |
7875 |
LOJA |
01/12/2019 |
1 |
| 2019 |
7926 |
MORONA SANTIAGO |
11/12/2019 |
1 |
| 2019 |
8062 |
LOS RIOS |
19/12/2019 |
1 |
| 2020 |
8142 |
CAÑAR |
14/02/2020 |
1 |
| 2020 |
8148 |
BOLIVAR |
04/02/2020 |
1 |
| 2020 |
8387 |
MORONA SANTIAGO |
14/06/2020 |
1 |
| 2020 |
8456 |
GUAYAS |
05/07/2020 |
1 |
| 2020 |
8560 |
LOJA |
19/08/2020 |
1 |
| 2020 |
8577 |
SANTO DOMINGO DE LOS TSACHILAS |
18/08/2020 |
1 |
| 2020 |
8588 |
PICHINCHA |
01/09/2020 |
1 |
| 2020 |
8639 |
AZUAY |
25/09/2020 |
1 |
| 2020 |
8672 |
ESMERALDAS |
05/10/2020 |
1 |
| 2020 |
8733 |
ESMERALDAS |
19/10/2020 |
1 |
| 2020 |
8740 |
AZUAY |
21/10/2020 |
1 |
| 2020 |
8750 |
COTOPAXI |
22/10/2020 |
1 |
| 2020 |
8777 |
MANABI |
06/11/2020 |
1 |
| 2020 |
8789 |
PICHINCHA |
07/11/2020 |
1 |
| 2020 |
8798 |
SANTA ELENA |
07/11/2020 |
1 |
| 2021 |
9071 |
ZAMORA CHINCHIPE |
03/02/2021 |
1 |
| 2021 |
9115 |
EL ORO |
01/02/2021 |
1 |
| 2021 |
9132 |
MANABI |
20/02/2021 |
1 |
| 2021 |
9193 |
EL ORO |
08/03/2021 |
1 |
| 2021 |
9258 |
EL ORO |
29/03/2021 |
1 |
| 2021 |
9385 |
ESMERALDAS |
24/05/2021 |
1 |
| 2021 |
9585 |
MANABI |
30/06/2021 |
1 |
| 2021 |
9629 |
MANABI |
10/07/2021 |
1 |
| 2021 |
9664 |
MANABI |
05/08/2021 |
1 |
| 2021 |
9676 |
ZAMORA CHINCHIPE |
28/07/2021 |
1 |
| 2021 |
9736 |
GUAYAS |
31/07/2021 |
1 |
| 2021 |
9740 |
LOJA |
30/08/2021 |
1 |
| 2021 |
9742 |
LOJA |
02/09/2021 |
1 |
| 2021 |
9946 |
ZAMORA CHINCHIPE |
01/10/2021 |
1 |
#Número de casos
# Numero de ordenes
v2 %>%
group_by(semana, definitivo2)%>%
summarise(eventos=length(unique(n_orden)))%>%
ggplot(aes(x=semana, y=eventos))+
geom_boxplot()
## `summarise()` has grouped output by 'semana'. You can override using the
## `.groups` argument.
## Warning: Continuous x aesthetic -- did you forget aes(group=...)?

#Número de casos y notificaciones
v2 %>%
group_by(ano, definitivo2)%>%
summarise(eventos=length(unique(n_orden)))%>%
spread(key = "definitivo2", value="eventos")
## `summarise()` has grouped output by 'ano'. You can override using the `.groups`
## argument.
| 2018 |
NA |
1 |
| 2019 |
30 |
130 |
| 2020 |
15 |
86 |
| 2021 |
14 |
111 |
#Número de casos y notificaciones
# Numero de ordenes
v2 %>%
group_by(semana, definitivo2)%>%
summarise(eventos=length(unique(n_orden)))%>%
ggplot()+
geom_boxplot(aes(semana, eventos, group=semana, ourlier.size=0.01))+
theme_minimal()
## `summarise()` has grouped output by 'semana'. You can override using the
## `.groups` argument.
## Warning: Ignoring unknown aesthetics: ourlier.size

v2 %>%
group_by(mes, definitivo2)%>%
summarise(eventos=length(unique(n_orden)))%>%
ggplot()+
geom_boxplot(aes(factor(mes), eventos, group=factor(mes), ourlier.size=0.01))+
theme_minimal()
## `summarise()` has grouped output by 'mes'. You can override using the `.groups`
## argument.
## Warning: Ignoring unknown aesthetics: ourlier.size

v2 %>%
group_by(semana)%>%
filter(definitivo2=="notifi")%>%
summarise(eventos=length(unique(n_orden)))%>%
ggplot()+
geom_col(aes(semana, eventos))+
theme_minimal()

v2 %>%
group_by(mes)%>%
filter(definitivo2=="caso")%>%
summarise(eventos=length(unique(n_orden)))%>%
ggplot()+
geom_point(aes(factor(mes), eventos), colour="#4DAF4A", size=3)+
geom_path(aes(mes, eventos))+
theme_minimal()+
labs(x="meses",
y="casos")

v2 %>%
group_by(mes,ano)%>%
filter(definitivo2=="caso")%>%
summarise(eventos=length(unique(n_orden)))%>%
ggplot()+
geom_point(aes(factor(mes), eventos), colour="#4DAF4A", size=3)+
geom_path(aes(mes, eventos))+
facet_grid(rows = vars(ano))+
theme_minimal()+
labs(x="meses",
y="casos")
## `summarise()` has grouped output by 'mes'. You can override using the `.groups`
## argument.

Graficos notificaciones
Notificaciones agregadas por mes
v2 %>%
group_by(mes)%>%
# filter(ano <2020)%>%
# filter(ano >2016)%>%
summarise(notifi_geral=length(unique(n_orden)),
casos=sum(definitivo2 == 'caso'))%>%
ggplot()+
geom_col(aes(mes,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 agregadas por anos
# notificaciones por ano
v2 %>%
# group_by(Month)%>%
group_by(ano)%>%
# group_by(week)%>%
# filter(ano > 2014)%>%
# filter(ano >2016)%>%
summarise(notifi_geral=length(unique(n_orden)),
casos=sum(definitivo2 == '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))

Notificaciones y casos confirmados
table(v2$ano, v2$definitivo2)
##
## caso notifi
## 2018 0 1
## 2019 36 146
## 2020 17 94
## 2021 18 123
v2 %>%
# group_by(Month)%>%
group_by(ano)%>%
# group_by(week)%>%
# filter(ano > 2014)%>%
# filter(ano >2016)%>%
summarise(notifi_geral=length(unique(n_orden)),
casos=length(unique(n_orden[definitivo2 == '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))

numero de notificaciones y casos
v2 %>%
# group_by(Month)%>%
group_by(ano)%>%
# group_by(week)%>%
filter(ano > 2014)%>%
# filter(ano >2016)%>%
summarise(notificacion_vigilancia_dirigida=length(unique(n_orden)),
casos=length(unique(n_orden[definitivo2 == 'caso'])))
| 2018 |
1 |
0 |
| 2019 |
159 |
30 |
| 2020 |
101 |
15 |
| 2021 |
125 |
14 |
Casos por meses
# Casos por meses
# v2 %>%
# group_by(mes,ano)%>%
# # group_by(ano)%>%
# # group_by(week)%>%
# # filter(ano > 2014)%>%
# # filter(ano >2016)%>%
# summarize(casos=length(unique(n_orden[definitivo2 == 'caso'])))%>%
# ggplot()+
# geom_col(aes(ano,casos), fill="#984EA3")+
# geom_text(aes(ano, 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))
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.