A data visualisation dashboard for the TEAM project - Kenya instance
In order to update the configuration of the site or the data displayed, follow this process:
- Create a new branch based on
main
- Make changes and commit them to the new branch. When changing config/data, follow the specification described in the sections below.
- Create a GitHub Pull Request to merge the new branch into
main
. Review the changes to make sure the new config / data follow the specification. - Merge the PR into
main
- this will trigger the preparation of the updated data and releasing of the update site
The data displayed in the tool is configured by modifying files in the data-processing/data-input
folder.
The following contents are required:
data-processing/data-input
:
/manual
- files that are not extracted from the TEAM database but are manually preparedconfig.json
- a JSON file containing a simple object with the following fields:minYear
- the first year for which data will be displayedmaxYear
- the last year for which data will be displayedsnapshotYears
- an array of snapshot years shown on scenario comparison charts
Scenarios.csv
- metadata for scenarios. A CSV file with following columns:ScenarioID
- a numeric ID of the scenarioScenarioAB
- an alphanumeric short code for the scenario. Used in URLs. The values need to match folder names inextract/scenarios
folder.ScenarioNA
- a human-readable name for the scenario - shown as labels for charts / as options in dropdownsDescription
- a longer description for the scenario - shown in the scenario selection sidebar
Emission.csv
- metadata for emissions. A CSV with following columns:EmissionID
- numeric ID for emissionsGreenhouseGasFlag
- 0/1 flag - should this emission be included in the Greenhouse Gases tab?AirPollutantFlag
- 0/1 flag - should this emission be included in the Air Pollutants tab? Based on this flag, an additional dimension -APEmission
- is created from theEmission
dimensionGWP
- Global Warming Potential factor - used for multiplying the emission values of different substances to get the CO2 equivalent values
HybridID.csv
- lookup CSV for Hybrid attribute of vehicle technology (HybridID
,HybridNA
) ->Tech.Hybrid
SecondHandImportID.csv
- lookup CSV for SecondHandImport attribute of vehicle technology (SecondHandImportID
,SecondHandImportNA
) ->Tech.SecondHandImport
/extract
- files extracted directly from the TEAM database/dimensions
- lookup tables for vehicle technologies and other variables used in the systemEmissionID.csv
(EmissionID
,EmissionAB
,EmissionNA
) ->Emission
EmissionType.csv
(ETypeID
,ETypeNA
) ->EType
EngineID.csv
(EngineID
,EngineAB
,EngineNA
) ->Tech.Engine
FuelID.csv
(FuelID
,FuelAB
,FuelNA
) ->Tech.Fuel
JSTypeID.csv
(JSTypeID
,JSTypeNA
) ->JSType
MassCatID.csv
(MassCatID
,MassCatNA
) ->Tech.MassCat
MS_modes.csv
(modeID
,modeName
) ->MSMode
Technology.csv
- represents technologies where a single technology is a combination ofEngineID
,FuelID
,HybridID
,MassCatID
,SecondHandImportID
,TransTypeID
, andVehTypeID
TransTypeID.csv
(TransTypeID
,TransTypeAB
,TransTypeNA
) ->Tech.TransType
Trip_lengths.csv
(triplenID
,triplenName
) ->TripLen
VehCatID.csv
(VehCatID
,VehCatNA
) ->VehCat
VehTypeID.csv
(VehTypeID
,VehTypeAB
,VehTypeNA
) ->Tech.VehType
/scenarios
- the subdirectory names should match theScenarioAB
values from/manual/Scenarios.csv
/[ScenarioAB]
- data for a single scenario. Note that even if the data tables contain aScenarioID
column, this column will be ignored because of how the data is currently stored in the TEAM database (data for separate scenarios is stored in separate database instances so each table will haveScenarioID
value of 0). The column will be replaced by the appropriate ID taken from themanual/Scenarios.csv
table based on the scenario folder name.ED.xlsx
ET.xlsx
Interface_VSM_NumVeh.xlsx
Interface_VSM_VehKM.xlsx
Mode_Shares_TripLength.xlsx
The configuration of the dashboard website is stored in the public
folder:
/public
:/config
config.json
- same asconfig.json
in the data inputsmanual
directory, but currently needs to be updated separately to keep both files in sync.data-tabs.json
- see Data tabs configdata-sources.json
- see Data sources configdimensions-meta.json
- see Dimensions configlogos.json
- an array of logos. Each object has the following fields:img
- URL of image file (relative to thepublic
directory)tooltip
- text that displays in the hover tooltiplink
- URL that will be opened (in a new tab) upon clicking the logoheight
- height of the logo in pixels. Width is automatic to maintain aspect ratio.
/data
- placeholder directory for preprocessed data files. The output from the data pipeline is placed here automatically before the website is released./images
- images used in the site. Mostly logos./text
- markdown files for the text content of the websiteAboutPage.md
- markdown formatted text of the About pageAboutSidebar.md
- markdown formatted text of the About section of the sidebar
favicon.ico
- an icon displayed in browser tabs/bookmarks.
The data-tabs.json
is a JSON file configuring the views/tabs in the website.
The file contains an array of objects with the following properties:
slug
- URL-friendly text ID of the tablabel
- title of the tabcontent
- object describing the data/chart content of the tab:variable
- configuration for the data variable shown in the charts:name
- name of the variable, matching one indata-sources.json
parameters
- array of dimensions that serve as parameters for the variable
primarySelect
- a single dimension path for the primary select UI. Can benull
if there should be no primary selectsecondarySelect
- an array of dimension paths for the secondary select UI components. Can be an empty array if no secondary select should be shown.operations
(optional) - a dictionary of hard-coded data operations for this tab. Keys are dimension paths. Values are objects with the following properties:aggregate
- true/false, should the data be aggregated or disaggregated by the dimension?filter
- array of values to filter the dimension. Set tonull
if there should be no filtering.
defaultChart
- object for configuring the default chart for the view.type
- name of the default chartoptions
- object of options specific to the chart type Note that right now there's only one chart type:time-series
, and the available options istotalLine
(true/false, optional)
The data-sources.json
is a JSON file configuring the data variables viewable on the website.
The file contains a dictionary of objects. Keys are variable names. Values are objects with the following properties:
pathSchema
- defines what CSV file should be fetched based on the variable and the parameter values. This needs to match the names of files output by the data pipeline.title
- the title of the variable / chart. Contains a special syntax where a dimension name wrapped in curly braces (e.g.{VehCat}
) will result in a dropdown for the specified parameter (in this case,VehCat
) being inserted into the chart title.yAxisTitle
- label displayed by the chart's Y axisnumberFractionalDigits
- how many fractional digits should be shown when formatting the hovered valueyAxisFractionalDigits
(optional) - same asnumberFractionalDigits
but for formatting Y axis tick labels. If not present,numberFractionalDigits
is used.numberDivisor
(optional) - number to divide values by. Useful if figures are very high and we want to display them likeX millions
. Needs to be used together withnumberDivisorText
.numberDivisorText
(optional) - a text description fornumberDivisor
. For example if that option is set to1000000
, this option could be set tomln
The dimensions-meta.json
is a JSON file configuring the dimensions / categorical variables present in the dashboard.
The file contains a dictionary of objects. Keys are dimension names. Values are objects with the following properties:
Name
- human-readable name for the variable to be displayed in the dashboardIsLeaf
- true/false, is this a leaf dimension or is it used to link many dimensions together. Currently the only dimension withIsLeaf
set tofalse
isTech
Colors
(optional) - a mapping of dimension values to colors. The keys are expected to be the values of theAB
field, and if the dimensions doesn't have theAB
field thenID
. The values are colors in a hexadecimal (HEX) format. This dictionary needs to be present for a dimension in order for the tool to allow coloring charts by the that dimension.