---
title: "Learning from Examples"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Learning-from-Examples}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

```{r setup}
library(graveler)
```


## Learn from Examples!

Before you start, scope well your project. Dashboard are not always the best way to present information. Think of a simple comparison: when you drive your car, your dashboard is giving you the key information you need so that you can make a decision based on a knowledge you already have (_i.e., you already know how to interpret the information of the various gauges_). If you rather try to present information, in order to build knowledge, then creating a notebook with narrative to explain the data will be likely more effective.

You can see check typical examples of dashboard within the package: one for protection monitoring and one for response monitoring. They were prepared with dummy data for the famous country called [Ruritania](Ruritania)

As a _rule of thumb_, a good dashboard should remain simple to be effective (aka not more than 7 charts, and not more than 7 categories by charts). 

To help in the design process, the package includes examples of typical charts that can be assembled together both for Response and Protection Monitoring. The file structure is located in the [examples folder](https://github.com/Edouard-Legoupil/graveler/tree/main/inst/examples).

##### Example 1: Protection Monitoring

Typically the content of a Protection Monitoring Dashboard allows to quickly identify the situation of basic rights in order to pilot the activities on the ground. It should complement (_and not replace!_) an in-depth protection analysis based on the protection risk equation. It would include: 

 1.  __Exposure: Vulnerable Populations:__ Treemap displaying the percentage of different vulnerable populations (e.g., children, women, elderly, disabled) affected by protection concerns. 

 2.  __Thread: Incident Types and Frequency:__ Line chart illustrating the trend in the frequency of of different types of protection incidents (e.g., violence, exploitation, discrimination) over time, allowing for identification of spikes or patterns.

 3.  __Coping: Response Coverage:__ Donut chart showcasing the coverage and reach of protection interventions by different implementing organizations or sectors.

 4.  __Compliance with Protection Standards:__ Radar chart comparing the adherence to different protection standards (e.g., human rights principles, international humanitarian law) by various implementing actors or sectors.

 5.  __Protection Advocacy Challenges:__ Gantt chart depicting the timeline of identified advocacy and the status of efforts to address them, allowing for tracking progress and resolution.

 6.  __Key Performance Indicators (KPIs):__  Highlighted numbers specific KPIs related to the protection response (e.g., number of cases resolved, number of survivors accessing support services). 

 7.  __Geographic Distribution:__    Choropleth map presenting the spatial distribution of protection incidents, vulnerability, or response activities, allowing for visual identification of hotspots or areas in need.

```
graveler::example_protection()
```

<img src="man/figures/empty.png" width="551"/>

##### Example 2: Response Monitoring


Typically the content of a Response Monitoring Dashboard allows to ensure that the right activities are done right. It would typically include: 

 1.  __Needs Assessment and Population:__  Population pyramid illustrating the demographic composition of the affected population (e.g., age, gender) including specific needs to inform targeted response planning.

 2.  __Resources Allocation:__ Heatmap representing the  allocation of resources (e.g., funding, personnel, supplies) by response activities, allowing for visual identification of areas with high or low response coverage.

 3.  __Key Performance Indicators (KPIs):__ Gauge chart indicating the achievement of predetermined targets or benchmarks for the response activities.

 4.  __Funding Management:__  Staked Bar chart comparing the planned versus actual resource allocations to identify discrepancies or gaps in resource management.

 5.  __Coordination and Partnership:__  Sankey diagram showing the collaboration and partnerships among different response organizations or clusters, measuring the frequency of coordination meetings or joint planning efforts

 6.  __Impact and Outcome:__  Bubble chart showcasing the correlation between response interventions and key outcomes or impact indicators (e.g., improved health indicators, increased access to education).

 7.  __Alert:__   Area chart providing real-time updates on key indicators, allowing for immediate identification of emerging trends or shifts in the humanitarian situation (for instance average assistance enrollment processing time).
 

```
graveler::example_response()
```

<img src="man/figures/empty.png" width="551"/>



## ... Register your dashboard!

On UNHCR Data Portal: [https://data.unhcr.org/en/dataviz](https://data.unhcr.org/en/dataviz)
