# County Permit + Contractor Activity Normalizer (`engineertsaistudio/county-permit-contractor-normalizer`) Actor

Normalizes real, public county/city building-permit data (any Socrata open-data portal) into one flat schema, with contractor name/phone attached -- the moment a vendor starts new work is exactly when their insurance compliance matters most.

- **URL**: https://apify.com/engineertsaistudio/county-permit-contractor-normalizer.md
- **Developed by:** [Studio EngineerTsai](https://apify.com/engineertsaistudio) (community)
- **Categories:** Real estate, Lead generation, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

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

## County Permit + Contractor Activity Normalizer

Every county and city publishes building-permit records on its own siloed
open-data portal, in its own schema. If you need to know **when a vendor
or contractor is actively starting new work** — the exact moment their
insurance/compliance status matters most — you're stuck manually watching
one county's portal at a time.

This Actor queries any public **Socrata** open-data platform (used by
hundreds of US city/county portals — Seattle, San Diego County, Austin,
San Francisco, and many more) and returns one clean, flat schema regardless
of how the source county names its own fields.

### What you get

One normalized JSON record per permit:

```json
{
  "permit_id": "PDS2023-RESALT-015752",
  "issued_date": "2023-12-05T00:00:00.000",
  "status": "Issued",
  "address": "10568 ROSEDUST GLEN DR, SAN DIEGO, CA 92127",
  "city": "SAN DIEGO",
  "state": "CA",
  "zip_code": "92127",
  "contractor_name": "WALTER ANDERSON PLUMBING LLC",
  "contractor_phone": "6194493852",
  "work_description": "50 GALLON WATER HEATER FOR EXISTING SFD/MISC PLUMBING"
}
```

Real output, taken from a real run against San Diego County's own public
data — nothing here is a mock.

### Input

| Field | Required | Description |
|---|---|---|
| `socrataHost` | yes | The county/city open-data host, e.g. `data.seattle.gov` |
| `resourceId` | yes | The dataset's Socrata resource id, e.g. `8tqq-u7ib` |
| `dateField` | no | The dataset's own column name for the permit date (default `issued_date`) |
| `lookbackDays` | no | How many days back to fetch (default `3650` — see note below) |
| `limit` | no | Max rows per run (default `100`, max `5000`) |

Find your county's dataset at [opendatanetwork.com](https://www.opendatanetwork.com/)
(search "building permits" + your county/city name).

**Note on the default example:** San Diego County's own public dataset is a
static archive (last updated 2023-12-05), not a live feed — the default
`lookbackDays` is set wide so a first-time run actually returns data.
Point this at your own county's *live* dataset (e.g. Seattle's, updated
within days) and use a normal 30-day window for current activity.

### Who this is for

Property managers, GCs, and insurance-compliance teams who need to know
the moment a vendor starts new work on a property — pair this Actor's
output with your own vendor certificate-of-insurance records to catch
lapses exactly when they matter, instead of on a fixed annual re-check
schedule.

### Rights and data source

Socrata open-data portals are government open-data publications explicitly
intended for public reuse — that is the entire purpose of an "open data
portal." This Actor makes only unauthenticated, rate-respecting requests to
each county's own published API.

# Actor input Schema

## `socrataHost` (type: `string`):

The county/city open-data portal hostname, e.g. data.sandiegocounty.gov. Find yours at https://www.opendatanetwork.com/ (search 'building permits' + your county). Defaults to San Diego County's real public dataset if omitted.

## `resourceId` (type: `string`):

The dataset's 4-4 resource id from its Socrata URL, e.g. dyzh-7eat. Defaults to San Diego County's real Building Permits dataset if omitted.

## `dateField` (type: `string`):

The dataset's own column name for the permit issue date.

## `lookbackDays` (type: `integer`):

How many days back from today to fetch permits for. Note: San Diego County's own public dataset (the default example) is a static archive last updated 2023-12-05, not a live feed -- the default is set wide so the example actually returns real rows. Point this at your own county's live dataset and use a normal 30-day window for current activity.

## `limit` (type: `integer`):

Maximum number of permit rows to fetch and normalize in one run.

## Actor input object example

```json
{
  "socrataHost": "data.sandiegocounty.gov",
  "resourceId": "dyzh-7eat",
  "dateField": "issued_date",
  "lookbackDays": 3650,
  "limit": 100
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# 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 = {
    "socrataHost": "data.sandiegocounty.gov",
    "resourceId": "dyzh-7eat",
    "dateField": "issued_date"
};

// Run the Actor and wait for it to finish
const run = await client.actor("engineertsaistudio/county-permit-contractor-normalizer").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 = {
    "socrataHost": "data.sandiegocounty.gov",
    "resourceId": "dyzh-7eat",
    "dateField": "issued_date",
}

# Run the Actor and wait for it to finish
run = client.actor("engineertsaistudio/county-permit-contractor-normalizer").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 '{
  "socrataHost": "data.sandiegocounty.gov",
  "resourceId": "dyzh-7eat",
  "dateField": "issued_date"
}' |
apify call engineertsaistudio/county-permit-contractor-normalizer --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,engineertsaistudio/county-permit-contractor-normalizer"
        }
    }
}

```

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/hsWsaHjKdgEcVmOW7/builds/gWhgpf5t6Jwg1RDkz/openapi.json
