Skip to content
Demonstration - not client work

Public-records data pipeline into Postgres

A repeatable pipeline that pulls a public city directory and 18 business websites into one deduplicated Postgres database, with confidence scores and a review queue for anything uncertain.

  • Python
  • Postgres
  • Claude
  • US Census geocoder
Related servicesLead generation
A run report: 331 camps loaded, 93.5% geocoded, 62 records needing review, and a weekly session grid.
records loaded
331
business websites
18
duplicate records merged
24
tests passed
213
The sources list: the NYC permitted summer camps open data set and 18 camp websites read by an AI reader.

Problem

A directory business needs fresh, structured records from public sources that disagree with each other: a government list with one row per inspection, and business websites that each describe themselves differently.

What was built

A Python pipeline with two sources, a polite fetcher, normalization, geocoding, deduplication with stable ids, a Postgres load with history tables, and a run report with a human review queue.

What it does

Good lead lists and directories start as messy public data. This build shows the unglamorous half of that work: collecting, cleaning and deduplicating records so the same business does not appear three times.

It uses New York City's public directory of permitted summer camps as the pilot. That list has one row per inspection, so the pipeline first collapses 1,431 inspection rows into one row per permit, about 341 camps. It then reads 18 camp websites with an AI reader that returns each field with a confidence score.

Records from both sources are normalized (addresses geocoded, ages turned into minimum and maximum, dates into a standard format, prices kept with their original text), matched against each other, and loaded into Postgres. Fields the AI was not sure about go to a review queue for a person.

What was built

  • A fetcher that checks robots.txt, waits 3 seconds between requests to the same site, caches pages and times out after 30 seconds.
  • An AI website reader with per-field confidence and a hard cost cap for each run.
  • Deduplication that assigns a stable id to each record and logs every merge.
  • A Postgres schema with history tables, so a change between runs is recorded.
  • A run report, a QA report, a review queue and a run log for every run.

How it was tested

  • The end-to-end run loaded 331 records into Postgres: 325 from the city directory and 18 from websites, with 12 found in both.
  • 24 duplicate records were merged, 12 of them across the two sources.
  • 303 of 325 directory records were geocoded, which is 93.2%. The target was 95%, so this check is recorded as missed.
  • Running the pipeline a second time added 0 new records.
  • The automated test suite finished with 213 passed and 2 skipped.

What it does not do

One city, one government list and 18 websites. The scheduler is configured but was not run unattended, and the geocoding rate of 93.2% missed the 95% target.

  • It covers one city. Other metros are not built.
  • The city list it relies on was last refreshed in April 2023, so the output is only as current as that source.
  • The schedule is written as configuration but has not run unattended.
  • Sites that need JavaScript to show their content are sent to review rather than read.
  • The database is a local test instance. A production run needs the owner's own Postgres.
Next demoSupport chatbot that answers from help docs and hands off

More demos

Diagram of the workflow's last steps: a Google Sheets row, the Hot check, and an alert that fires on Hot leads only.

Contact form AI lead qualifier in n8n

A 10-node n8n workflow that reads each website contact form submission, labels it Hot, Warm or Not Relevant with a one-line reason, logs it to Google Sheets and alerts the team on Hot leads only.

A dashboard of 367 county permits read and 36 ranked target projects.

Permit-triggered outbound planning from public data

A pipeline that turns real county building permits into ranked target projects and stage-aware three-touch email sequences, with every message linted and the export blocked until a real sender is confirmed.

Start with a free automation audit

Email the founder to arrange a free 45-minute video call. We map your workflow, tools and bottlenecks, and you get a prioritized roadmap.

Michael replies within two business days.