← back to Nationalrealestate
src/ingest/brokers/de_dpr.ts
54 lines
/**
* DE — Division of Professional Regulation "Professional and Occupational
* Licensing" on data.delaware.gov (pjnv-eaih; 351k rows all professions,
* probed 2026-07-21). We pull profession_id='Real Estate' via SODA CSV
* (30,895 rows): Salesperson / Resident Salesperson / Nonresident Salesperson
* / Broker / Resident Broker / Nonresident Broker / Associate Broker
* individuals, plus Main/Branch Office Permit rows which are brokerage
* offices → firm rows (company name arrives in last_name/combined_name).
* All statuses kept (Active/Expired/Closed…), license_status preserved.
* No employer linkage columns → individuals carry no firm.
*/
import { download } from '../run.ts';
import { parseCsvObjects } from './csv.ts';
import type { BrokerRow, FetchedFile, StateAdapter } from './types.ts';
const URL = 'https://data.delaware.gov/resource/pjnv-eaih.csv'
+ '?$where=' + encodeURIComponent("profession_id='Real Estate'")
+ '&$order=license_no&$limit=100000';
const OFFICE = /Office Permit/i;
export const deDpr: StateAdapter = {
state: 'DE',
source: 'de_dpr',
url: URL,
async fetch() {
return [await download(URL, 'de_dpr_real_estate.csv')];
},
*parse(files: FetchedFile[]): Generator<BrokerRow> {
for (const o of parseCsvObjects(files[0].path)) {
const type = o.license_type || '';
if (!o.license_no || !type) continue;
const status = o.license_status || null;
const city = o.city || null;
const st = (o.state || '').toUpperCase() || null;
if (OFFICE.test(type)) {
const name = o.combined_name || o.last_name;
if (!name) continue;
yield {
kind: 'firm', name, license_no: o.license_no,
license_type: type, license_status: status, city, state_code: st,
};
} else {
const name = [o.first_name, o.last_name].filter(Boolean).join(' ') || o.combined_name;
if (!name) continue;
yield {
kind: 'broker', name, license_no: o.license_no,
license_type: type, license_status: status, city, state_code: st,
};
}
}
},
};