alterlab-datacommons
Data Commons Client
Overview
Data Commons aggregates data from census bureaus, health organizations, environmental agencies, and other authoritative sources into a unified knowledge graph. This skill answers statistical questions from it without an API key: scripts/query_datacommons.py reads observations from the JSON API that the datacommons.org website itself uses, and resolves names and Wikidata IDs through the keyless v2 resolve endpoint. The documented Python client (datacommons-client, below) is the optional keyed path — its observation and node methods return HTTP 401 without DC_API_KEY.
The keyed client is verified against datacommons-client 2.1.6 (current as of 2026-09; Python ≥ 3.10). This is the V2 client (package datacommons_client), not the legacy datacommons (V1) package — the two have different APIs; do not mix them. Keyword names matter: the place-hierarchy helpers take place_dcids, fetch_entity_names takes entity_dcids, and fetch_property_values takes properties — passing node_dcids to them raises TypeError.
When to Use This Skill
- Pulling population, economic, health, education, or environmental statistics for places (countries, states, counties, cities)
- Building cross-place or time-series comparisons from harmonized public sources (census, BLS, WHO, World Bank, EPA, …)
- Resolving place names, coordinates, or Wikidata IDs to Data Commons DCIDs
- Exploring the Data Commons knowledge graph (place hierarchies, properties, statistical-variable definitions)