This repository contains code to automate the creation of infographic posters for DIME team's scorecard evaluation in Burkina Faso.
Data for the infographic indicators were collected via interviews with key informants in the municipalities, schools, and district sanitation offices. Responses were recorded using SurveyCTO. The raw survey exports are copied, by year, to the data/raw
folder. Exports must include the following csv
files files (shown for the 2014/2015 year below):
- [
CEB 2014_WIDE.csv
](data/raw/2014/CEB 2014_WIDE.csv) - [
Directeur Ecole 2014_WIDE.csv
](data/raw/2014/Directeur Ecole 2014_WIDE.csv) - [
Directeur Formation Sanitaire 2014_WIDE.csv
](data/raw/2014/Directeur Formation Sanitaire 2014_WIDE.csv) - [
District Sanitaire 2014_WIDE.csv
](data/raw/2014/District Sanitaire 2014_WIDE.csv) - [
Municipalite 2014_WIDE.csv
](data/raw/2014/Municipalite 2014_WIDE.csv)
In addition, data about the availability of potable water is derived from government sources. This is normally in the form of an Excel spreadsheet, but, for the purposes of this project, it should be converted to a csv
file and copied, by year, to the data/raw
folder (example from 2014/2015 below):
- [
Access Potable Water 2014.csv
](data/raw/2014/Access Potable Water 2014.csv)
We use Stata 13 MP to clean the data, calculate the indicators, and create JSON-formatted text files describing the layout of the posters. The latter are then read by a short Java script that uses the Processing Development Environment to build the infographic images.
Below are brief descriptions of each of the Stata do-files. We've made liberal use of comments throughout the do-files to explain the program structure/flow.
00_master.do
: this is the master do-file, it sets project globals and runs all component Stata files.01_clean.do
: this file cleans and merges the raw survey data and outputs it asmerged.dta
in thedata/dta
folder.02_calculate_scores.do
: this file calculates the indicators values for the infographic posters and outputsposter1.dta
andposter2.dta
to thedata/dta
folder.03_create_JSON.do
: this file converts the indicator data sets to JSON-formatted text, outputtingposter1.json
andposter2.json
to thedata/json
folder.
The poster1.pde
and poster2.pde
sketchbook files process the JSON files exported by Stata and create the infographic poster PDFs stored in poster1/pdf
and poster2/pdf
.
- Clone the repository to your local directory.
- Download and install the Processing Development Environment.
- Open and run
00_master.do
. This will run all other do-files and process the raw data and createposter1.json
andposter2.json
. - If you are using Stata 13 you will need to open the json files at this point (
poster1.json
andposter2.json
) and replace the characterÉ
with the characterÉ
and save both with UTF-8 encoding (Stata 14 supports Unicode). - Open and run
poster1.pde
. This will create the infographic posters for poster design #1. - Open and run
poster2.pde
. This will create the infographic posters for poster design #2.
- Create new folders for year
X
in thedata/raw
folder and add all the raw data source files for yearX
(see above). - Open
00_master.do
. Update theyear
global macro toX
; update thenational_average
global to the average rate of admission to the CEP for yearX
; and indicate whether the raw data was exported with group names using thegroupnames
global. Then run. - If there are duplicate observations they will be written to
duplicates_FILENAME.csv
in thedata/etc
folder. You can mark which to keep (e.g. the most recent submission) in thereplacements_FILENAME.csv
file. You will need to re-run00_master.do
. - If there have been any changes in the names of variables you can update them in either the
01_clean.do
file or the02_calculate_scores.do
. - If you are using Stata 13 you will need to open the json files at this point (
poster1.json
andposter2.json
) and replace the characterÉ
with the characterÉ
and save both with UTF-8 encoding (Stata 14 supports Unicode by default). - Open
poster1.pde
. Update the year variable toX
and run. This will create the infographic posters for poster design #1. - Open
poster2.pde
. Update the year variable toX
and run. This will create the infographic posters for poster design #2.