This repository aims to provide a framework for computing social sector indicators in a clean, organized and repeatable manner.
To start contributing, first clone this repository. Then, we primarily work with two branches: 1) main
and 2) development
.
The development
branch is the most current one. When contributing, pull from this branch and create a new personal branch for the specific task you are working on. For instance, if you are reviewing geographical disaggregations, create a branch named "geographic_dis_scl".
Work on the assigned tasks, commit and push the changes to the development
branch. Make a pull request so that another team member can review it and accept it as the new version of development
.
To calculate indicators, create the folder Outputs and then there are two ways to calculate indicators depending on the amount of countries and years required:
-
Specific country, source of information and year: Open the
runningScript.R
, and modify the variables pais, year, type and geoLevel after which execute the coderunningScript.R
.- pais: To specify this use the ISO Alpha-3 code for the specific country (e.g. SLV for El Salvador).
- year: Specify as a string the required year for the indicator
- tipo: Specify one of the two:"censos" or "encuestas" as strings depending if census or surveys are required.
- geoLevel1: For census, specify if the indicators to calculate will be disagregated at a country level or first geographical disagreggation.
-
Loop through different countries and years: Open the
runningScript.R
and define the variable tipo with "encuestas" or "censos" depending on the data source type required. Then execute the coderunningScript_loop.R
and indicators will be calculated based on all the census or surveys available according to theInputs/running_survey.csv
orInputs/running_census.csv
files.
This repository consists of three main parts.
-
Intermediate Variables: One script per division, each containing all necessary variables for computing the indicators of the corresponding division (
var_EDU.R
,var_GDI.R
,var_LMK.R
andvar_SOC.R
) -
Indicator Definitions (
idef.csv
): This file controls the computation of indicators. It contains the definition of each indicator. -
Running Scripts:
runningScript.R
runs the function inscl_indicators.R
.runningScript_loop.R
runsscl_indicators.R
for a batch of countries -
Functions: These scripts stablish the functions required to calculate indicators.
functions.R
: contains the functions to calculate indicators for ratios (scl_pct), means (scl_mean) and gini (scl_gini). As well as a function to execute all indicators inidef.csv
(calculate_indicators) and a function to delimit the disagregations to execute (evaluatingFilter).directory_periods.R
: This scrips based on the type of data source survey (encuesta) or census(censos) defined in variable tipo returns the appropiate harmonized.
-
Inputs folder This folder includes important supporting documents such as excels showing the data available (Planeación - Armonización de Encuestas de Hogares.xlsx, Planeación - Population and Housing Censuses.xlsx, running_census.csv and running_survey.csv), dictionary of variable for both census and surveys (D.1.1.4 Diccionario microdatos encuestas de hogares.xlsx and D.7.1.3 Diccionario variables censos.xlsx) and identification files (idef.csv and idefCensos.csv) defining the indicators to calculate.
-
Fork the repository to your GitHub account.
-
Clone the forked repository to your local machine.
-
Create a new branch for your tasks.
-
Make your changes and commit them to your branch.
-
Push the branch to your GitHub repository.
-
From the GitHub page of your forked repository, open a pull request to the
development
branch of the main repository.