Validate Warconomy data before you rely on it. The dataset and each record type have a conservative draft-07 JSON Schema; provenance, the graph, and the diffs have simple structural invariants you can assert in a few lines. The steps below show exactly what to check for each export. Everything is static — there is no validation API; run these checks against the prerendered files.
- 6 validation steps covering data.json, provenance, graph, schemas, distributions, and diffs.
- Validate against the JSON Schemas and the TypeScript types — no service needed.
- Machine-readable at /developers/validation/data.json.
Validate data.json
Validate the top-level export against schema.json (draft-07). Required: version, dataset, observations, sources, facts, series, distributions. Additional properties are allowed (additive contract).
// any draft-07 validator (e.g. ajv)
const schema = await (await fetch("https://warconomy.com/datasets/conflict-economic-impact/schema.json")).json();
const data = await (await fetch("https://warconomy.com/datasets/conflict-economic-impact/data.json")).json();
// validate(data) against schema; new fields will not fail it.Validate provenance
Every provenance record must resolve to a real source. Check that each record.sourceId exists in data.json sources and that summary.recordsWithoutSource === 0.
const prov = await (await fetch("https://warconomy.com/datasets/conflict-economic-impact/provenance.json")).json();
console.assert(prov.summary.recordsWithoutSource === 0);
const ids = new Set((await (await fetch("https://warconomy.com/datasets/conflict-economic-impact/data.json")).json()).sources.map(s => s.id));
console.assert(prov.records.every(r => ids.has(r.sourceId)));Validate the citation graph
Every edge endpoint must be an existing node id (no dangling edges), and summary counts must match the arrays.
const g = await (await fetch("https://warconomy.com/datasets/conflict-economic-impact/graph.json")).json();
const ids = new Set(g.nodes.map(n => n.id));
console.assert(g.edges.every(e => ids.has(e.from) && ids.has(e.to)));
console.assert(g.summary.nodeCount === g.nodes.length);Validate against the record schemas
Use the per-record schemas (observation/source/series/graph/diff). They pin required fields and allow extras. A real record must satisfy its schema's required[].
const obsSchema = await (await fetch("https://warconomy.com/datasets/conflict-economic-impact/observation.schema.json")).json();
const { observations } = await (await fetch("https://warconomy.com/datasets/conflict-economic-impact/data.json")).json();
console.assert(observations.every(o => obsSchema.required.every(f => o[f] !== undefined)));Validate CSV / JSONL distributions
CSV is RFC-4180 with a header row; JSONL is one JSON object per line. Row counts should match the dataset arrays.
curl -s https://warconomy.com/datasets/conflict-economic-impact/observations.csv | head -n 1 # header row
curl -s https://warconomy.com/datasets/conflict-economic-impact/observations.jsonl | wc -l # one object per observationValidate version & provenance diffs
diff.json is value-level when valueLevel is true; record-diffs.json carries scalar before/after for changed records; provenance-diff.json reports added/removed/changed provenance ids. All are honest about availability.
const diff = await (await fetch("https://warconomy.com/datasets/conflict-economic-impact/versions/1.187.0/diff.json")).json();
const recs = await (await fetch("https://warconomy.com/datasets/conflict-economic-impact/versions/1.187.0/record-diffs.json")).json();
console.assert(typeof diff.valueLevel === "boolean");
console.assert(recs.changedRecordCount === recs.records.length);See the TypeScript types, the contract fixtures, the data dictionary, and the schema report. Machine-readable: validation/data.json.