class: center, middle, inverse, title-slide .title[ # Indicator Calculation ] .subtitle[ ## {IndicatorCalc} ] .date[ ### Training Content as of 11 November 2023 ] --- # Intro * Standardized Indicator Calculations * Package Objectives * Potential Challenges * Setting up data transformation * Manual Review * Report Template * Companion App --- # Standardized Indicator Calculations * [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, based on international statistical standards and definitions. * The calculation of Standard Indicators is a key step in the analysis of Household survey dataset. * Indicators used to measure, inform and monitor progress towards global development objectives. They allow also to compare the situation of forcibly displaced people with the host 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. --- # Why the effort to turn a script into a function and then a package? * Enhanced __Modularity__: Functions allow you to break down a complex script into smaller, more manageable modules. Each function can represent a specific task or operation, making the code easier to understand and maintain. * Improved __Reusability__: By encapsulating specific functionalities within functions, you can reuse the same code across different parts of your script or even in other projects. This reduces redundancy and promotes a more efficient development process. * __Readability__: Functions provide a clear and structured way to organize your code. A well-defined function with a specific purpose makes the overall script more readable and understandable. * __Maintainability__: Debugging and maintaining code become more straightforward when functions are used. If an issue arises, you can focus on the specific function rather than navigating through a large and complex script. * __Parameterization__: Functions allow you to parameterize your code, enabling the customization of behavior based on input arguments. This enhances flexibility, as the same function can be used with different inputs to achieve varied results. * __Flexibility__: When a script is turned into functions, making updates or changes to specific functionalities becomes more manageable. You can modify a function without affecting the entire script, leading to a more agile development process. --- # Package Objectives * Designed to work based on dataset standard backup format exported from [kobotoolbox](http://http://kobo.unhcr.org) - that includes full variable name (group name + variable name) * Works with [UNHCR Internal Data Repository](http://ridl.unhcr.org) (RIDL) integration in mind, meaning indicators calculation is done after cleaning (not directly out of the data exported from kobotoolbox API) * Help to keep consistence between indicator calculations and standard xlsform content ??? The goal of `{IndicatorCalc}` is to ease the implementation of standard calculations for survey indicators related to Forcibly Displaced Population. Among the objectives is also to avoid duplication of documentation efforts around the information to include in the technical report and the information that is already expected to be gathered and recorded within [UNHCR Internal Data Repository](http://ridl.unhcr.org) which is following [Data Documentation Initiative](https://ddialliance.org/) standards. 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 --- # Potential Challenges * Standardized calculation to apply and can appear complex as sometime a single indicator might imply to compile more than 15 different variables * Checking that form contextualization did not break the requirement in terms of variable * Pipeline the work and streamline the process for indicator calculations * How to automate as much as possible so that a simple interface can be built to allow for indicator calculation without coding capacity... * Test indicator calculation before collecting data - by generating a dummy dataset based on the form structure ??? --- # Setting up data transformation * Use the form structure (xlsform) to map with the expected variables * Usage of matching algorithm to do the mapping - output a matching index * Provides always a second best match.. ??? Run the function var_mapping( "path/to/myxlsform.xlsx") in order to create your __variable mapping__. The variable mapping is designed to check if the expected variables and modalities are present in your dataset. --- # Manual Review * When you open the excel, filter for all match where the matching_index_best is different than 0 * If you can confirm the match, manually set it to 0 so that the matching can be confirmed. * If the matching is not the expected one you may take the second best match, and if correct, paste it and set the index to 0 * ??? Review manually the variable mapping and __recode data__ manually the variables where the automatic match could not be applied and upload it back --- # Report Template * Allows to use all the functions from the package within a streamline data pipeline * The report is configured through parameters (in the _yaml_) * Includes simple charts to display the indicator value together with some standard interpretation hint * Pull metadata already documented within RIDL to avoid re-entering it, brings in Indicator Visualisation and pull comparable SDG valuess ??? Then either generate a dummy dataset or connect your project with [RIDL](https://ridl.unhcr.org) __apply calculation__ to get you summary report and download your expanded XlsForm to include it within your [Kobocruncher automatic data exploration](https/rstudio.unhcr.org/kobcruncher) --- # Companion App * A companion App is a web-based user interface to help implementing a complex process * Created on the top of an existing packages - allows to use the package without coding or installing Rstudio * current prototype available here: [{IndicatorCalc}](http://rstudio.unhcr.org/IndicatorCalc)