# US Open Data Studio — Gov Data Joins (`subimpact/us-open-data-studio`) Actor

Value layer on keyless US federal open data APIs (BLS + USGS): 6 join presets (Inflation, Labour, Wages, Earthquakes, Employment, Prices) + custom joins + raw extraction, CSV/JSON/XLSX, AI-ready output, public domain.

- **URL**: https://apify.com/subimpact/us-open-data-studio.md
- **Developed by:** [subimpact](https://apify.com/subimpact) (community)
- **Categories:** AI, Automation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 joined pulls

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## US Open Data Studio — Gov Data Joins 🇺🇸

Value layer on keyless US federal open data APIs. Join cross-dataset indicators into clean, AI-ready tables — or pull raw series by ID.

**Sources:** [BLS public API v2](https://www.bls.gov/developers/) (Bureau of Labor Statistics — CPI, unemployment, employment, wages, PPI) and [USGS FDSN event API](https://earthquake.usgs.gov/fdsnws/event/1/) (earthquakes). Both keyless.

**Note on data.gov:** the US has no national CKAN datastore — data.gov's CKAN API is dead (404) and Census/FRED/BEA/EIA require API keys. This studio uses the keyless federal APIs that actually work.

**Licence:** US federal data is public domain.

### Features

#### Studio mode (value layer) — $0.02/joined-pull

Six cross-dataset join presets, delivered as CSV / JSON / XLSX with an AI-ready package (JSON Schema + data dictionary + sample rows) and attribution sidecar:

- **T1 Inflation & Prices by Year** — CPI-U × core CPI × PPI (annual means)
- **T2 Labour Market by Year** — unemployment rate × employment level × labour force × participation rate
- **T3 Wages & Earnings by Year** — average hourly × weekly earnings × total nonfarm employment
- **T4 Earthquakes by Year** — USGS M4.5+ earthquake counts
- **T5 Employment by Year** — total nonfarm × private-sector employment
- **T6 Prices & Wages by Year** — CPI-U × average hourly earnings (real-wage view)

Custom joins: bring your own BLS series IDs, key columns, join type (inner/left), aggregation (none/sum/mean), and year params.

#### Extract mode (raw data pull) — $0.01/extract-pull

Pull 1-5 BLS series raw by ID (e.g. `CUUR0000SA0`, `LNS14000000`) or `earthquakes`, no join, no reshape. Per-dataset files + manifest + attribution.

### Input

| Field | Type | Default | Notes |
|---|---|---|---|
| mode | select | studio | studio = value layer, extract = raw pull |
| preset | select | T1 | T1-T6 or custom |
| datasetIds | stringList | — | extract mode: 1-5 series IDs |
| customDatasets | stringList | — | custom join: 2-6 series IDs |
| customKey | stringList | \[year] | join keys ('year' auto-extracts from BLS year fields) |
| customJoinType | select | inner | inner / left |
| customParams | textfield | — | JSON API params (startyear/endyear) |
| customAgg | select | none | none / sum / mean |
| format | select | json | json / csv / xlsx |
| webhookUrl | textfield | — | optional POST target |
| aiReady | checkbox | true | AI-ready package |
| includeAttribution | checkbox | true | attribution sidecar |

### Output

- **Dataset:** one summary record per run (mode, preset, rows, format, files, year range, run URL) — rendered as a table in the Output tab.
- **Key-value store:** the joined/extracted file, `*_verification.json`, `*_attribution.json`, `*_ai_ready.json` (studio) or per-dataset files + `extract_manifest.json` (extract).

### Example

```bash
## Studio: Inflation & Prices preset, CSV
curl -X POST "https://api.apify.com/v2/acts/<ACTOR_ID>/runs?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"preset":"T1","format":"csv"}'

## Extract: pull CPI + unemployment raw
curl -X POST "https://api.apify.com/v2/acts/<ACTOR_ID>/runs?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"mode":"extract","datasetIds":["CUUR0000SA0","LNS14000000"],"format":"json"}'
```

### Notes

- BLS keyless API: max 25 series + 10 years per request. The engine batches all preset series into one request and loops 10-year chunks for longer ranges.
- BLS keyless has a daily request cap (~25/day per IP) — the actor batches aggressively to stay well under it.
- USGS count endpoint returns plain text (e.g. `7651`), not JSON.

# Actor input Schema

## `mode` (type: `string`):

studio = value layer (presets, joins, AI-ready package). extract = raw data pull of 1-5 BLS series by ID (cheaper per-pull event).

## `datasetIds` (type: `array`):

For mode=extract: list of BLS series ids (e.g. CUUR0000SA0, LNS14000000) or 'earthquakes' to pull raw (1-5). Leave empty to use studio mode.

## `preset` (type: `string`):

Join bundle. T1 = Inflation & Prices by Year. T2 = Labour Market by Year. T3 = Wages & Earnings by Year. T4 = Earthquakes by Year. T5 = Employment by Year. T6 = Prices & Wages by Year. custom = bring your own BLS series ids.

## `customDatasets` (type: `array`):

For preset=custom: list of BLS series ids to join (2-6). Leave empty to use a preset.

## `customKey` (type: `array`):

For preset=custom: key parts to join on. Use 'year' (auto-extracted from BLS year fields) or raw field names. All datasets must share these keys.

## `customJoinType` (type: `string`):

inner keeps only keys present in every dataset; left keeps all keys from the first dataset.

## `customParams` (type: `string`):

For preset=custom: JSON object of extra API params applied to every dataset, e.g. {"startyear": 2015, "endyear": 2024}.

## `customAgg` (type: `string`):

none = keep raw rows (last value per key). sum = aggregate numeric values per key. mean = average numeric values per key.

## `format` (type: `string`):

File format delivered to the key-value store (dataset records are always JSON).

## `webhookUrl` (type: `string`):

POST the result file to this URL after the run (3 retries with backoff). Leave empty to skip.

## `aiReady` (type: `boolean`):

Also emit JSON Schema + data dictionary + sample rows for LLM/RAG ingestion.

## `includeAttribution` (type: `boolean`):

Attach source/licence metadata sidecar to every output (public domain, US federal data).

## Actor input object example

```json
{
  "mode": "studio",
  "preset": "T1",
  "customKey": [
    "year"
  ],
  "customJoinType": "inner",
  "customAgg": "none",
  "format": "json",
  "aiReady": true,
  "includeAttribution": true
}
```

# Actor output Schema

## `runSummary` (type: `string`):

One summary record per run: mode, preset, row count, format, files, year range.

## `joinedData` (type: `string`):

The joined dataset file (CSV/JSON/XLSX) in the default key-value store.

## `extractedData` (type: `string`):

Raw dataset file(s) (CSV/JSON/XLSX) in the default key-value store.

## `aiReadyPackage` (type: `string`):

JSON Schema + data dictionary + sample rows for LLM/RAG ingestion.

## `attribution` (type: `string`):

Source and licence metadata (Open Data Common / CC).

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("subimpact/us-open-data-studio").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("subimpact/us-open-data-studio").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call subimpact/us-open-data-studio --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,subimpact/us-open-data-studio"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/i1flWtmM8oM264vPT/builds/AiE8nOq5V5xobLnuF/openapi.json
