Skip to content

Commit

Permalink
rev add dummy data function
Browse files Browse the repository at this point in the history
  • Loading branch information
Edouard-Legoupil committed Oct 13, 2023
1 parent a74fdeb commit 8332200
Show file tree
Hide file tree
Showing 4 changed files with 785 additions and 26 deletions.
19 changes: 14 additions & 5 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,23 @@ knitr::opts_chunk$set(
<!-- badges: start -->
<!-- badges: end -->

The goal of {IndicatorCalc} is to ease the implementation of standard calculation for survey indicators related to Forcibly Displaced Population.
There is broad consensus around the key indicators used to measure, inform and monitor progress towards global development objectives, as exemplified by the Sustainable Development Goals and related efforts of the MICS, DHS, IHSN, together with national governments. UNHCR's objectives are largely aligned with these frameworks. [UNHCR Results Monitoring Surveys (RMS)](https://intranet.unhcr.org/en/support-services/common-good-data-initiatives/household-surveys/Results-Monitoring-Surveys.html) are household-level surveys with standard questionnaires following context-appropriate methodological approaches. They can be implemented across UNHCR operations to monitor changes in the lives of all relevant groups of persons of concern (impacts) and in UNHCR's key areas of engagement (outcomes). RMS help us to calculate impact and outcome indicators in a standardized way to have a global understanding of the results. Both indicators and questionnaire is also largely aligned with MICS, DHS, IHSN, national household surveys and other UNHCR standardized surveys.

The package is designed to work based on dataset standard backup format exported from [kobotoolbox](http://http://kobo.unhcr.org) within [UNHCR internal data repository](http://ridl.unhcr.org). It is adapted from the initial [RMS indicator script](https://github.com/bozdagilgi/UNHCR-RMS-Indicators)
The goal of {IndicatorCalc} is to ease the implementation of standard calculations for survey indicators related to Forcibly Displaced Population.

Each calculation is implemented as a function with in-built check to identify whether the expected variables and modalities are within the dataset and a `mapper` to transform the data in the expected format if needs be. You can check each [function reference](/reference/index.html) to see in details all documented calculations
The package is designed to work based on dataset standard backup format exported from [kobotoolbox](http://http://kobo.unhcr.org) within [UNHCR internal data repository](http://ridl.unhcr.org). It is adapted from the initial [indicator script](https://github.com/bozdagilgi/UNHCR-RMS-Indicators) version.

Each calculation is implemented as a function with in-built check to identify whether the expected variables and modalities are within the dataset and a `mapper` to transform the data in the expected format in case of divergence of data structure between what was collected and what is expected. You can check each [function reference](/reference/index.html) to see in details all documented calculations




*Population* refers to survey population in this guidance for the calculation of indicators as shown by enumerator and denominator.
*Denominators* that are representing the households will be obtained by weighting the number of households by the number of household members at the end of the analysis. If there are no weights used it will be used as 'weight' variable for household level indicators.

## Usage

The easiest way to use the package is through the [shiny interface](http://rstudio.unhcr.org/IndicatorCalc) and then follow the instruction from there
The easiest way to use the package is through the [shiny interface](http://rstudio.unhcr.org/IndicatorCalc) and then follow the instruction from there.


## Developpers
Expand All @@ -41,7 +49,8 @@ devtools::install_github("unhcr-americas/IndicatorCalc")

The package development roadmap includes:

- a wrapper to chain all single calculations
- a dummy data generator
- an SDG comparison plot..
- a report template to output a quick exploration of all indicators results
- a shiny app to provide access to the package online with Rstudio connect (versus offline rstudio)

Expand Down
43 changes: 35 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,53 @@
<!-- badges: start -->
<!-- badges: end -->

There is broad consensus around the key indicators used to measure,
inform and monitor progress towards global development objectives, as
exemplified by the Sustainable Development Goals and related efforts of
the MICS, DHS, IHSN, together with national governments. UNHCR’s
objectives are largely aligned with these frameworks. [UNHCR Results
Monitoring Surveys
(RMS)](https://intranet.unhcr.org/en/support-services/common-good-data-initiatives/household-surveys/Results-Monitoring-Surveys.html)
are household-level surveys with standard questionnaires following
context-appropriate methodological approaches. They can be implemented
across UNHCR operations to monitor changes in the lives of all relevant
groups of persons of concern (impacts) and in UNHCR’s key areas of
engagement (outcomes). RMS help us to calculate impact and outcome
indicators in a standardized way to have a global understanding of the
results. Both indicators and questionnaire is also largely aligned with
MICS, DHS, IHSN, national household surveys and other UNHCR standardized
surveys.

The goal of {IndicatorCalc} is to ease the implementation of standard
calculation for survey indicators related to Forcibly Displaced
calculations for survey indicators related to Forcibly Displaced
Population.

The package is designed to work based on dataset standard backup format
exported from [kobotoolbox](http://http://kobo.unhcr.org) within [UNHCR
internal data repository](http://ridl.unhcr.org). It is adapted from the
initial [RMS indicator
script](https://github.com/bozdagilgi/UNHCR-RMS-Indicators)
initial [indicator
script](https://github.com/bozdagilgi/UNHCR-RMS-Indicators) version.

Each calculation is implemented as a function with in-built check to
identify whether the expected variables and modalities are within the
dataset and a `mapper` to transform the data in the expected format if
needs be. You can check each [function reference](/reference/index.html)
to see in details all documented calculations
dataset and a `mapper` to transform the data in the expected format in
case of divergence of data structure between what was collected and what
is expected. You can check each [function
reference](/reference/index.html) to see in details all documented
calculations

*Population* refers to survey population in this guidance for the
calculation of indicators as shown by enumerator and denominator.
*Denominators* that are representing the households will be obtained by
weighting the number of households by the number of household members at
the end of the analysis. If there are no weights used it will be used as
‘weight’ variable for household level indicators.

## Usage

The easiest way to use the package is through the [shiny
interface](http://rstudio.unhcr.org/IndicatorCalc) and then follow the
instruction from there
instruction from there.

## Developpers

Expand All @@ -40,7 +66,8 @@ devtools::install_github("unhcr-americas/IndicatorCalc")

The package development roadmap includes:

- a wrapper to chain all single calculations
- a dummy data generator
- an SDG comparison plot..
- a report template to output a quick exploration of all indicators
results
- a shiny app to provide access to the package online with Rstudio
Expand Down
42 changes: 29 additions & 13 deletions dev/indicators.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@ library(testthat)
pkgload::load_all(export_all = FALSE)
```

Indicator functions are designed to work based on data stored as a list - which is
the default structure for a complex hierarchical survey dataset with nested tables

The default export format from kobotoolbox includes variables names generated as a concatenation of groups and names.

The indicators calculation are based on specific patterns to be identified within
the variable names. This allow to handle cases where variables and questions would
have been shifted within the sequence of the questionnaire and through different
questions groups.

The indicator functions also check that the data content is the one expected.
A check log is written to keep track of all issues



# Data Wrangling

Each indicator calculation is based on predefined frame, variable name and variable value.
Expand Down Expand Up @@ -1478,22 +1493,23 @@ datalist <- kobocruncher::kobo_data( system.file("test.xlsx",
## mpper
mapper <- list(
hierarchy = "main",
hierarchy = "ind",
variablemap = data.frame(
label = c(
"In general, when anyone in your household is sick,
where do they go to seek care?",
"How long does it take to go there when you use the mode of transport
that you mentioned above?"),
variable = c("HEA01",
"HEA03"),
mappattern = c("HEA01",
"HEA03") ),
"In the past 3 months, did ${name_individual} need to see a health professional for any reason?",
"In the past 3 months, did you receive medical care when needed for the reason above?",
"Why have you been unable to access a medical care in the past 3 months?"),
variable = c("HACC01",
"HACC03",
"HACC04"),
mappattern = c("HACC01",
"HACC03",
"HACC04") ),
modalitymap = data.frame(
variable = c( "HEA01", "HEA01" ),
label = c( "Other, specify", "Don't know"),
standard = c("96", "98" ),
map = c("96", "98" )))
variable = c( "HACC01", "HACC03" ),
label = c( "yes", "yes"),
standard = c( "1","1" ),
map = c("1","1" )))
## Apply indicator function on datalist
datalist <- impact2_3(datalist, mapper )
Expand Down
Loading

0 comments on commit 8332200

Please sign in to comment.