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")
# Colnames correctos ----
vge0 <- read.csv("Rep_General_EventosSan0.csv", colClasses = "character",encoding = "UTF-8")
vr0 <- read.csv("Rep_ResultadosGEV0.csv", colClasses = "character",encoding = "UTF-8")
vc0 <- read.csv("Rep_CierreGEV0.csv", colClasses = "character",encoding = "UTF-8")
# 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")
vge <- rbind(vge1, vge2, vge3, vge4, vge5, vge6, vge7, vge8)
# vge1 <- readxl::read_excel("VEPG02_REP_GENERAL_BASICO 2015.xls")
# colnames(vge) <- vge1[1,]
# colnames(vge0)
# colnames(vge)
# Reordenar y revisar bien Cristian ----
vge2 <- vge[,c(1,5:7,9,10,4,8,8,8,11:18,
20:24,3,3,27)]
colnames(vge2)
## [1] "# ORDEN" "PROVINCIA" "CANTÓN"
## [4] "PARROQUIA" "C.C/C.I/RUC" "PROPIETARIO"
## [7] "SEMANA" "UTM WGS-84" "UTM WGS-84"
## [10] "UTM WGS-84" "PREDIO" "T. EXPLOTACIÓN"
## [13] "NOTIFICADOR" "F. 1er ENFERMO" "F. NOTIFICACIÓN"
## [16] "F. 1era VISITA" "SÍNDROME PRESUNTIVO" "PATOLOGÍA"
## [19] "ESPECIE" "EDAD" "MUESTREO POR EEB"
## [22] "T. ALIMENTACIÓN" "RAZÓN MUESTREO" "F. REGISTRO"
## [25] "F. REGISTRO" "REGISTRO"
# por algo agregaron las columnas y las deberian usar
# vge <- vge[,c(1,5:7,9,10,4,8,8,8,11:18,
# 20:24,3,3,27, 2,19,25,26)]
#
# colnames(vge)[27] <- "Alerta"
colnames(vge2) <- colnames(vge0)
vge2 <- cbind(vge2, vge[,c(2,19,25,26)])
# 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`
vr <- rbind(vr1, vr2, vr3, vr4, vr5, vr6, vr7, vr8)
# colnames(vr)
# colnames(vr2)
vr2 <- vr[,c(1,5:7,9,10,4,8,8,8,11:18,20,21,3,3,27,28,29,33,32,34:39,41,43,44,42)]
colnames(vr2) <- colnames(vr0)
colnames(vr2)
## [1] "orden" "provincia" "cantón"
## [4] "parroquia" "cedula" "propietario"
## [7] "semana" "zona" "coord_x"
## [10] "coord_y" "predio" "t_explotación"
## [13] "notificador" "f_1er_enfermo" "f_notificación"
## [16] "f_1era_visita" "síndrome_presuntivo" "patología"
## [19] "especie" "edad" "f_elaboración"
## [22] "f_ingreso" "responsable" "colecta"
## [25] "n_visita" "prueba_solicitada" "detalle_diagnóstico"
## [28] "laboratorio" "cant_muestras" "positivos"
## [31] "negativos" "indeterminados" "reactivos"
## [34] "fecha_ingreso" "fecha_liberado" "diferencia_días"
## [37] "liberado"
vr2 <- cbind(vr2, vr[,c(2,19,22,23,24,25,26,30,31,40,45,46)])
# 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`
vc <- rbind(vc1, vc2, vc3, vc4, vc5, vc6, vc7, vc8)
# vc1 <- readxl::read_excel("VEPG02_REP_CIERRE 2014.xls")
# colnames(vc) <- vc1[1,]
# colnames(vc0)
# colnames(vc)
# Reordenar ----
vc2 <- vc[,c(1,7:9,11,12,4,10,10,10,13:20,
22,23,3,3,5,36,26:35)]
colnames(vc2) <- colnames(vc0)
vc2 <- cbind(vc2, vc[,c(2,6,21,24,25)])
vge2$canton <- vge2$cantón
vge2$cantón <- NULL
#Banco Resultados de eventos
vr2$cant_muestras <- as.numeric(vr2$cant_muestras)
vr2$positivos <- as.numeric(vr2$positivos)
vr2$negativos <- as.numeric(vr2$negativos)
vr2$reactivos <- as.numeric(vr2$reactivos)
# vr2$indeterminados <- as.numeric(vr2$indeterminados)
vr2$canton <- vr2$cantón
vr2$cantón <- NULL
# Banco Cierre de eventos
vc2$existentes <- as.numeric(vc2$existentes)
vc2$enfermos <- as.numeric(vc2$enfermos)
vc2$muertos <- as.numeric(vc2$muertos)
vc2$sacrificad <- as.numeric(vc2$sacrificad)
vc2$canton <- vc2$cantón
vc2$cantón <- NULL
# -- Vigilancia general ----
v0 <- full_join(vc2, vr2)
## Joining, by = c("orden", "provincia", "parroquia", "cedula", "propietario",
## "semana", "zona", "coord_x", "coord_y", "predio", "t_explotación",
## "notificador", "f_1er_enfermo", "f_notificación", "f_1era_visita",
## "síndrome_presuntivo", "patología", "especie", "edad", "f_elaboración",
## "f_ingreso", "responsable", "# ALERTA", "RESULTADO", "ESTADO", "¿SUPERVISADO?",
## "canton")
v1 <- full_join(v0,vge2)
## Joining, by = c("orden", "provincia", "parroquia", "cedula", "propietario",
## "semana", "zona", "coord_x", "coord_y", "predio", "t_explotación",
## "notificador", "f_1er_enfermo", "f_notificación", "f_1era_visita",
## "síndrome_presuntivo", "patología", "especie", "edad", "f_elaboración",
## "f_ingreso", "responsable", "# ALERTA", "RESULTADO", "ESTADO", "¿SUPERVISADO?",
## "canton")
table(v1$especie)
##
## ABEJAS AVES BOVINOS BUBALINOS CAMELIDOS CAPRINOS
## 718 108 14851 13 3 166
## CERVIDOS CONEJOS CUYES EQUINOS GATOS MURCIELAGOS
## 1 1 63 965 7 1
## NO APLICA OVINOS PERROS PORCINOS
## 1 147 14 4060
#
# rm(vge0, vr0, vc0)
# rm(vc1,vc3,vc4,vc5,vc6,vc7,vc8)
# rm(vge1,vge3,vge4,vge5,vge6,vge7,vge8)
# rm(vr1,vr2,vr3,vr4,vr5,vr6,vr7,vr8)
# rm(vc2, vge2, vr2, vge)
colnames(v1)
## [1] "orden" "provincia" "parroquia"
## [4] "cedula" "propietario" "semana"
## [7] "zona" "coord_x" "coord_y"
## [10] "predio" "t_explotación" "notificador"
## [13] "f_1er_enfermo" "f_notificación" "f_1era_visita"
## [16] "síndrome_presuntivo" "patología" "especie"
## [19] "edad" "f_elaboración" "f_ingreso"
## [22] "f_cierre_orden" "responsable" "vacuno"
## [25] "focal" "dosis_focal" "perifocal"
## [28] "dosis_perifocal" "especie_f" "existentes"
## [31] "enfermos" "muertos" "sacrificad"
## [34] "# ALERTA" "DÍAS EN CERRAR" "RESULTADO"
## [37] "ESTADO" "¿SUPERVISADO?" "canton"
## [40] "colecta" "n_visita" "prueba_solicitada"
## [43] "detalle_diagnóstico" "laboratorio" "cant_muestras"
## [46] "positivos" "negativos" "indeterminados"
## [49] "reactivos" "fecha_ingreso" "fecha_liberado"
## [52] "diferencia_días" "liberado" "MUESTREO POR EEB"
## [55] "T. ALIMENTACIÓN" "RAZÓN MUESTREO" "F. INFORME"
## [58] "ESPECIE...31" "REGISTRO...40" "RECOMENDACIONES"
## [61] "RESPONSABLE" "muestreo.por.eeb" "t.alimentacion"
## [64] "razon.muestreo"
v2 <- v1 %>%
# filter(detalle_diagnóstico == "Peste porcina clásica")%>%
# filter(detalle_diagnóstico == "PESTE PORCINA CLÁSICA")%>%
group_by(orden, provincia, canton, parroquia, cedula, propietario, semana,
zona,
coord_x, coord_y, predio,t_explotación, notificador,
f_1er_enfermo, f_notificación, f_1era_visita, síndrome_presuntivo,
patología, especie, edad, f_elaboración, f_ingreso, f_cierre_orden,
detalle_diagnóstico,
responsable, vacuno, focal, dosis_focal, perifocal, dosis_perifocal,
especie_f, colecta)%>%
summarise(existente=sum(existentes, muertos, sacrificad), enfermo=sum(enfermos), mortos=sum(muertos),
sacrifi=sum(sacrificad), afetados=sum(muertos,sacrificad),
pos=sum(positivos), total_muestras=sum(cant_muestras), reactivo=sum(reactivos))
## `summarise()` has grouped output by 'orden', 'provincia', 'canton',
## 'parroquia', 'cedula', 'propietario', 'semana', 'zona', 'coord_x', 'coord_y',
## 'predio', 't_explotación', 'notificador', 'f_1er_enfermo', 'f_notificación',
## 'f_1era_visita', 'síndrome_presuntivo', 'patología', 'especie', 'edad',
## 'f_elaboración', 'f_ingreso', 'f_cierre_orden', 'detalle_diagnóstico',
## 'responsable', 'vacuno', '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] 9719
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: 12 × 2
## ano notifi
## <dbl> <int>
## 1 1902 2
## 2 1921 1
## 3 2012 1
## 4 2013 7
## 5 2014 357
## 6 2015 1037
## 7 2016 1300
## 8 2017 1489
## 9 2018 2068
## 10 2019 1479
## 11 2020 989
## 12 2021 989
# Numero de notificaciones
v2 %>%
# group_by(month)%>%
group_by(especie_f)%>%
filter(ano <2020)%>%
filter(ano >2014)%>%
summarise(notifi_geral=length(unique(orden)))%>%
arrange(desc(notifi_geral))
## # A tibble: 15 × 2
## especie_f notifi_geral
## <chr> <int>
## 1 BOVINOS 4991
## 2 PORCINOS 1413
## 3 EQUINOS 447
## 4 ABEJAS 293
## 5 OVINOS 63
## 6 CAPRINOS 55
## 7 CUYES 44
## 8 <NA> 32
## 9 AVES 20
## 10 BUBALINOS 5
## 11 PERROS 5
## 12 GATOS 2
## 13 CERVIDOS 1
## 14 MURCIELAGOS 1
## 15 NO APLICA 1
# Número de notificaciones por especie alta notificacion
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="#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 <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="#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 = 14))
## `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))+
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.
Mostrando primeras 40 lineas
v2 %>%
# group_by(month)%>%
group_by(Month, ano,patología, especie_f)%>%
filter(ano >2020)%>%
# filter(ano >2013)%>%
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 == "PORCINOS")
v2 <- v2 %>%
# filter(detalle_diagnóstico == "Peste porcina clásica")%>%
# filter(detalle_diagnóstico == "PESTE PORCINA CLÁSICA")%>%
group_by(orden, provincia, canton, parroquia, cedula, propietario, semana, zona,
coord_x, coord_y, predio,t_explotación, notificador,
f_1er_enfermo, f_notificación, f_1era_visita, síndrome_presuntivo,
patología, especie, edad, f_elaboración, f_ingreso, f_cierre_orden,
responsable, vacuno, focal, dosis_focal, perifocal, dosis_perifocal,
especie_f, colecta)%>%
summarise(existente=sum(existentes, muertos, sacrificad), enfermo=sum(enfermos), mortos=sum(muertos),
sacrifi=sum(sacrificad), afetados=sum(muertos,sacrificad),
pos=sum(positivos), total_muestras=sum(cant_muestras),
indeterm=sum(indeterminados), reactivo=sum(reactivos))
## `summarise()` has grouped output by 'orden', 'provincia', 'canton',
## 'parroquia', 'cedula', 'propietario', 'semana', 'zona', 'coord_x', 'coord_y',
## 'predio', 't_explotación', 'notificador', 'f_1er_enfermo', 'f_notificación',
## 'f_1era_visita', 'síndrome_presuntivo', 'patología', 'especie', 'edad',
## 'f_elaboración', 'f_ingreso', 'f_cierre_orden', 'responsable', 'vacuno',
## '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] 1881
#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: 8 × 2
## ano notifi
## <dbl> <int>
## 1 2014 59
## 2 2015 346
## 3 2016 199
## 4 2017 291
## 5 2018 306
## 6 2019 272
## 7 2020 201
## 8 2021 207
sum(as.numeric(v2$total_muestras), na.rm=TRUE)
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.
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(vc2, vr2)
## Joining, by = c("orden", "provincia", "parroquia", "cedula", "propietario",
## "semana", "zona", "coord_x", "coord_y", "predio", "t_explotación",
## "notificador", "f_1er_enfermo", "f_notificación", "f_1era_visita",
## "síndrome_presuntivo", "patología", "especie", "edad", "f_elaboración",
## "f_ingreso", "responsable", "# ALERTA", "RESULTADO", "ESTADO", "¿SUPERVISADO?",
## "canton")
v1 <- full_join(v0,vge2)
## Joining, by = c("orden", "provincia", "parroquia", "cedula", "propietario",
## "semana", "zona", "coord_x", "coord_y", "predio", "t_explotación",
## "notificador", "f_1er_enfermo", "f_notificación", "f_1era_visita",
## "síndrome_presuntivo", "patología", "especie", "edad", "f_elaboración",
## "f_ingreso", "responsable", "# ALERTA", "RESULTADO", "ESTADO", "¿SUPERVISADO?",
## "canton")
# table(v1$especie)
# table(v1$prueba_solicitada)
# 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(detalle_diagnóstico == "Peste porcina clásica")%>%
filter(detalle_diagnóstico == "PESTE PORCINA CLÁSICA")%>%
group_by(orden, provincia, canton, parroquia, cedula, propietario, semana, zona,
coord_x, coord_y, predio,t_explotación, notificador,
f_1er_enfermo, f_notificación, f_1era_visita, síndrome_presuntivo,
patología, especie, edad, f_elaboración, f_ingreso, f_cierre_orden, prueba_solicitada,
responsable, vacuno, focal, dosis_focal, perifocal, dosis_perifocal,
especie_f, colecta)%>%
filter(str_detect(prueba_solicitada, "PESTE PORCINA"))%>%
group_by(orden, provincia, canton, parroquia, cedula, propietario, semana, zona,
coord_x, coord_y, predio,t_explotación, notificador,
f_1er_enfermo, f_notificación, f_1era_visita, síndrome_presuntivo,
patología, especie, edad, f_elaboración, f_ingreso, f_cierre_orden,
responsable, vacuno, focal, dosis_focal, perifocal, dosis_perifocal,
especie_f, colecta)%>%
summarise(existente=sum(existentes, muertos, sacrificad), enfermo=sum(enfermos), mortos=sum(muertos),
sacrifi=sum(sacrificad), afetados=sum(muertos,sacrificad),
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', 'canton',
## 'parroquia', 'cedula', 'propietario', 'semana', 'zona', 'coord_x', 'coord_y',
## 'predio', 't_explotación', 'notificador', 'f_1er_enfermo', 'f_notificación',
## 'f_1era_visita', 'síndrome_presuntivo', 'patología', 'especie', 'edad',
## 'f_elaboración', 'f_ingreso', 'f_cierre_orden', 'responsable', 'vacuno',
## 'focal', 'dosis_focal', 'perifocal', 'dosis_perifocal', 'especie_f'. You can
## override using the `.groups` argument.
length(unique(v2$orden))
## [1] 1099
table(v2$definitivo)
##
## caso notifi
## 305 794
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
## 62 89 64 57 58 49 36 29 41 53 24 28 14 27 22 29
## 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
## 20 25 13 19 12 23 5 9 5 12 6 7 5 15 5 8
## 33 34 35 36 37 38 39 40 41 42 43 44 45 46 48 49
## 3 4 3 8 3 6 1 5 4 3 3 8 5 3 3 2
## 50 51 52 53 54 55 56 58 59 60 61 62 63 64 65 66
## 2 2 7 1 3 4 4 5 1 5 5 6 2 4 2 4
## 67 69 70 72 73 75 78 79 80 82 83 84 86 87 89 90
## 2 1 4 1 1 2 2 1 1 1 1 2 2 3 2 5
## 93 95 96 98 99 100 102 104 106 107 108 111 112 114 116 119
## 3 1 2 1 1 2 1 1 1 1 1 2 1 2 1 1
## 120 130 134 139 144 148 158 160 171 174 184 188 190 195 196 198
## 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2
## 199 204 212 227 232 260 272 277 284 289 302 309 321 324 335 369
## 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## 384 394 408 513 764 812 1000 1782 2600 2795
## 1 1 1 1 1 1 1 1 1 1
summary(v2$existente)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 1.00 4.75 11.00 35.17 26.00 2795.00 11
#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] 1097
#1089 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: 8 × 3
## # Groups: ano [8]
## ano caso notifi
## <dbl> <int> <int>
## 1 2014 23 12
## 2 2015 82 136
## 3 2016 30 96
## 4 2017 39 121
## 5 2018 60 117
## 6 2019 34 126
## 7 2020 21 79
## 8 2021 16 105
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 > 2014)%>%
# 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: 7 × 3
## ano notificacion_vigilancia_dirigida casos
## <dbl> <int> <int>
## 1 2015 218 82
## 2 2016 126 30
## 3 2017 160 39
## 4 2018 177 60
## 5 2019 160 34
## 6 2020 100 21
## 7 2021 121 16
# 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))
## Warning: Removed 3 rows containing missing values (position_stack).
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(vc2, vr2)
## Joining, by = c("orden", "provincia", "parroquia", "cedula", "propietario",
## "semana", "zona", "coord_x", "coord_y", "predio", "t_explotación",
## "notificador", "f_1er_enfermo", "f_notificación", "f_1era_visita",
## "síndrome_presuntivo", "patología", "especie", "edad", "f_elaboración",
## "f_ingreso", "responsable", "# ALERTA", "RESULTADO", "ESTADO", "¿SUPERVISADO?",
## "canton")
v1 <- full_join(v0,vge2)
## Joining, by = c("orden", "provincia", "parroquia", "cedula", "propietario",
## "semana", "zona", "coord_x", "coord_y", "predio", "t_explotación",
## "notificador", "f_1er_enfermo", "f_notificación", "f_1era_visita",
## "síndrome_presuntivo", "patología", "especie", "edad", "f_elaboración",
## "f_ingreso", "responsable", "# ALERTA", "RESULTADO", "ESTADO", "¿SUPERVISADO?",
## "canton")
# 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(detalle_diagnóstico == "SÍNDROME DISGENÉSICO Y RESPIRATORIO PORCINO")%>%
group_by(orden, provincia, canton, parroquia, cedula, propietario, semana, zona,
coord_x, coord_y, predio,t_explotación, notificador,
f_1er_enfermo, f_notificación, f_1era_visita, síndrome_presuntivo,
patología, especie, edad, f_elaboración, f_ingreso, f_cierre_orden, prueba_solicitada,
responsable, vacuno, focal, dosis_focal, perifocal, dosis_perifocal,
especie_f, colecta)%>%
group_by(orden, provincia, canton, parroquia, cedula, propietario, semana, zona,
coord_x, coord_y, predio, t_explotación, notificador,
f_1er_enfermo, f_notificación, f_1era_visita, síndrome_presuntivo,
patología, especie, edad, f_elaboración, f_ingreso, f_cierre_orden,
responsable, vacuno, focal, dosis_focal, perifocal, dosis_perifocal,
especie_f, colecta)%>%
summarise(existente=sum(existentes, muertos, sacrificad), enfermo=sum(enfermos), mortos=sum(muertos),
sacrifi=sum(sacrificad), afetados=sum(muertos,sacrificad),
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', 'canton',
## 'parroquia', 'cedula', 'propietario', 'semana', 'zona', 'coord_x', 'coord_y',
## 'predio', 't_explotación', 'notificador', 'f_1er_enfermo', 'f_notificación',
## 'f_1era_visita', 'síndrome_presuntivo', 'patología', 'especie', 'edad',
## 'f_elaboración', 'f_ingreso', 'f_cierre_orden', 'responsable', 'vacuno',
## 'focal', 'dosis_focal', 'perifocal', 'dosis_perifocal', 'especie_f'. You can
## override using the `.groups` argument.
length(unique(v2$orden))
## [1] 52
table(v2$definitivo)
##
## caso notifi
## 22 30
plot(v2$existente)
hist(log(v2$existente))
table(v2$existente)
##
## 1 2 4 5 7 10 12 14 15 18 27 30 32 33 34 35
## 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 2
## 37 40 42 48 54 55 60 64 73 110 130 189 190 200 202 222
## 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## 290 384 410 429 508 945 1198 1344 1631 2655 3489 3605 5351 5714
## 1 1 1 1 1 1 1 1 1 1 1 1 1 1
summary(v2$existente)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 1.0 27.0 55.0 612.6 384.0 5714.0 3
#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] 52
#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: 7 × 3
## # Groups: ano [7]
## ano caso notifi
## <dbl> <int> <int>
## 1 2014 NA 1
## 2 2015 1 6
## 3 2017 8 3
## 4 2018 7 7
## 5 2019 2 1
## 6 2020 NA 2
## 7 2021 4 10
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: 7 × 3
## ano notificacion_vigilancia_dirigida casos
## <dbl> <int> <int>
## 1 2014 1 0
## 2 2015 7 1
## 3 2017 11 8
## 4 2018 14 7
## 5 2019 3 2
## 6 2020 2 0
## 7 2021 14 4
# 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))
## Warning: Removed 3 rows containing missing values (position_stack).
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 26 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)%>%
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 25 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.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 mes")+
theme_minimal()
## `summarise()` has grouped output by 'definitivo'. You can override using the
## `.groups` argument.
## Warning: Removed 18 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(detalle_diagnóstico == "LENGUA AZUL")%>%
# filter(stringr::str_detect(prueba_solicitada, "LENGUA"))%>%
group_by(orden, provincia, canton, parroquia, cedula, propietario, semana, zona,
coord_x, coord_y, predio,t_explotación, notificador,
f_1er_enfermo, f_notificación, f_1era_visita, síndrome_presuntivo,
especie, edad, f_elaboración, f_ingreso, f_cierre_orden,
responsable, vacuno, focal, dosis_focal, perifocal, dosis_perifocal,
especie_f, colecta)%>%
summarise(existente=sum(existentes, muertos, sacrificad), enfermo=sum(enfermos), mortos=sum(muertos),
sacrifi=sum(sacrificad), afetados=sum(muertos,sacrificad),
pos=sum(positivos), total_muestras=sum(cant_muestras), reactivo=sum(reactivos))
## `summarise()` has grouped output by 'orden', 'provincia', 'canton',
## 'parroquia', 'cedula', 'propietario', 'semana', 'zona', 'coord_x', 'coord_y',
## 'predio', 't_explotación', 'notificador', 'f_1er_enfermo', 'f_notificación',
## 'f_1era_visita', 'síndrome_presuntivo', 'especie', 'edad', 'f_elaboración',
## 'f_ingreso', 'f_cierre_orden', 'responsable', 'vacuno', '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(detalle_diagnóstico) %>%
summarise(numero=length(unique(orden)))
## # A tibble: 14 × 2
## detalle_diagnóstico numero
## <chr> <int>
## 1 ANAPLASMOSIS BOVINA 1
## 2 BRUCELOSIS (BRUCELLA ABORTUS) 1
## 3 DESESTIMADO 1
## 4 DIARREA VIRAL BOVINA 395
## 5 ESTOMATITIS VESICULAR 659
## 6 ESTOMATITIS VESICULAR INDIANA 13
## 7 ESTOMATITIS VESICULAR NEWJERSEY 11
## 8 FIEBRE AFTOSA 1044
## 9 LENGUA AZUL 360
## 10 LEUCOSIS BOVINA ENZOÓTICA 2
## 11 NEOSPOROSIS 1
## 12 NO APLICA 7
## 13 RINOTRAQUEÍTIS INFECCIOSA BOVINA/VULVOVAGINITIS PUSTULAR INFECCIOSA 406
## 14 <NA> 125
length(unique(v2$orden))
## [1] 381
#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: 8 × 2
## ano notifi
## <dbl> <int>
## 1 2014 4
## 2 2015 38
## 3 2016 82
## 4 2017 54
## 5 2018 149
## 6 2019 27
## 7 2020 19
## 8 2021 8
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: 11 × 3
## # Groups: ano [8]
## ano especie notifi
## <dbl> <chr> <int>
## 1 2014 BOVINOS 4
## 2 2015 BOVINOS 36
## 3 2015 CAPRINOS 1
## 4 2015 OVINOS 1
## 5 2016 BOVINOS 81
## 6 2016 OVINOS 1
## 7 2017 BOVINOS 54
## 8 2018 BOVINOS 149
## 9 2019 BOVINOS 27
## 10 2020 BOVINOS 19
## 11 2021 BOVINOS 8
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.
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, canton, parroquia, cedula, propietario, semana, zona, coord_x, coord_y, predio,t_explotación, notificador, f_1er_enfermo, f_notificación, f_1era_visita, síndrome_presuntivo,
patología, especie, edad, f_elaboración, f_ingreso, f_cierre_orden, prueba_solicitada,
responsable, vacuno, focal, dosis_focal, perifocal, dosis_perifocal,
especie_f, colecta)%>%
filter(str_detect(prueba_solicitada, "LENGUA"))%>%
group_by(orden, provincia, canton, parroquia, cedula, propietario, semana, zona,
coord_x, coord_y, predio,t_explotación, notificador,
f_1er_enfermo, f_notificación, f_1era_visita, síndrome_presuntivo,
patología, especie, edad, f_elaboración, f_ingreso, f_cierre_orden,
responsable, vacuno, focal, dosis_focal, perifocal, dosis_perifocal,
especie_f, colecta)%>%
summarise(existente=sum(existentes, muertos, sacrificad), enfermo=sum(enfermos), mortos=sum(muertos),
sacrifi=sum(sacrificad), afetados=sum(muertos,sacrificad),
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', 'canton',
## 'parroquia', 'cedula', 'propietario', 'semana', 'zona', 'coord_x', 'coord_y',
## 'predio', 't_explotación', 'notificador', 'f_1er_enfermo', 'f_notificación',
## 'f_1era_visita', 'síndrome_presuntivo', 'patología', 'especie', 'edad',
## 'f_elaboración', 'f_ingreso', 'f_cierre_orden', 'responsable', 'vacuno',
## 'focal', 'dosis_focal', 'perifocal', 'dosis_perifocal', 'especie_f'. You can
## override using the `.groups` argument.
length(unique(v2$orden))
## [1] 380
table(v2$definitivo)
##
## .no caso caso
## 56 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 384 456 800 1210 1611 4755
## 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 50.74 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] 380
#380 com atualizacao 10/12/2021 todas as patologias
length(unique(paste(v2$cedula,v2$predio)))
## [1] 379
#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: 8 × 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
library(tidyr)
v2 %>%
group_by(ano)%>%
summarise(Notificaciones=length(unique(paste(cedula, predio))),
Casos=sum(definitivo == "2 caso"),
prev=round((Casos/Notificaciones),2))
## # A tibble: 8 × 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
# 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.
# Eventos sanitarios por mes distribuidos en caso y no caso
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: 7 × 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
# 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: 8 × 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
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: 92 × 6
## # Groups: ano, month [63]
## 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 82 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.
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.
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 40 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 30 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.
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.