The src/data directory in the tpr repo contains all of the data shown on the Transition Pathways Repository site.
Each JSON file in this directory contains one pathway definition, alongside optional *_timeseries.json files holding that pathway's data series.
The JSON files have a strict, specific format, defined by the JSON schema files in src/schema/.
The schema is split across several files: the pathway metadata schema itself, plus shared definitions under src/schema/common/ that it references (country codes, sector and technology names, publication details, and so on).
The schema defines a number of mandatory fields which must be included.
The structure, the data types, and in many cases the allowed values for a given key must all be correct for things to work as expected.
This repo has CI/CD set up to validate any new JSON added in a PR, so any new JSON added through a PR on main must pass before being merged.
After preparing a JSON file, validate it locally with:
npm run schema:checkThat checks every file under src/data and testdata/valid. You can preview a file as it will appear in the UI with npm run dev.
If you have changed a schema rather than a data file, run npm run schema instead — it validates and then regenerates the TypeScript types in src/types/. Those are checked in, and CI fails if they are out of date.
Every file declares its schema with its own $schema key: pathwayMetadata.v2.json for a pathway, pathwayTimeseries.v2.json for a timeseries file. These are the only two document schemas; the v1 formats are retired, and the site no longer publishes them under /schema/.
A file that names any other schema, including a v1 one or a shared fragment under src/schema/common/, or has no $schema at all, always fails npm run schema:check, locally and in CI, with no schema preloaded for $schema "…" (or … is a shared fragment, not a document schema, or missing or non-string "$schema") as an error annotation on the file. The site never loads such a file: it is not shown as invalid, it is simply missing from the app. When you run npm run dev, the browser console lists any such files.
That is stricter than an ordinary schema error, on purpose. In CI, VITE_INCLUDE_INVALID is true for every PR and push except those to production and next (#449), so a file that fails validation is only a warning there, and can still be previewed in the app. A file with the wrong $schema cannot be previewed at all, so it gets no such leniency.
The .v1 in the names under src/schema/common/ is the version of that shared definition, not of the document format — the v2 schemas use them.
A complete, valid example lives at testdata/valid/pathwayMetadata_v2_full.json, and a minimal one at pathwayMetadata_v2_minimal.json. Real pathways are in the publisher subdirectories here.
The sections below cover the fields that take the most care to author.
"geography": {
"global": true,
"regions": { "Southeast Asia": ["ID", "MY", "PH", "SG", "TH", "VN"] },
"country": { "CN": ["CN", "HK"], "JP": ["JP"] }
}- A country is anything the publication names as a single country. Its key is that country's ISO2 code, and it lists the codes the publication includes in it, the key among them. Usually that is just the key (
"JP": ["JP"]). When a publication counts territories with their country, list them too: IEA's China is"CN": ["CN", "HK"], NGFS GCAM's USA is"US": ["PR", "US", "VI"]. Membership follows the source, whatever it is. - A region is everything else, under the publication's own label, with two or more codes. A region label is never an assigned ISO2 code —
"China": ["CN", "HK"]is rejected, because China is a country. (JRC's"EU"is fine: EU is not an assigned code.) - A code belongs to at most one country, but may sit in any number of regions.
Everything else that names a geography — keyFeatures, dataAvailability and timeseries rows — uses these keys exactly: CN, never China. See #1071 for why.
Each of the 11 key features holds an array of entries, so a pathway can record different values for different parts of its coverage:
"keyFeatures": {
"emissionsTrajectory": [
{ "sector": "across sectors", "geography": "Global", "value": "Moderate decrease" },
{ "sector": "Power", "geography": "South East Asia", "value": "Significant decrease" }
]
}sectoris one of the sector names, or"across sectors"meaning "all of the sectors this pathway covers".geographyis"Global", one of the region labels used in this pathway's owngeography.regions, or one of its country codes (a key ofgeography.country, or a code inside one of its countries or regions).valueis one of that feature's allowed values, listed in the schema. ForpolicyTypesandnewTechnologiesIncluded,valueis an array of them.
Both sector and geography must be something the pathway actually declares, or one of the widest sentinels. A region label that does not appear in the pathway's own geography.regions is rejected, which is what catches a typo like "Southeast Asia" where the pathway says "South East Asia".
If a feature does not vary, give it one entry at the widest scope that applies — across sectors for a multi-sector pathway (otherwise its only sector), and Global for a global pathway (otherwise its region or country).
An empty array means nothing is recorded at any scope. That is different from an entry whose value is "No information", which is a deliberate statement that this scope has no data.
sectors[] entries take an optional segments list alongside technologies — which
parts of that sector's value chain the pathway covers:
"sectors": [
{
"name": "Power",
"technologies": ["Solar", "Wind", "Coal"],
"segments": ["Power generation", "Energy storage"]
}
]Optional on purpose: only Power, Steel and Aviation have segments defined, and leaving
it out means "not recorded" where [] would claim the pathway covers none of them.
The two widest-scope sentinels are spelled as the cookbook spells them:
across sectors and across regions.
pathwayDescription (required, may be null, max 2500 chars) is the pathway's
narrative description. What drives the pathway goes in the structured
coreDrivers object below, not in this text.
coreDrivers is an object with seven fields, all required but each allowed to be null. null means "not a core driver for this pathway", which is deliberately different from a driver that applies but has not been described.
"coreDrivers": {
"policies": "Carbon pricing across both covered sectors.",
"emissionsTargets": null,
"technologyCosts": null,
"investmentChange": null,
"macroeconomicDrivers": null,
"behavioralShifts": null,
"otherDrivers": null
}dependencies is an array — use [] if there are none. Each entry names a category, describes the dependency, scopes it to one of the pathway's sectors, and states how strong the evidence is:
"dependencies": [
{
"dependency_name": "Infrastructure and logistics",
"dependency_description": "Grid buildout must keep pace with renewable additions.",
"sector": "Power",
"evidence_type": "Quantitative"
}
]The allowed values for dependency_name and evidence_type are listed in the schema.
dataAvailability is optional — a pathway without it is still valid, and authoring is incremental. Once present it has two halves: overall, a prose summary (or null), and byMetric, one row per (metric, sector, sector segment, geography set).
"dataAvailability": {
"overall": "The full timeseries file covers Power at annual resolution from 2022 to 2050.",
"byMetric": [
{
"metricName": "Capacity",
"sector": "Power",
"sectorSegment": ["Fuel extraction and processing", "Power generation"],
"geography": ["Global", "South East Asia", "SG"],
"timeResolution": "1-year steps",
"dataFormat": "Tabular",
"granularity": ["Solar", "Wind", "Coal"],
"scopeLimitations": "Excludes off-grid generation."
}
]
}Four things to know before authoring:
Write a row for every allowable (sector, metric) pair, not only the ones with data. An uncovered pair is recorded as "Not covered", not omitted — an omitted row reads as "nobody has looked at this yet".
Unspecified and Not covered are different, and neither is null. Unspecified means the pathway covers this pair but does not state the value. Not covered means it does not cover the pair at all — so it applies to the whole row, and npm run schema:check rejects a row that mixes it with authored values. This is the same distinction keyFeatures draws with its explicit "No information".
geography, sectorSegment and granularity are all lists. Every geography member must be a region label or country the pathway declares in its own geography, and every segment must be one of its sector's — or one of the two sentinels, which must then be the list's only member. One metric can be projected at several levels at once, and cover more than one segment.
dataFormat describes the source publication only — Tabular, Text, Figure or Not covered. Whether this repo hosts a copy is not a judgement about the pathway; the app derives that from the timeseries index. Where values appear in more than one form, the most extractable wins: Tabular before Text before Figure.
metricName is a different list from the pathway's own metric field. The pathway-level metric is the five Power metrics that drive the search filter; the availability row key adds the ones a pathway reports but the tool does not plot — transmission lines, technology cost, investment requirement, asset lifetime — plus Steel's and Aviation's own metrics. Two cookbook variables, deliberately different. So a row may name a metric that is not in the pathway's metric list, which is exactly how an uncovered pair gets its Not covered row.
Allowed values live in src/schema/common/dataAvailability.v1.json (time resolution, data format, the non-technology granularity members), dataAvailabilityMetric.v1.json (the row key) and sectorSegment.v1.json, and follow cookbook tpr_cookbook_20260929.
A *_timeseries.json file holds the benchmark data series for one or more pathways (pathwayId is a list), validated by src/schema/pathwayTimeseries.v2.json. Each row in data is one value:
{
"year": 2030,
"geography": "Southeast Asia",
"sector": "power",
"sectorSegment": ["Power generation"],
"technology": "solar",
"metric": "capacity",
"value": 42.1,
"unit": "GW"
}sector, technology and metric use the camelCase keys from src/utils/timeseriesTaxonomy.ts, not display names.
geography is the publication's own label, exactly as the pathway's metadata declares it — Global (if the pathway sets geography.global), one of its geography.regions keys, or an ISO2 code it declares: a geography.country key, or a code inside one of its countries or regions. A country is always its code, so NGFS's China is CN even though it includes Hong Kong and Macao. So an IEA file says Southeast Asia and an ACE file ASEAN, even where both mean similar places. If the file serves several pathways, every one of them must declare the label.
sectorSegment lists the segments of the row's sector that the value covers, from the same vocabulary as dataAvailability (src/schema/common/sectorSegment.v1.json). Unlike there, the sentinels (Unspecified, Not covered, No information) are not allowed: a timeseries row is actual data, so it always covers a known part of the value chain.
npm run schema:check enforces both rules against the metadata files, since JSON Schema alone cannot look into another file.
Timeseries files come from RMI/tpr_benchmark_data_preparation, which writes one v2 JSON file per dataset. Bring them in with:
npx ts-node --esm scripts/import-benchmark-data.ts --in <prep-repo-output-dir> --dry-runDrop --dry-run to write. The importer converts nothing: every file must already pass the v2 schema and both rules above, and any error blocks the whole import, listing every problem. A file whose id matches an existing timeseries overwrites it in place; a new one is written next to its first pathway's metadata, and never onto a path another file already holds. Writes are all-or-nothing too: if one fails, the files already written are restored. Existing files missing from the input are reported and left alone. Then run npm run build:timeseries and npm run schema:check. The prep repo can run the same command with --dry-run to check its output against this repo before handing it over.
To create a new file in the appropriate format using R, the function below writes a nested <list> out as JSON.
It can be copy-pasted to your R console and requires the jsonlite package.
write_json <- function(json_obj, file) {
jsonlite::write_json(
x = json_obj,
path = file,
auto_unbox = TRUE,
pretty = TRUE,
null = "null"
)
}Note on validating from R: the schema is split across several files that reference each other by URL, and the usual jsonvalidate::json_validate() call takes a single schema and will not fetch those references. Write the file first, then validate it with npm run schema:check, which resolves them correctly and also runs the checks that JSON Schema alone cannot express — such as confirming each sector and geography is one the pathway declares.
Once the function above is loaded, a new pathway can be created and written out like so.
# Single-element vectors must be wrapped with I(), the identity function, so that
# `jsonlite` writes them as arrays rather than as bare values (everything is a
# vector in R). Fields that must be `null` rather than absent use NA... see below.
scoped <- function(value) {
list(list(sector = "Power", geography = "VN", value = value))
}
new_pathway_metadata <-
list(
`$schema` = "http://pathways.rmi.org/schema/pathwayMetadata.v2.json",
id = "R-import-example",
name = list(full = "R Import Pathway", short = "R Example"),
description = "Pathway imported from R.", # must end in a period
publication = list(
title = list(full = "Example Publication"),
publisher = list(full = "TransitionZero"),
year = 2021,
links = list(
list(description = "Report", url = "https://www.example.com/")
)
),
pathwayType = "Normative",
modelYearEnd = 2050,
modelTempIncrease = 1.5,
geography = list(
regions = list(`South East Asia` = I(c("VN", "TH"))),
country = list(VN = I(c("VN")))
),
sectors = list(
list(name = "Power", technologies = I(c("Coal", "Wind")))
),
pathwayDescription = "A short narrative description of the pathway.",
metric = I(c("Capacity")),
keyFeatures = list(
emissionsTrajectory = scoped("Moderate decrease"),
energyEfficiency = scoped("Moderate improvement"),
energyDemand = scoped("Minor increase"),
electrification = scoped("Significant increase"),
policyTypes = scoped(I(c("Carbon price"))),
technologyCostTrend = scoped("Decrease"),
emissionsScope = scoped("CO2"),
policyAmbition = scoped("Current/legislated policies"),
technologyCostsDetail = scoped("Total costs"),
newTechnologiesIncluded = scoped(I(c("Battery storage"))),
investmentNeeds = scoped("By sector")
),
coreDrivers = list(
policies = NULL, emissionsTargets = NULL, technologyCosts = NULL,
investmentChange = NULL, macroeconomicDrivers = NULL,
behavioralShifts = NULL, otherDrivers = NULL
),
dependencies = list(
list(
dependency_name = "Technology",
dependency_description = "Grid capacity must expand.",
sector = "Power",
evidence_type = "Qualitative"
)
)
)
write_json(new_pathway_metadata, "src/data/example-publisher/EXAMPLE-2021.json")One R-specific note: jsonlite writes an R NULL as {} by default, which the schema rejects. That is why write_json above passes null = "null" — with it, the seven NULL entries in coreDrivers come out as JSON null as intended. All seven keys are required even when every one of them is null, so keep them all.
The example above has been run as written, and the file it produces passes npm run schema:check.
This README should be the definitive source of information about these JSON files and how to add them or modify them.
As this repo is currently under heavy development, such details may change rapidly, and this README should be kept up to date with those changes as they happen.
If you're developing in this repo, please remember to make appropriate changes to this README when relevant changes are made to the underlying code.
If you're maintaining/modifying/adding the pathway data, please refer to the live version of this README on main for the most up-to-date details.