import type { PathBuilderLike } from "path-ts"; import { type CanonicalRow, type CorpusAdapter } from "#types"; /** * The adapter stamps this id on every emitted row. */ export declare const USGOV_NAD_ADAPTER_ID = "usgov-nad"; /** * The license label on every emitted row, because US federal works are public domain under 17 U.S.C. ยง 105. */ export declare const USGOV_NAD_DEFAULT_LICENSE = "Public Domain"; /** * The all-zero UUID some NAD contributors publish in place of an identifier. */ export declare const NAD_PLACEHOLDER_UUID: RegExp; /** * One NAD address point as the release publishes it, limited to the fields a reader here uses. * * The release's text file is read with every column as text. */ export interface NADRecord { /** * The row's position in the release file, read by {@linkcode readNADRecords}. */ file_row_number?: number | bigint | null; OID_?: string | null; UUID?: string | null; AddNum_Pre?: string | null; Add_Number?: number | string | null; AddNum_Suf?: string | null; AddNo_Full?: string | null; St_PreMod?: string | null; St_PreDir?: string | null; St_PreTyp?: string | null; St_PreSep?: string | null; St_Name?: string | null; St_PosTyp?: string | null; St_PosDir?: string | null; St_PosMod?: string | null; StNam_Full?: string | null; Building?: string | null; Floor?: string | null; Unit?: string | null; Room?: string | null; Seat?: string | null; Addtl_Loc?: string | null; SubAddress?: string | null; LandmkName?: string | null; County?: string | null; Inc_Muni?: string | null; Post_City?: string | null; Census_Plc?: string | null; Uninc_Comm?: string | null; Nbrhd_Comm?: string | null; NatAmArea?: string | null; NatAmSub?: string | null; Urbnztn_PR?: string | null; PlaceOther?: string | null; PlaceNmTyp?: string | null; State?: string | null; Zip_Code?: string | null; Plus_4?: string | null; AddAuth?: string | null; Longitude?: string | null; Latitude?: string | null; Placement?: string | null; } /** * The release columns {@link readNADRecords} projects, one per {@link NADRecord} field. */ export declare const NAD_RECORD_COLUMNS: readonly ["OID_", "UUID", "AddNum_Pre", "Add_Number", "AddNum_Suf", "AddNo_Full", "St_PreMod", "St_PreDir", "St_PreTyp", "St_PreSep", "St_Name", "St_PosTyp", "St_PosDir", "St_PosMod", "StNam_Full", "Building", "Floor", "Unit", "Room", "Seat", "Addtl_Loc", "SubAddress", "LandmkName", "County", "Inc_Muni", "Post_City", "Census_Plc", "Uninc_Comm", "Nbrhd_Comm", "NatAmArea", "NatAmSub", "Urbnztn_PR", "PlaceOther", "PlaceNmTyp", "State", "Zip_Code", "Plus_4", "AddAuth", "Longitude", "Latitude", "Placement"]; /** * A NAD UUID in the lower-case, unbraced form the FeatureServer published. * * The release text writes `{0002173C-ADA8-4421-ACF2-F9B6F12B52F0}`, and the * FeatureServer wrote `0002173c-ada8-4421-acf2-f9b6f12b52f0`. * Row ids are built from this form, so a record read from either keeps one * `source_id` and lands in one split. */ export declare function normalizeNADUUID(value: string | null | undefined): string | null; /** * A NAD record with each text column that holds a {@link NAD_PLACEHOLDER_TEXT} * spelling read as absent, and its UUID normalized. * * `Placement` is left as published, because there `Unknown` is a value of the * column's own domain that names how the point was placed. */ export declare function normalizeNADRecord(record: NADRecord): NADRecord; /** * Streams the NAD records of one release Parquet file in file order, * each passed through {@linkcode normalizeNADRecord}. * * Each record holds its `file_row_number`. * * @param where A DuckDB condition rows must satisfy, built with `escapeSQLString` for every literal. * @param rowRange The positions to read, from `start` up to `end`. * @throws When the file lacks a column of {@link NAD_RECORD_COLUMNS}. */ export declare function readNADRecords(parquetPath: PathBuilderLike, options?: { where?: string; rowRange?: { start: number; end: number; } | null; limits?: { memoryLimitBytes: number; threads: number; } | null; }): AsyncGenerator; /** * A NAD row's unit as an address writes it: its `Building`, `Floor`, `Unit` * and `Room` parts in that order, or `null` when all four are empty. * * A publisher may write one designator into several columns, as New York writes `Apartment 2` * into both `Building` and `Unit`, so a part that repeats an earlier one is kept once. * * A publisher may also copy the landmark or the street into a unit column, as Oklahoma writes * `RM ENERGY` as both `LandmkName` and `Unit`, and `DAUBE RANCH` as both `St_Name` and `Unit`. * Such a part isn't a unit designator, so it's left out. * * A part holding a digit or a single character is kept even when it equals the street's name, * because `A` on `Avenue A` and `17` on `Highway 17` read as unit designators too. */ export declare function nadUnitText(record: NADRecord): string | null; /** * The house number a NAD record states, read from its own four columns. * * NAD publishes `AddNo_Full` already assembled and its three parts beside it, so this prefers * the assembled column and falls back to joining `AddNum_Pre`, `Add_Number` and `AddNum_Suf`. * The shared `composeHouseNumber` in `#adapters/street/line` joins two columns with one separator. * * It suits a publisher that splits the number in two, and this reader joins three. */ export declare function nadHouseNumber(r: NADRecord): string | null; /** * A NAD street split into the prefix, name and suffix its structured columns state, * with the whole street beside them. */ export interface DecomposedNADStreet { prefix?: string; street?: string; suffix?: string; full: string; } /** * The street a NAD record states. * * Structured street fields take precedence. * If they're empty, `StNam_Full` supplies the whole street. * * A pre-type and its separator open the street name, so `Farm to Market` + `1638` is the street * `Farm to Market 1638`, as USPS Publication 28 lists a numbered road (`COUNTY ROAD 20`, SCHEMA.mdx). * Only the pre-directional is the prefix. */ export declare function decomposeNADStreet(r: NADRecord): DecomposedNADStreet | null; /** * The locality a NAD record states. * * The postal city comes first because it is the name that people write on mail. * NAD fills an unknown `Post_City` with the domain value `Not stated` * (99,998 rows of a 100,000-row Massachusetts sample and 11,713 of a Texas one), and an address * outside any municipality has `Inc_Muni` `Unincorporated` (the same 11,713 Texas rows). * * Another 23 rows of that Texas sample read `0`. * Each of these values counts as absent, and the next column supplies the place name. */ export declare function composeNADLocality(r: NADRecord): string | null; /** * A NAD place-name column's value trimmed, or `null` when it is empty or a placeholder such as `Not stated`. */ export declare function statedNADPlaceName(value: string | null | undefined): string | null; /** * The address components the adapter renders for one NAD record, or `null` * when the record lacks a US state code, a locality or a ZIP Code. */ export declare function nadAddressComponents(record: NADRecord): CanonicalRow["components"] | null; /** * The rendered components with a locality that writes the record's own county moved to `subregion`. * * NAD contributors fill a place column with the county for an address outside any * municipality: Oregon's `Inc_Muni` reads `Polk County` where `County` reads `Polk`, * and Texas's `Post_City` reads `DENTON COUNTY`. * The row's text keeps the county where the locality would be, as * `1 1st Street, Polk County, OR 97347`, and the span is labeled the county it is. * * A place that shares its county's name without a designator (`Denton` in Denton County) stays a locality. */ export declare function nadCountyAsSubregion(components: CanonicalRow["components"], record: Pick): CanonicalRow["components"]; /** * Creates the NAD adapter. * * The adapter skips records without a US state code, locality, or ZIP code. * It also skips rows whose rendering keeps two or fewer components. */ export declare function createUsgovNADAdapter(): CorpusAdapter; /** * The NAD adapter instance that the corpus builder registers. */ export declare const usgovNADAdapter: CorpusAdapter; //# sourceMappingURL=adapter.d.ts.map