@varve/agency-sdks

Graph Metadata

Normalize World Bank indicator observations into indicator, country, period, and observation records.

World Bank observations naturally form an indicator -> country -> period graph.

const graph = await client.getIndicatorGraphMetadata('SP.POP.TOTL', ['USA', 'CAN'], {
  date: '2020:2024',
});
 
console.log(graph.indicator);
console.log(graph.countries);
console.log(graph.periods);
console.log(graph.observations);

Graph shape

(:Indicator {id})-[:OBSERVED_IN]->(:Country {id})
(:Observation {period, value})-[:FOR_INDICATOR]->(:Indicator {id})
(:Observation {period, value})-[:FOR_COUNTRY]->(:Country {id})

This helper is useful when you need a cited, reproducible slice of World Bank data for search, lineage, or natural-language query systems.

Practical example

const indicators = ['SP.POP.TOTL', 'NY.GDP.MKTP.CD'];
const countries = ['USA', 'CAN'];
 
for (const indicator of indicators) {
  const graph = await client.getIndicatorGraphMetadata(indicator, countries, {
    date: '2020:2024',
  });
 
  console.log(indicator, graph.observations.length);
}

On this page