Fecha y hora de reporte:16-10-2023 19:39:00’

General

Row

Atenciones medicas acumuladas

350
Primer Contacto
10
Pre-hosp.-Urgencias
2
Traslados
2
Alertamiento a Hospitales

Afluencia

Row

Zonas F1

No de atenciones por Zona y Modulo

Diagnosticos mas frecuentes

Distribución de atenciones

Row

Atenciones por grupo de edad y sexo

Derechohabiencia y procedencia

Row

Fomento sanitario

Instalaciones sanitarias Cloración de agua Establecimientos de alimentos Edas por día

---
title: "Vigilancia epidemiológica 2023"
output: 
  flexdashboard::flex_dashboard:
    theme:
      bg: "#EEF9F8"
      fg: "#CA0020" 
      primary: "#285C4D"
      base_font:
        google: Prompt
      code_font:
        google: JetBrains Mono
    orientation: rows
    vertical_layout: scroll
    logo: F24.png
    source_code: embed
---


```{r echo=FALSE, results='asis'}
fecha_actual <- format(Sys.time(), "%d-%m-%Y %H:%M:%S")
cat(paste0("Fecha y hora de reporte:", fecha_actual, "'"))


```


```{r setup, include=FALSE}
# Bibliotecas generales y de configuración
library(flexdashboard)
library(shiny)
library(highcharter)
library(shinydashboard)
library(htmlwidgets)
library(htmltools)
library(bslib)
library(bsicons)
library(treemapify)
library(ggplot2)
library(rio)
library(here)
library(tidyverse)
library(plotly)



```

General
=======================================================================

Row {data-height=160}
---------------------------------------------------------------------------

### Atenciones medicas acumuladas

```{r}
library(htmltools)

# Datos ajustar de acuerdo al numero de casos
atenciones_medicas <- 350
atenciones_urgencias <- 10
traslados <- 2
alertamientos_hosp <- 2  

# Ajustando el tamaño de las cajas
box_width <- "146px"
box_height <- "18px"
font_size_value <- "19px"
font_size_label <- "13px"
font_size_icon <- "23px"
box_padding <- "10px"

# Recuadro 1: Atenciones Médicas
box1 <- div(
  style = paste("background-color: aqua; padding:", box_padding, "; text-align: center; margin: 5px; display: inline-block; width:", box_width),
  div(style = paste("font-size:", font_size_value), atenciones_medicas),
  div(style = paste("font-size:", font_size_label, "; margin-top: 2px;"), "Primer Contacto "),
  div(style = paste("font-size:", font_size_icon, "; margin-top: 2px;"), tags$i(class = "fa fa-hospital"))
)

# Recuadro 2: Atenciones de Urgencias
box2 <- div(
  style = paste("background-color: lightcoral; padding:", box_padding, "; text-align: center; margin: 5px; display: inline-block; width:", box_width),
  div(style = paste("font-size:", font_size_value), atenciones_urgencias),
  div(style = paste("font-size:", font_size_label, "; margin-top: 2px;"), "Pre-hosp.-Urgencias"),
  div(style = paste("font-size:", font_size_icon, "; margin-top: 2px;"), tags$i(class = "fa fa-procedures"))
)

# Recuadro 3: Traslados
box3 <- div(
  style = paste("background-color: lightgreen; padding:", box_padding, "; text-align: center; margin: 5px; display: inline-block; width:", box_width),
  div(style = paste("font-size:", font_size_value), traslados),
  div(style = paste("font-size:", font_size_label, "; margin-top: 2px;"), "Traslados"),
  div(style = paste("font-size:", font_size_icon, "; margin-top: 2px;"), tags$i(class = "fa fa-ambulance"))
)

# Recuadro 4: Alertamiento a Hosp.
box4 <- div(
  style = paste("background-color: lightsalmon; padding:", box_padding, "; text-align: center; margin: 5px; display: inline-block; width:", box_width),
  div(style = paste("font-size:", font_size_value), alertamientos_hosp),
  div(style = paste("font-size:", font_size_label, "; margin-top: 2px;"), "Alertamiento a Hospitales"),
  div(style = paste("font-size:", font_size_icon, "; margin-top: 2px;"), tags$i(class = "fa fa-exclamation-triangle"))
)

# Mostrando todos los recuadros incluyendo el nuevo
boxes <- tagList(box1, box2, box3, box4)
boxes

 
```


