# FEMA Disaster & Public Assistance Intelligence (`commanding_hotdog/fema-disaster-assistance-intelligence`) Actor

Query official FEMA OpenFEMA datasets for disaster and public assistance records.

- **URL**: https://apify.com/commanding\_hotdog/fema-disaster-assistance-intelligence.md
- **Developed by:** [qingwa](https://apify.com/commanding_hotdog) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## FEMA Disaster & Public Assistance Intelligence

Apify Actor for querying official FEMA OpenFEMA datasets. It preserves source records, adds normalized fields, supports bounded OData filtering/pagination, and emits transparent run summaries.

### Data sources

The Actor uses FEMA's public OpenFEMA API over HTTPS:

- `DisasterDeclarationsSummaries`
- `PublicAssistanceFundedProjectsDetails`
- `PublicAssistanceGrantAwardActivities`

No login, API token, browser automation, cookies, or proxy is required.

A missing record means that the selected dataset and filters returned no matching row. It does **not** prove that no FEMA assistance exists. Dataset coverage and field availability vary by program and time.

### Minimal input

```json
{
  "datasets": ["disaster_declarations"],
  "states": ["CA"],
  "maxResults": 100,
  "pageSize": 50,
  "outputMode": "normalized"
}
```

### Supported datasets

- `disaster_declarations`: disaster declarations and designated-area records.
- `public_assistance`: funded public-assistance project details.
- `grant_award_activities`: public-assistance grant award activity records.

### Filtering

Structured filters include states, counties/designated areas, disaster numbers, incident and declaration types, applicant IDs, date bounds, modification timestamp, and federal-obligation amount bounds where supported by the selected dataset.

Advanced users may provide dataset-specific OData clauses through `advancedFilters`. The Actor rejects empty or obviously unsafe clauses before any network request. `$select` and `$orderby` are also supported.

All requests are bounded by `maxResults`, `maxPages`, `pageSize`, and `maxRuntimeSeconds`. Retryable HTTP responses such as 429 and 5xx are retried with bounded backoff. Permanent 4xx errors are reported rather than retried indefinitely.

### Output modes

- `normalized`: normalized fields plus source metadata and, by default, `raw_record`.
- `raw`: original FEMA records plus the final `run_summary`.
- `flat`: normalized flat records.
- `summary`: aggregate statistics plus the final `run_summary`.

Normalized records include `record_type`, `source_dataset`, `source_api_version`, `source_url`, `retrieved_at`, `source_last_updated`, and deterministic `raw_record_hash`.

Original FEMA fields are not discarded when `includeRawFields` is enabled. Monetary meanings remain separate; for example, `federal_share_obligated`, `total_obligated`, and `total_project_amount` are never collapsed into a generic `amount`.

### Row granularity and relationships

`rowGranularity` accepts:

- `designated_area`: retain declaration rows at designated-area level.
- `disaster`: aggregate declaration areas into disaster views.
- `both`: retain both declaration rows and related public-assistance project rows.

Relationships are only created using verified disaster-number and state keys. Unmatched public-assistance rows remain in output with an explicit relationship status.

### Run summary

The Actor emits one `record_type=run_summary` record when `includeSummary` is enabled. It distinguishes:

- `success`
- `empty`
- `partial`
- `failed`
- `truncated`

Counts distinguish source rows, unique records, unique disasters, designated areas, projects, applicants, and separate monetary totals.

### Limitations

- The initial release is stateless. Historical delta detection and prior-run change comparison are not enabled.
- FEMA dataset records have different coverage, update timing, and field semantics.
- A successful HTTP response alone does not guarantee matches; the response shape and dataset record list are validated.
- AI-generated summaries are not enabled and are not official FEMA conclusions.

### Local verification

```bash
python3 -m pytest -q
python3 -m compileall -q src tests
python3 -m src
```

For an Apify run, the Actor reads input through the Apify SDK and pushes each output record to the default Dataset.

# Changelog

This Actor's version history is a separate document: https://apify.com/commanding\_hotdog/fema-disaster-assistance-intelligence/changelog.md

# Actor input Schema

## `datasets` (type: `array`):

FEMA datasets to query. Dataset names will be validated by the Actor.

## `states` (type: `array`):

Optional two-letter US state or territory abbreviations used to filter results.

## `maxResults` (type: `integer`):

Maximum number of records returned across the selected datasets.

## `outputMode` (type: `string`):

Shape of emitted records: flat, normalized, summary, or raw.

## `includeRawFields` (type: `boolean`):

Whether normalized records retain the complete original FEMA source record.

## `counties` (type: `array`):

Optional county or designated-area names.

## `disasterNumbers` (type: `array`):

Optional FEMA disaster declaration numbers.

## `startDate` (type: `string`):

Optional inclusive declaration or update start date (YYYY-MM-DD).

## `endDate` (type: `string`):

Optional inclusive declaration or update end date (YYYY-MM-DD).

## `modifiedSince` (type: `string`):

Optional ISO-8601 timestamp including timezone.

## `minFederalObligatedAmount` (type: `number`):

Optional minimum federal obligated amount; omit to disable this filter.

## `maxFederalObligatedAmount` (type: `number`):

Optional maximum federal obligated amount; omit to disable this filter.

## `maxPages` (type: `integer`):

Maximum API pages to read per dataset.

## `pageSize` (type: `integer`):

Number of records requested per API page.

## `maxRuntimeSeconds` (type: `integer`):

Maximum runtime budget in seconds.

## `requestDelayMs` (type: `integer`):

Delay between API requests in milliseconds.

## `rowGranularity` (type: `string`):

Whether to emit disaster, designated-area, or both row levels.

## `includeSummary` (type: `boolean`):

Emit a run summary record.

## `includeSourceMetadata` (type: `boolean`):

Include official source and retrieval metadata.

## `stopOnLimit` (type: `boolean`):

Stop fetching when the result limit is reached.

## `incidentTypes` (type: `array`):

Optional FEMA incident type filters.

## `declarationTypes` (type: `array`):

Optional FEMA declaration type filters.

## `applicantIds` (type: `array`):

Optional applicant identifier filters.

## `select` (type: `array`):

Optional FEMA OData field projection.

## `orderby` (type: `string`):

Optional FEMA OData ordering expression.

## `advancedFilters` (type: `object`):

Optional dataset-specific OData clauses; validated before network access.

## Actor input object example

```json
{
  "datasets": [
    "disaster_declarations"
  ],
  "states": [],
  "maxResults": 1000,
  "outputMode": "normalized",
  "includeRawFields": true,
  "counties": [],
  "disasterNumbers": [],
  "maxPages": 100,
  "pageSize": 100,
  "maxRuntimeSeconds": 300,
  "requestDelayMs": 0,
  "rowGranularity": "designated_area",
  "includeSummary": true,
  "includeSourceMetadata": true,
  "stopOnLimit": true,
  "incidentTypes": [],
  "declarationTypes": [],
  "applicantIds": [],
  "select": [],
  "advancedFilters": {}
}
```

# Actor output Schema

## `dataset` (type: `string`):

Open the complete FEMA records returned by this run.

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

The dataset includes a record\_type=run\_summary item with status, counts, failed datasets, and truncation information.

# 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("commanding_hotdog/fema-disaster-assistance-intelligence").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("commanding_hotdog/fema-disaster-assistance-intelligence").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 commanding_hotdog/fema-disaster-assistance-intelligence --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,commanding_hotdog/fema-disaster-assistance-intelligence"
        }
    }
}
```

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/LiLQ96hoKDFohRkYG/builds/I2EmHErCPIFsC8FtN/openapi.json
