API Access
Access dataset files directly from scripts, code, or AI agents.
Browse dataset files
API Access
Access dataset files directly from scripts, code, or AI agents.
Each file has a stable URL (r-link) that you can use directly in scripts, apps, or AI agents. These URLs are permanent and safe to hardcode.
Start with these files — they give you everything you need to understand and access the dataset.
- 1. Fetch datapackage.json to inspect schema and resources
- 2. Download data resources listed in datapackage.json
- 3. Read README.md for full context
Data Views
US Primary Energy Consumption (1635–2000)
US Energy by Fuel Source (1850–1945)
Data Files
Explore with AIUS Primary Energy Consumption 1635–2000
| Field | Type | Description |
|---|---|---|
| year | integer | Year of observation |
| total_quad_btu | number | Total primary energy consumption in quadrillion British thermal units (quad Btu). Includes all sources: coal, petroleum, natural gas, nuclear, hydroelectric, biomass, and other renewables. |
| notes | string | Data notes. 'selected year' indicates the pre-1949 series where only specific benchmark years are available. |
Download
Download CSVAbout
- Total US primary energy consumption by year, 1635–2000. Pre-1949 data covers selected years at irregular intervals (decennial 1635–1845, quinquennial 1850–1945). Annual data from 1949. Gap exists for 1946–1948 (bridging period between historical and modern EIA series). Values in quadrillion Btu (1 quad = 10^15 Btu = 1.055 exajoules).
- Last updated
- 17 March 2026
- Total rows
- ...
- Format
- CSV
- File size
- 1.79 kB
- Sources
- US Energy Information Administration: Estimated Primary Energy Consumption in the United States, Selected Years, 1635–1945 (Quadrillion Btu)
- US Energy Information Administration: Primary Energy Overview, 1949–2011 (Quadrillion Btu)
- US Energy Information Administration: Monthly Energy Review — Primary Energy
US Primary Energy Consumption by Source 1850–1945
| Field | Type | Description |
|---|---|---|
| year | integer | Year of observation (selected years, at 5-year intervals) |
| coal_quad_btu | number | Coal consumption in quadrillion Btu |
| natural_gas_quad_btu | number | Natural gas consumption in quadrillion Btu |
| petroleum_quad_btu | number | Petroleum consumption in quadrillion Btu |
| hydro_quad_btu | number | Hydroelectric power in quadrillion Btu |
| biomass_quad_btu | number | Wood and biomass consumption in quadrillion Btu (pre-1949 series covers fuelwood only) |
| total_quad_btu | number | Total primary energy consumption in quadrillion Btu |
Download
Download CSVAbout
- Breakdown of US primary energy consumption by fuel source for selected years 1850–1945. Shows the transition from wood and water power to coal, petroleum, and natural gas. Values in quadrillion Btu.
- Last updated
- 17 March 2026
- Total rows
- ...
- Format
- CSV
- File size
- 900 B
- Sources
- US Energy Information Administration: Estimated Primary Energy Consumption in the United States, Selected Years, 1635–1945 (Quadrillion Btu)
- US Energy Information Administration: Primary Energy Overview, 1949–2011 (Quadrillion Btu)
- US Energy Information Administration: Monthly Energy Review — Primary Energy
About this dataset
DataPressr — AI Agent Instructions
You are helping wrangle raw data finds into clean, publishable datasets on DataHub.
Concepts
Data hierarchy
- Catalog — a collection of datasets. Maps to one GitHub repo + one DataHub publication. Example: "World Bank Open Data", "Our World in Data".
- Dataset — a coherent data concept with defined schema and coverage. One directory, one
datapackage.json. Example: "World GDP 1960–2024". - Data file — a concrete file artifact (csv, json, parquet…). Listed as a resource in
datapackage.json.
Catalog-as-repo rule: if the source is a portal or collection containing many datasets, give it its own repo and DataHub publication — not a subfolder inside another dataset.
Dataset lifecycle
A dataset doesn't need to be complete to be published. Lifecycle stages:
| Stage | Description |
|---|---|
capture | Just a URL or note — intent to explore |
stub | Title, description, source link. No files yet. Publishable. |
archived | Raw files downloaded locally |
structured | Cleaned, normalised, schema documented |
enriched | Analysis, visualisations, derived data added |
monitored | Living source, versioned and updated over time |
Set "status": "<stage>" in datapackage.json to track this.
Dataset structure
Every dataset is a directory:
<name>/
datapackage.json # metadata and resource list (required)
data/ # data files go here
.datahubignore # gitignore-style exclusions for dh push
AGENTS.md # this file (copy into new datasets)
datapackage.json
Minimal valid example:
{
"name": "world-gdp",
"title": "World GDP",
"description": "GDP by country from World Bank, 1960–2024",
"status": "structured",
"resources": [
{
"path": "data/gdp.csv",
"name": "gdp",
"title": "GDP by Country",
"mediatype": "text/csv"
}
]
}
Rules:
namemust be URL-safe: lowercase, hyphens only- Every file in
data/that should be published must be inresources statusshould reflect the lifecycle stage above- Use
.datahubignoreto exclude scratch files, large intermediaries, raw downloads
Adding charts (views)
Add a views array to datapackage.json to render charts on the dataset page:
{
"views": [
{
"name": "gdp-over-time",
"title": "GDP Over Time",
"specType": "simple",
"resources": ["gdp"],
"spec": {
"type": "line",
"group": "year",
"series": ["gdp_usd"]
}
}
]
}
Supported chart types: line, bar, lines-and-points. Only CSV and GeoJSON resources can be visualised. group is the x-axis field, series is the list of y-axis fields.
Workflow
Start a new dataset
Create the directory structure:
mkdir -p <name>/data
cd <name>
Create datapackage.json with at minimum name, title, description. Add "status": "stub" if no data files yet.
Copy this AGENTS.md into the new directory so future AI sessions have context.
Push to DataHub
dh push .
Requires env vars:
export DATAHUB_API_URL=https://datahub.io
export DATAHUB_API_TOKEN=<your-token>
export DATAHUB_PUBLICATION=<your-publication-slug>
dh is the DataHub CLI — install from datopian/datahub-next.
Delete a dataset
dh delete <name>
Claude Code skills
If using Claude Code, the following slash commands are available in this repo:
| Command | What it does |
|---|---|
/init <name> | Scaffold a new dataset directory |
/push | Push current directory to DataHub |
/validate | Check datapackage.json for common issues |