### Afluencia

```{r, echo=FALSE, fig.width=3, fig.height=3}
library(shinyWidgets)
Afluencia <- 93
gauge(Afluencia, min = 0, max = 100, symbol = '%', 
      label = "Afluencia", gaugeSectors(
        success = c(0,80), warning = c(81, 94), danger = c(95, 100)
      ))
```

Row {data-height=400}
---------------------------------------------------------------------------

### Zonas F1


```{r}
knitr::include_graphics("C:/Users/Admin/Documents/Rcs2deoctubreepidemiologia/F12023/pistaF12023.png")


```


```{r setup2, include=FALSE}
library(flexdashboard)
library(shiny)
library(highcharter)
library(shinydashboard)
library(htmlwidgets)
#install.packages(c( "htmlwidgets", "digest", "bit"))
#devtools::install_github("jcheng5/bubbles")
#devtools::install_github("hadley/shinySignals")
# Install thematic and un-comment for themed static plots (i.e., ggplot2)
# thematic::thematic_rmd()
```



###  No de atenciones por Zona y Modulo



```{r echo=FALSE, warning=FALSE}

library(treemapify)
library(ggplot2)
pacman::p_load(rio,here,tidyverse)

baseinicial  <- import("F1_2023.xlsx")

color_palette <- c(
  "Verde" = "#437546",
  "Naranja" = "orange",
  "Azul alta" = "#3774A7",
  "Azul baja" = "#4892D1",
  "Morada/Pulgar" = "purple",
  "Amarillo" = "#E0E155",
  "Gris" = "#878787",
  "Café" = "#825F5D"
)

ggplot(baseinicial, aes(area = Atenciones, fill = Zona, label = Modulo, subgroup=Zona)) +    
  geom_treemap() +      
  geom_treemap_subgroup_text(place = "centre", grow = TRUE, alpha = 0.25, colour = "black") +     
  geom_treemap_text(aes(label = paste(Modulo, Atenciones, sep = "\n")), colour = "white", place = "centre", size = 12) + 
  scale_fill_manual(values = color_palette) +  # Usando la paleta de colores
  ggtitle("Zonas y Modulos") +     
  theme(legend.position =  "none", plot.title=element_text(size=20, face="bold"))


```


### Diagnosticos mas frecuentes

```{r echo=FALSE, warning=FALSE}

library(ggplot2)
library(openxlsx)
library(tidyverse)
library(ggthemes)
pacman::p_load(rio,here,tidyverse)

# Importando la base de datos desde la hoja "dxs"
baseinicial <- read.xlsx("F1_2023.xlsx", sheet = "dxs")

# Ordenando los datos de mayor a menor según 'Casos'
base_ordenada <- baseinicial %>%
  group_by(Diagnostico) %>%
  summarise(Casos = sum(Casos)) %>%
  arrange(-Casos)

# Creando el gráfico
ggplot(base_ordenada, aes(
  x = Casos,
  y = fct_reorder(Diagnostico, Casos), fill = Diagnostico
)) + 
  geom_col() +
  geom_text(aes(label = Casos), hjust = 1, vjust = -0.3, size = 2.5) + 
  ggtitle("Diagnósticos mas frecuentes", subtitle = "Datos del 2023") + 
  labs(caption = "fuente: F1_2023.xlsx, hoja: dxs") +
  ylab("Diagnóstico") + 
  theme_tufte() + 
  theme(legend.position = "none")  # Para remover la leyenda

```


Distribución de atenciones
=======================================================================

Row
-----------------------------------------------------------------------

### Atenciones por grupo de edad y sexo


### Derechohabiencia y procedencia

Row
-----------------------------------------------------------------------

### Fomento sanitario

Instalaciones sanitarias
Cloración de agua
Establecimientos de alimentos
Edas por día