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")
## New names:
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * `` -> ...6
## * ...
# vge1 <- vge1[-1,]
vge2 <- readxl::read_excel("VEPG02_REP_GENERAL_BASICO 2015.xls")
## New names:
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * `` -> ...6
## * ...
vge2 <- vge2[-1,]
vge3 <- readxl::read_excel("VEPG02_REP_GENERAL_BASICO 2016.xls")
## New names:
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * `` -> ...6
## * ...
vge3 <- vge3[-1,]
vge4 <- readxl::read_excel("VEPG02_REP_GENERAL_BASICO 2017.xls")
## New names:
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * `` -> ...6
## * ...
vge4 <- vge4[-1,]
vge5 <- readxl::read_excel("VEPG02_REP_GENERAL_BASICO 2018.xls")
## New names:
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * `` -> ...6
## * ...
vge5 <- vge5[-1,]
vge6 <- readxl::read_excel("VEPG02_REP_GENERAL_BASICO 2019.xls")
## New names:
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * `` -> ...6
## * ...
vge6 <- vge6[-1,]
vge7 <- readxl::read_excel("VEPG02_REP_GENERAL_BASICO 2020.xls")
## New names:
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * `` -> ...6
## * ...
vge7 <- vge7[-1,]
vge8 <- readxl::read_excel("VEPG02_REP_GENERAL_BASICO 2021.xls")
## New names:
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * `` -> ...6
## * ...
vge8 <- vge8[-1,]
vge <- rbind(vge1, vge2, vge3, vge4, vge5, vge6, vge7, vge8)
vge1 <- readxl::read_excel("VEPG02_REP_GENERAL_BASICO 2015.xls")
## New names:
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * `` -> ...6
## * ...
colnames(vge) <- vge1[1,]
# colnames(vge0)
# colnames(vge)
# Reordenar y revisar bien Cristian ----
vge <- vge[,c(1,5:7,9,10,4,8,8,8,11:18,
20:24,3,3,27)]
# 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(vge) <- colnames(vge0)
vge <- vge[-1,]
# Archivos de resultados ----
vr1 <- readxl::read_excel("VEPG02_REP_RESULTADOS 2014.xls")
## New names:
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * `` -> ...6
## * ...
# vr1 <- vr1[-1,]
vr2 <- readxl::read_excel("VEPG02_REP_RESULTADOS 2015.xls")
## New names:
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * `` -> ...6
## * ...
vr2 <- vr2[-1,]
vr3 <- readxl::read_excel("VEPG02_REP_RESULTADOS 2016.xls")
## New names:
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * `` -> ...6
## * ...
vr3 <- vr3[-1,]
vr4 <- readxl::read_excel("VEPG02_REP_RESULTADOS 2017.xls")
## New names:
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * `` -> ...6
## * ...
vr4 <- vr4[-1,]
vr5 <- readxl::read_excel("VEPG02_REP_RESULTADOS 2018.xls")
## New names:
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * `` -> ...6
## * ...
vr5 <- vr5[-1,]
vr6 <- readxl::read_excel("VEPG02_REP_RESULTADOS 2019.xls")
## New names:
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * `` -> ...6
## * ...
vr6 <- vr6[-1,]
vr7 <- readxl::read_excel("VEPG02_REP_RESULTADOS 2020.xls")
## New names:
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * `` -> ...6
## * ...
vr7 <- vr7[-1,]
vr8 <- readxl::read_excel("VEPG02_REP_RESULTADOS 2021.xls")
## New names:
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * `` -> ...6
## * ...
vr8 <- vr8[-1,]
vr <- rbind(vr1, vr2, vr3, vr4, vr5, vr6, vr7, vr8)
# colnames(vr)
# colnames(vr0)
vr <- 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(vr) <- colnames(vr0)
vr <- vr[-1,]
# Archivos de cierre ----
vc1 <- readxl::read_excel("VEPG02_REP_CIERRE 2014.xls")
## New names:
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * `` -> ...6
## * ...
# vc1 <- vc1[-1,]
vc2 <- readxl::read_excel("VEPG02_REP_CIERRE 2015.xls")
## New names:
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * `` -> ...6
## * ...
vc2 <- vc2[-1,]
vc3 <- readxl::read_excel("VEPG02_REP_CIERRE 2016.xls")
## New names:
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * `` -> ...6
## * ...
vc3 <- vc3[-1,]
vc4 <- readxl::read_excel("VEPG02_REP_CIERRE 2017.xls")
## New names:
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * `` -> ...6
## * ...
vc4 <- vc4[-1,]
vc5 <- readxl::read_excel("VEPG02_REP_CIERRE 2018.xls")
## New names:
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * `` -> ...6
## * ...
vc5 <- vc5[-1,]
vc6 <- readxl::read_excel("VEPG02_REP_CIERRE 2019.xls")
## New names:
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * `` -> ...6
## * ...
vc6 <- vc6[-1,]
vc7 <- readxl::read_excel("VEPG02_REP_CIERRE 2020.xls")
## New names:
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * `` -> ...6
## * ...
vc7 <- vc7[-1,]
vc8 <- readxl::read_excel("VEPG02_REP_CIERRE 2021.xls")
## New names:
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * `` -> ...6
## * ...
vc8 <- vc8[-1,]
vc <- rbind(vc1, vc2, vc3, vc4, vc5, vc6, vc7, vc8)
vc1 <- readxl::read_excel("VEPG02_REP_CIERRE 2014.xls")
## New names:
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * `` -> ...6
## * ...
colnames(vc) <- vc1[1,]
# colnames(vc0)
# colnames(vc)
# Reordenar ----
vc <- vc[,c(1,7:9,11,12,4,10,10,10,13:20,
22,23,3,3,5,36,26:35)]
colnames(vc) <- colnames(vc0)
# Revisar si son los colnames verdaderos luego borrar primera linea
vc <- vc[-1,]
rm(vge0, vr0, vc0)
rm(vc1,vc2,vc3,vc4,vc5,vc6,vc7,vc8)
rm(vge1,vge2,vge3,vge4,vge5,vge6,vge7,vge8)
rm(vr1,vr2,vr3,vr4,vr5,vr6,vr7,vr8)
vge$canton <- vge$cantón
vge$cantón <- NULL
#Banco Resultados de eventos
vr$cant_muestras <- as.numeric(vr$cant_muestras)
vr$positivos <- as.numeric(vr$positivos)
vr$negativos <- as.numeric(vr$negativos)
vr$reactivos <- as.numeric(vr$reactivos)
vr$indeterminados <- as.numeric(vr$indeterminados)
vr$canton <- vr$cantón
vr$cantón <- NULL
# Banco Cierre de eventos
vc$existentes <- as.numeric(vc$existentes)
vc$enfermos <- as.numeric(vc$enfermos)
vc$muertos <- as.numeric(vc$muertos)
vc$sacrificad <- as.numeric(vc$sacrificad)
vc$canton <- vc$cantón
vc$cantón <- NULL
# -- Vigilancia general ----
v0 <- left_join(vc, vr)
## 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", "canton")
v1 <- left_join(v0,vge)
## 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", "canton")
table(v1$especie)
##
## ABEJAS AVES BOVINOS BUBALINOS CAMELIDOS CAPRINOS
## 711 108 14665 13 3 165
## CERVIDOS CONEJOS CUYES EQUINOS GATOS MURCIELAGOS
## 1 1 63 935 7 1
## NO APLICA OVINOS PERROS PORCINOS
## 1 144 13 4028
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),
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', '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] 9564
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 x 2
## ano notifi
## <dbl> <int>
## 1 1902 2
## 2 1921 1
## 3 2012 1
## 4 2013 7
## 5 2014 331
## 6 2015 1029
## 7 2016 1296
## 8 2017 1487
## 9 2018 2058
## 10 2019 1471
## 11 2020 984
## 12 2021 897
# 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: 16 x 2
## especie_f notifi_geral
## <chr> <int>
## 1 BOVINOS 6363
## 2 PORCINOS 1865
## 3 EQUINOS 542
## 4 ABEJAS 520
## 5 CAPRINOS 95
## 6 OVINOS 88
## 7 CUYES 44
## 8 AVES 25
## 9 BUBALINOS 6
## 10 PERROS 6
## 11 CAMELIDOS 3
## 12 GATOS 3
## 13 CERVIDOS 1
## 14 CONEJOS 1
## 15 MURCIELAGOS 1
## 16 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] 1863
#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 x 2
## ano notifi
## <dbl> <int>
## 1 2014 58
## 2 2015 346
## 3 2016 199
## 4 2017 291
## 5 2018 304
## 6 2019 271
## 7 2020 201
## 8 2021 193
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 <- left_join(vc, vr)
## 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", "canton")
v1 <- left_join(v0,vge)
## 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", "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] 1088
table(v2$definitivo)
##
## caso notifi
## 300 788
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.
## 1.00 4.75 11.00 35.17 26.00 2795.00
#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] 1086
#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 x 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 125
## 7 2020 21 79
## 8 2021 11 100
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 x 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 159 34
## 6 2020 100 21
## 7 2021 111 11
# 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(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))
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.