Summary

Row

confirmed case

4,480,423

active case

4,335,926 (3.2%)

Death Case

144,497 (3.2%)

Row

Daily cumulative cases by type (Indonesia only)

Comparison

Column

Daily new confirmed cases

Cases distribution by type

Map

World map of cases (use + and - icons to zoom in/out)

About

The Coronavirus Dashboard: the case of Indonesia The Government of Indonesia has officially extended the emergency status due to the COVID-19 pandemic through Presidential Decree Number 24 of 2021, which was enacted on 31 December 2021. The Presidential Decree stipulates that the COVID-19 pandemic, which the WHO has declared a global pandemic, is still ongoing and has not ended in Indonesia. During the pandemic, the Government implements economic and financial policies, as well as special health and social measures and regulations. In order to manage, control, and/or prevent the COVID-19 pandemic and its impacts, particularly in the health, economic, and social sectors, the decree establishes that the Government may set up a policy through the establishment of a funding scheme between the Government and business entities that are engaged in financing health services and other schemes, in order to support citizens’ access to health services.

As of 4 January 2022, and since the beginning of the pandemic, the Indonesian Government has announced 4,263,732 confirmed cases of COVID-19 in all 34 provinces of Indonesia, with 4,658 active cases (including 254 cases of the Omicron variant), 144,105 deaths, and 4,114,969 people that have recovered. The Government has also reported 4,257 suspected cases.

Indonesia has received more than 470 million doses of the COVID-19 vaccine both in bulk form and ready-to-use vaccines as of 2 January 2022.

---
title: "COVID 19 in Indonesia"
author: "mochiyam sjarif"
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    # social: ["facebook", "twitter", "linkedin"]
    source_code: embed
    vertical_layout: fill
---
```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(glue)
library(plotly)
library(tidyr)
# install.packages("devtools")
devtools::install_github("RamiKrispin/coronavirus", force = TRUE)
library(coronavirus)
data(coronavirus)
update_dataset()
View(coronavirus)
max(coronavirus$date)

`%>%` <- magrittr::`%>%`
```

```{r}
#------------------ Parameters ------------------
# Set colors
# https://www.w3.org/TR/css-color-3/#svg-color
confirmed_color <- "purple"
active_color <- "#1f77b4"
recovered_color <- "forestgreen"
death_color <- "red"
#------------------ Data ------------------

df <- coronavirus %>%
  # dplyr::filter(date == max(date)) %>%
  dplyr::filter(country == "Indonesia") %>%
  dplyr::group_by(country, type) %>%
  dplyr::summarise(total = sum(cases)) %>%
  tidyr::pivot_wider(
    names_from = type,
    values_from = total
  ) %>%
  # dplyr::mutate(unrecovered = confirmed - ifelse(is.na(recovered), 0, recovered) - ifelse(is.na(death), 0, death)) %>%
  dplyr::mutate(unrecovered = confirmed - ifelse(is.na(death), 0, death)) %>%
  dplyr::arrange(-confirmed) %>%
  dplyr::ungroup() %>%
  dplyr::mutate(country = dplyr::if_else(country == "United Arab Emirates", "UAE", country)) %>%
  dplyr::mutate(country = dplyr::if_else(country == "Mainland China", "China", country)) %>%
  dplyr::mutate(country = dplyr::if_else(country == "North Macedonia", "N.Macedonia", country)) %>%
  dplyr::mutate(country = trimws(country)) %>%
  dplyr::mutate(country = factor(country, levels = country))
df_daily <- coronavirus %>%
  dplyr::filter(country == "Indonesia") %>%
  dplyr::group_by(date, type) %>%
  dplyr::summarise(total = sum(cases, na.rm = TRUE)) %>%
  tidyr::pivot_wider(
    names_from = type,
    values_from = total
  ) %>%
  dplyr::arrange(date) %>%
  dplyr::ungroup() %>%
  #dplyr::mutate(active = confirmed - death - recovered) %>%
  dplyr::mutate(active = confirmed - death) %>%
  dplyr::mutate(
    confirmed_cum = cumsum(confirmed),
    death_cum = cumsum(death),
    # recovered_cum = cumsum(recovered),
    active_cum = cumsum(active)
  )
df1 <- coronavirus %>% dplyr::filter(date == max(date))
```

```
```

Summary
=======================================================================

Row {data-width=400}
-----------------------------------------------------------------------
### confirmed case
```{r}
valueBox(
  value = paste(format(sum(df$confirmed), big.mark = ","), "", sep = " "),
  caption = "Total confirmed cases",
  icon = "fas fa-user-md",
  color = confirmed_color
)
```


### active case

