# California HCAI Hospital 2030 Seismic & Permit Leads (`zinky_atelier/ca-hcai-hospital-seismic-leads`) Actor

Extract California HCAI (OSHPD) hospital buildings facing the 2030 SB 1953 seismic retrofit deadline with SPC/NPC ratings, Hazus collapse scores, Accela permit details, urgency scores, and stateful delta alerts for AEC, seismic engineering, and healthcare construction teams.

- **URL**: https://apify.com/zinky_atelier/ca-hcai-hospital-seismic-leads.md
- **Developed by:** [Travis Burrows](https://apify.com/zinky_atelier) (community)
- **Categories:** Lead generation, Real estate, Business
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $14.00 / 1,000 hcai hospital seismic building leads

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## California HCAI Hospital 2030 Seismic & Permit Leads

Extract **California HCAI (formerly OSHPD) hospital buildings facing California's January 1, 2030 SB 1953 seismic retrofit mandate**, enriched with official **SPC / NPC seismic ratings**, **HAZUS collapse probabilities**, **AB 1882 public warning notices**, **0–100 urgency scoring**, and **live Accela Citizen Access (`esp.hcai.ca.gov`) permit details**.

Built with pure Node `fetch` + lightweight Cheerio HTML parsing (`256 MB` RAM, zero headless browser overhead, `$0` proxy cost) for **biweekly scheduled delta alerts**, **AEC / structural engineering & MEP pipeline generation**, **Clay / HubSpot / Salesforce CRM enrichment**, and **AI MCP workflows**.

***

### Why Monitor California HCAI (OSHPD) 2030 Hospital Seismic Mandates?

Under **California SB 1953** and **AB 1882**, acute care hospital buildings rated **SPC-1 / SPC-2** (Structural Performance Category) or **NPC-1 / NPC-2** (Nonstructural Performance Category) must complete structural retrofits, seismic replacement towers, or MEP bracing upgrades by **January 1, 2030**—or lose general acute care licensure. Across California's **4,700+ regulated hospital buildings**, hundreds of active structures represent **$100B+ in mandatory healthcare CapEx**.

| Target B2B Workflow | Recommended Filter Setup |
| :--- | :--- |
| **Seismic Structural Engineering, Base Isolation & Retrofit General Contractors** | `nonCompliant2030Only: true`, `spcRatings: ["1", "2"]`, `enrichPermitDetails: true` — Target active `OSHPD 1-In Service` buildings with `CRITICAL` urgency scores, concrete shear-wall / non-ductile frame types, and related `SRU-*` retrofit permits. |
| **Hospital MEP, Fire/Life Safety, Standby Power & Seismic Bracing Contractors** | `nonCompliant2030Only: true`, `npcRatings: ["1", "2"]` — Identify hospital wings needing NPC-4D / NPC-5 equipment anchoring, emergency generators, and 72-hour water/wastewater autonomy upgrades before 2030. |
| **Healthcare Real Estate, Municipal Bond & Capital Advisory Teams** | Query target counties (`"Los Angeles, Alameda, Orange, San Diego"`) with `onlyNew: true` to alert immediately when a building changes SPC/NPC seismic rating or transitions from `Proposed` to `Under Construction`. |
| **Medical Equipment, Modular Hospital & Temporary Acute Care Suppliers** | Filter high-HAZUS collapse probability buildings (`hazusScore2010Pct`) with active `AB 1882 Notice` signage to find campuses planning phased decanting and wing replacements. |

***

### Key Capabilities

- **Dynamic CHHS CKAN Dataset Resolution:** Automatically queries `data.chhs.ca.gov/api/3/action/package_show` for both `hospital-building-data` and `seismic-ratings-and-collapse-probabilities-of-california-hospitals` so biweekly filename date stamps (`ca-hcai-hospital-building-data-MMDDYYYY.csv`) never break.
- **Automatic Legacy `esp.oshpd.ca.gov` -> `esp.hcai.ca.gov` SSL URL Rewrite:** Every CSV row ships with legacy `esp.oshpd.ca.gov` links whose TLS certificate migrated to `esp.hcai.ca.gov`; the Actor automatically rewrites URLs cleanly before hydration and in the output dataset.
- **Live Accela Permit Detail Hydration (`enrichPermitDetails: true`):** Concurrently fetches `esp.hcai.ca.gov/CitizenAccess/Cap/CapDetail.aspx` (bounded concurrency = 4) to extract:
  - Physical **Work Location** street address, city, state, ZIP, and formatted address
  - Official Accela **Record Status**, **Permit Number**, **Permit Type**, and **Project Description**
  - **Building Classification** (`OSHPD 1`, `OSHPD 1R`, etc.) and **Structural Building Types** (e.g. `09 - Concrete Shear Wall`)
  - Complete chronological **SPC & NPC Rating History** with dates and latest review timestamps
  - **Related `SRU-*` Seismic Retrofit Project Numbers** and **HAZUS Review Status / Score**
- **2030 SB 1953 Urgency Scoring (`0–100` & Tiers):** Deterministically scores and ranks every building (`CRITICAL`, `HIGH`, `MODERATE`, `COMPLIANT`, `NOT_APPLICABLE`) using SPC/NPC non-compliance, active `In Service` status, statutory `AB 1882 Notice`, and HAZUS collapse probability.
- **Stateful `SEEN_BUILDINGS` Delta Monitoring (`onlyNew: true`):** Persists `spcRating`, `npcRating`, and `buildingStatus` in Key-Value Store (`SEEN_BUILDINGS`) across runs—skipping unchanged buildings **before** Accela HTML hydration and flagging `NEW_BUILDING`, `SEISMIC_RATING_CHANGED`, or `STATUS_CHANGED`.

***

### Pay-Per-Event (PPE) Pricing Structure

This Actor uses transparent Apify **Pay-Per-Event** billing. Unchanged buildings skipped in `onlyNew: true` mode are **never** charged, and `permit-detail-enriched` is charged **only** when `enrichPermitDetails: true` hydrates an Accela permit page.

| Event Name | Pricing Tier | When It Is Charged |
| :--- | :--- | :--- |
| `actor-start` | `$0.05` one-time | Charged once per run on startup. |
| `seismic-building-lead` *(Primary)* | `$0.02` FREE -> `$0.014` GOLD+ | Charged per normalized hospital building lead emitted to the dataset. |
| `permit-detail-enriched` | `$0.01` FREE -> `$0.007` GOLD+ | Charged only when `enrichPermitDetails: true` successfully enriches an `esp.hcai.ca.gov` Accela permit page. |

***

### Copy-Paste Example Input

```json
{
  "county": "Alameda, Los Angeles",
  "city": "",
  "facilityName": "",
  "spcRatings": ["1", "2"],
  "npcRatings": [],
  "nonCompliant2030Only": true,
  "enrichPermitDetails": true,
  "onlyNew": true,
  "maxItems": 20
}
```

#### Fast CSV-Only Mode (No Accela Enrichment Fee)

Set `"enrichPermitDetails": false` to download and rank statewide CHHS Hospital Building + Collapse Probability CSV leads in seconds without paying `permit-detail-enriched` fees.

***

### Example Output Record

```json
{
  "buildingKey": "11210::BLD-01279",
  "permId": "11210",
  "buildingNbr": "BLD-01279",
  "facilityName": "Alameda Hospital",
  "buildingName": "Stephens Wing",
  "countyCode": "01 - Alameda",
  "county": "Alameda",
  "city": "Alameda",
  "state": "CA",
  "buildingStatus": "OSHPD 1-In Service",
  "spcRating": "2",
  "npcRating": "2",
  "hazusScore2007Pct": null,
  "hazusScore2010Pct": 0.98,
  "isSpc2030NonCompliant": true,
  "isNpc2030NonCompliant": true,
  "isNonCompliant2030": true,
  "sb1953Deadline": "2030-01-01",
  "seismicUrgencyScore": 80,
  "seismicUrgencyTier": "CRITICAL",
  "ab1882Notice": "This building does not significantly jeopardize life, but may not be repairable or functional following an earthquake.",
  "heightFt": 35,
  "stories": 3,
  "buildingCode": "1952 Uniform Building Code (UBC)",
  "buildingCodeYear": 1952,
  "yearCompleted": 1956,
  "latitude": 37.7626572,
  "longitude": -122.2538986,
  "permitDetailsEnriched": true,
  "permitUrl": "https://esp.hcai.ca.gov/CitizenAccess/Cap/CapDetail.aspx?Module=Permits&TabName=Permits&capID1=56HIS&capID2=00000&capID3=00012&agencyCode=OSHPD",
  "legacyOshpdUrl": "https://esp.oshpd.ca.gov/CitizenAccess/Cap/CapDetail.aspx?Module=Permits&TabName=Permits&capID1=56HIS&capID2=00000&capID3=00012&agencyCode=OSHPD",
  "permitNumber": "BLD-01279",
  "permitType": "Buildings",
  "recordStatus": "Completed",
  "workLocationStreet": "2070 Clinton Ave",
  "workLocationCity": "Alameda",
  "workLocationState": "CA",
  "workLocationZip": "94501",
  "workLocationFull": "2070 Clinton Ave, Alameda, CA 94501",
  "projectDescription": "Stephens Wing",
  "buildingClassification": "OSHPD 1",
  "buildingTypes": ["09 - Concrete Shear Wall"],
  "latestSpcRatingDate": "2021-12-20",
  "latestNpcRatingDate": "2021-12-27",
  "ratingHistoryCount": 8,
  "relatedProjectNumbers": ["SRU-2017-00029", "SRU-2012-00191"],
  "changeType": "NEW_BUILDING",
  "previousSpcRating": null,
  "previousNpcRating": null,
  "previousBuildingStatus": null,
  "scrapedAt": "2026-11-18T22:00:00.000Z"
}
```

***

### Key-Value Store Outputs

- **`SEEN_BUILDINGS`:** Stateful delta ledger persisted across runs in both the default KV store and persistent named KV store (`ca-hcai-seen-buildings`).
- **`RUN_SUMMARY`:** Full telemetry report including resolved CHHS CKAN CSV URLs, filter parameters, total CSV rows parsed, matching buildings, emitted leads, Accela permit enrichments, skipped unchanged counts, and exact PPE events charged.

***

### Local Container Testing

```bash
docker build -t tmp-hcai-test --target tester .
docker run --rm --dns 1.1.1.1 tmp-hcai-test npm test
docker run --rm --dns 1.1.1.1 tmp-hcai-test npm run test:canary
```

# Actor input Schema

## `county` (type: `string`):

Filter by one or more California county names or codes (comma-separated, e.g. 'Alameda' or 'Los Angeles, Orange, San Diego'). Leave blank for all 58 California counties.

## `city` (type: `string`):

Filter by one or more California city names (comma-separated, e.g. 'Oakland, Berkeley' or 'Los Angeles'). Leave blank for all cities.

## `facilityName` (type: `string`):

Optional substring filter matching Hospital Facility Name, Building Name, Building Number (e.g. 'BLD-01279'), or HCAI Perm ID (e.g. '11210').

## `spcRatings` (type: `array`):

Filter by Structural Performance Category (SPC) ratings. SPC-1 and SPC-2 buildings face California's Jan 1, 2030 SB 1953 operational deadline. Leave empty for all SPC ratings.

## `npcRatings` (type: `array`):

Filter by Nonstructural Performance Category (NPC) ratings from HCAI seismic collapse data. NPC-1 and NPC-2 buildings require MEP/life-safety anchoring upgrades for 2030 compliance. Leave empty for all NPC ratings.

## `nonCompliant2030Only` (type: `boolean`):

When enabled, filters strictly to hospital buildings rated SPC-1/1s, SPC-2/2s, NPC-1, or NPC-2/2s facing California's mandatory January 1, 2030 SB 1953 seismic retrofit or shutdown deadline.

## `enrichPermitDetails` (type: `boolean`):

Hydrates each matched building's official HCAI Accela Citizen Access permit page (automatically rewriting legacy esp.oshpd.ca.gov URLs to esp.hcai.ca.gov) to extract physical Work Location street address, Record Status, Project Description, structural Building Types, full SPC/NPC rating history, and related SRU project numbers.

## `onlyNew` (type: `boolean`):

Tracks seen buildings (SPC rating, NPC rating, and Building Status) in Key-Value Store ('SEEN_BUILDINGS'). On scheduled runs, skips unchanged buildings BEFORE Accela HTML hydration and emits only NEW_BUILDING, SEISMIC_RATING_CHANGED, or STATUS_CHANGED leads.

## `maxItems` (type: `integer`):

Maximum number of hospital building records to emit in this run (sorted by 2030 SB 1953 seismic urgency score descending).

## Actor input object example

```json
{
  "county": "Alameda",
  "city": "",
  "facilityName": "",
  "spcRatings": [],
  "npcRatings": [],
  "nonCompliant2030Only": true,
  "enrichPermitDetails": true,
  "onlyNew": false,
  "maxItems": 20
}
```

# Actor output Schema

## `buildings` (type: `string`):

Dataset of California hospital buildings with SPC/NPC seismic ratings, 2030 SB 1953 non-compliance urgency scoring, Hazus collapse probabilities, and optional live Accela permit enrichment.

## `seenBuildings` (type: `string`):

Persistent delta state of seen hospital buildings tracking SPC rating, NPC rating, and building status across scheduled runs.

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

JSON summary of resolved CKAN CSV URLs, applied filters, total matching buildings, emitted leads, skipped seen buildings, Accela enrichments, and PPE event charges.

# 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 = {
    "county": "Alameda",
    "nonCompliant2030Only": true,
    "enrichPermitDetails": true,
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("zinky_atelier/ca-hcai-hospital-seismic-leads").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 = {
    "county": "Alameda",
    "nonCompliant2030Only": True,
    "enrichPermitDetails": True,
    "maxItems": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("zinky_atelier/ca-hcai-hospital-seismic-leads").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 '{
  "county": "Alameda",
  "nonCompliant2030Only": true,
  "enrichPermitDetails": true,
  "maxItems": 20
}' |
apify call zinky_atelier/ca-hcai-hospital-seismic-leads --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,zinky_atelier/ca-hcai-hospital-seismic-leads"
        }
    }
}
```

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/v5ggDKJPNQnJXA3M6/builds/c3W1qqtWZ4syi2gfB/openapi.json