```{r}
valueBox(
  value = paste(format(sum(df$unrecovered, na.rm = TRUE), big.mark = ","), " (",
    round(100 * sum(df$death, na.rm = TRUE) / sum(df$confirmed), 1),
    "%)",
    sep = ""
  ),
  caption = "Active cases (% of total cases)", icon = "fas fa-ambulance",
  color = active_color
)
```

### Death Case

```{r}
valueBox(
  value = paste(format(sum(df$death, na.rm = TRUE), big.mark = ","), " (",
    round(100 * sum(df$death, na.rm = TRUE) / sum(df$confirmed), 1),
    "%)",
    sep = ""
  ),
  caption = "Death cases (death rate)",
  icon = "fas fa-heart-broken",
  color = death_color
)
```


Row {data-height=800}
-----------------------------------------------------------------------
### **Daily cumulative cases by type** (Indonesia only)
    
```{r}
plotly::plot_ly(data = df_daily) %>%
  plotly::add_trace(
    x = ~date,
    # y = ~active_cum,
    y = ~confirmed_cum,
    type = "scatter",
    mode = "lines+markers",
    # name = "Active",
    name = "Confirmed",
    line = list(color = active_color),
    marker = list(color = active_color)
  ) %>%
  plotly::add_trace(
    x = ~date,
    y = ~death_cum,
    type = "scatter",
    mode = "lines+markers",
    name = "Death",
    line = list(color = death_color),
    marker = list(color = death_color)
  ) %>%
  plotly::add_annotations(
    x = as.Date("2020-03-02"),
    y = 1,
    text = paste("First case"),
    xref = "x",
    yref = "y",
    arrowhead = 5,
    arrowhead = 3,
    arrowsize = 1,
    showarrow = TRUE,
    ax = -10,
    ay = -90
  ) %>%
  plotly::add_annotations(
    x = as.Date("2020-03-11"),
    y = 1,
    text = paste("First death"),
    xref = "x",
    yref = "y",
    arrowhead = 5,
    arrowhead = 3,
    arrowsize = 1,
    showarrow = TRUE,
    ax = -10,
    ay = -90
  ) %>%
  plotly::layout(
    title = "",
    yaxis = list(title = "Cumulative number of cases"),
    xaxis = list(title = "Date"),
    legend = list(x = 0.1, y = 0.9),
    hovermode = "compare"
  )
```
Comparison
=======================================================================
Column {data-width=400}
-------------------------------------
### **Daily new confirmed cases**
    
```{r}
daily_confirmed <- coronavirus %>%
  dplyr::filter(type == "confirmed") %>%
  dplyr::filter(date >= "2020-02-29") %>%
  dplyr::mutate(country = country) %>%
  dplyr::group_by(date, country) %>%
  dplyr::summarise(total = sum(cases)) %>%
  dplyr::ungroup() %>%
  tidyr::pivot_wider(names_from = country, values_from = total)
#----------------------------------------
# Plotting the data
daily_confirmed %>%
  plotly::plot_ly() %>%
  plotly::add_trace(
    x = ~date,
    y = ~Indonesia,
    type = "scatter",
    mode = "lines+markers",
    name = "Indonesia"
  ) %>%
  plotly::add_trace(
     x = ~date,
     y = ~Malaysia,
     type = "scatter",
     mode = "lines+markers",
     name = "Malaysia"
  ) %>%
  plotly::add_trace(
    x = ~date,
    y = ~Singapore,
    type = "scatter",
    mode = "lines+markers",
    name = "Singapore"
  ) %>%
  plotly::add_trace(
    x = ~date,
    y = ~India,
    type = "scatter",
    mode = "lines+markers",
    name = "India"
  ) %>%
  plotly::layout(
    title = "",
    legend = list(x = 0.1, y = 0.9),
    yaxis = list(title = "Number of new confirmed cases"),
    xaxis = list(title = "Date"),
    # paper_bgcolor = "black",
    # plot_bgcolor = "black",
    # font = list(color = 'white'),
    hovermode = "compare",
    margin = list(
      # l = 60,
      # r = 40,
      b = 10,
      t = 10,
      pad = 2
    )
  )
```
 
### **Cases distribution by type**
```{r daily_summary}
df_EU <- coronavirus %>%
  # dplyr::filter(date == max(date)) %>%
  dplyr::filter(country == "Indonesia" |
    country == "Malaysia" |
    country == "Singapore" |
    country == "India") %>%
  dplyr::group_by(country, type) %>%
  dplyr::summarise(total = sum(cases)) %>%
  tidyr::pivot_wider(
    names_from = type,
    values_from = total
  ) %>%
  # dplyr::mutate(unrecovered = confirmed - ifelse(is.na(recovered), 0, recovered) - ifelse(is.na(death), 0, death)) %>%
  dplyr::mutate(unrecovered = confirmed - ifelse(is.na(death), 0, death)) %>%
  dplyr::arrange(confirmed) %>%
  dplyr::ungroup() %>%
  dplyr::mutate(country = dplyr::if_else(country == "United Arab Emirates", "UAE", country)) %>%
  dplyr::mutate(country = dplyr::if_else(country == "Mainland China", "China", country)) %>%
  dplyr::mutate(country = dplyr::if_else(country == "North Macedonia", "N.Macedonia", country)) %>%
  dplyr::mutate(country = trimws(country)) %>%
  dplyr::mutate(country = factor(country, levels = country))
plotly::plot_ly(
  data = df_EU,
  x = ~country,
  # y = ~unrecovered,
  y = ~ confirmed,
  # text =  ~ confirmed,
  # textposition = 'auto',
  type = "bar",
  name = "Confirmed",
  marker = list(color = active_color)
) %>%
  plotly::add_trace(
    y = ~death,
    # text =  ~ death,
    # textposition = 'auto',
    name = "Death",
    marker = list(color = death_color)
  ) %>%
  plotly::layout(
    barmode = "stack",
    yaxis = list(title = "Total cases"),
    xaxis = list(title = ""),
    hovermode = "compare",
    margin = list(
      # l = 60,
      # r = 40,
      b = 10,
      t = 10,
      pad = 2
    )
  )
```
Map
=======================================================================
### **World map of cases** (*use + and - icons to zoom in/out*)
```{r}
# map tab added by Art Steinmetz
library(leaflet)
library(leafpop)
library(purrr)
cv_data_for_plot <- coronavirus %>%
  # dplyr::filter(country == "Indonesia") %>%
  dplyr::filter(cases > 0) %>%
  dplyr::group_by(country, province, lat, long, type) %>%
  dplyr::summarise(cases = sum(cases)) %>%
  dplyr::mutate(log_cases = 2 * log(cases)) %>%
  dplyr::ungroup()
cv_data_for_plot.split <- cv_data_for_plot %>% split(cv_data_for_plot$type)
pal <- colorFactor(c("orange", "red", "green"), domain = c("confirmed", "death", "recovered"))
map_object <- leaflet() %>% addProviderTiles(providers$Stamen.Toner)
names(cv_data_for_plot.split) %>%
  purrr::walk(function(df) {
    map_object <<- map_object %>%
      addCircleMarkers(
        data = cv_data_for_plot.split[[df]],
        lng = ~long, lat = ~lat,
        #                 label=~as.character(cases),
        color = ~ pal(type),
        stroke = FALSE,
        fillOpacity = 0.8,
        radius = ~log_cases,
        popup = leafpop::popupTable(cv_data_for_plot.split[[df]],
          feature.id = FALSE,
          row.numbers = FALSE,
          zcol = c("type", "cases", "country", "province")
        ),
        group = df,
        #                 clusterOptions = markerClusterOptions(removeOutsideVisibleBounds = F),
        labelOptions = labelOptions(
          noHide = F,
          direction = "auto"
        )
      )
  })
map_object %>%
  addLayersControl(
    overlayGroups = names(cv_data_for_plot.split),
    options = layersControlOptions(collapsed = FALSE)
  )
```
About
=======================================================================
**The Coronavirus Dashboard: the case of Indonesia**
The Government of Indonesia has officially extended the emergency status due to the COVID-19 pandemic through Presidential Decree Number 24 of 2021, which was enacted on 31 December 2021. The Presidential Decree stipulates that the COVID-19 pandemic, which the WHO has declared a global pandemic, is still ongoing and has not ended in Indonesia. During the pandemic, the Government implements economic and financial policies, as well as special health and social measures and regulations. In order to manage, control, and/or prevent the COVID-19 pandemic and its impacts, particularly in the health, economic, and social sectors, the decree establishes that the Government may set up a policy through the establishment of a funding scheme between the Government and business entities that are engaged in financing health services and other schemes, in order to support citizens’ access to health services.

As of 4 January 2022, and since the beginning of the pandemic, the Indonesian Government has announced 4,263,732 confirmed cases of COVID-19 in all 34 provinces of Indonesia, with 4,658 active cases (including 254 cases of the Omicron variant), 144,105 deaths, and 4,114,969 people that have recovered. The Government has also reported 4,257 suspected cases.

Indonesia has received more than 470 million doses of the COVID-19 vaccine both in bulk form and ready-to-use vaccines as of 2 January 2022.