import { type PathBuilderLike } from "path-ts"; import { type SplitStreetLine } from "#adapters/street/line"; import { type UnitSplitter } from "#adapters/street/unit"; import { type CanonicalRow, type CorpusAdapter } from "#types"; /** * Registry id for this adapter. * * Stamped into every row it emits, so a corpus record can be traced back to the dataset it came from. */ export declare const CORDIS_ADAPTER_ID = "cordis"; /** * The license the CORDIS legal notice states for content the EU owns. */ export declare const CORDIS_LICENSE = "CC-BY-4.0"; /** * The credit CC BY 4.0 obliges. * * The model card prints it beside the license and a statement that the data was changed. */ export declare const CORDIS_ATTRIBUTION = "\u00A9 European Union, CORDIS (Publications Office of the European Union)"; /** * The archive member that holds the participants in every programme's CSV zip. */ export declare const CORDIS_ORGANIZATION_MEMBER = "organization.csv"; /** * The columns the adapter indexes by the publisher's own spelling. * * Checked against the first record, so a renamed column raises instead of * reaching every row as an empty string. */ export declare const CORDIS_REQUIRED_COLUMNS: readonly string[]; /** * The two places CORDIS's EU country codes differ from ISO 3166-1 alpha-2. */ export declare const CORDIS_COUNTRY_ALIASES: Readonly>; /** * Why a published record didn't become a row. */ export declare const CORDISRefusal: { /** * `country` isn't an ISO 3166-1 alpha-2 code once `EL` and `UK` are mapped. */ readonly CountryNotISO: "country-not-iso"; /** * Codex has no layout for the country, so no rendering states where each component goes. */ readonly CountryNoLayout: "country-no-layout"; /** * Every word of the name is a personal name. */ readonly NamePersonalWords: "name-personal-words"; /** * The name takes the participant register's `SURNAME Given` casing. */ readonly NamePersonalCasing: "name-personal-casing"; /** * The name or short name holds a sole-trader legal form. */ readonly NameSoleTrader: "name-sole-trader"; /** * The record states no city. */ readonly LocalityAbsent: "locality-absent"; /** * The street line holds a digit and no house number could be split off on the country's side. */ readonly StreetNumberUnplaced: "street-number-unplaced"; /** * A house number was split off, and the street that remains still holds a digit. */ readonly StreetDigitInRemainder: "street-digit-in-remainder"; /** * Beside the locality, the record holds neither a street nor a postcode. */ readonly ComponentsTooFew: "components-too-few"; /** * The components do not render in the country's layout. */ readonly Unrenderable: "unrenderable"; }; /** * One of the {@link CORDISRefusal} reasons. */ export type CORDISRefusal = (typeof CORDISRefusal)[keyof typeof CORDISRefusal]; /** * What one published record yielded. * * `discarded` lists the `component::` keys of values kept out of an admitted row. */ export type CORDISReading = { readonly admitted: CanonicalRow; readonly discarded: readonly string[]; } | { readonly refused: CORDISRefusal; readonly country: string | null; }; /** * The columns of one `organization.csv` record the adapter reads. */ export interface CORDISOrganizationRecord { organisationID?: string; name?: string; shortName?: string; activityType?: string; SME?: string; vatNumber?: string; street?: string; postCode?: string; city?: string; country?: string; nutsCode?: string; } /** * The given names and surnames the personal-name rules consult, lower-cased. */ export interface PersonNameLexicon { readonly givenNames: ReadonlySet; readonly surnames: ReadonlySet; } /** * Load libpostal's language-independent given-name and surname dictionaries. */ export declare function loadPersonNameLexicon(): Promise; /** * Which side of the street name a country writes the house number on. */ export declare const StreetOrder: { readonly NumberFirst: "number-first"; readonly NumberLast: "number-last"; }; /** * One of the {@link StreetOrder} values. */ export type StreetOrder = (typeof StreetOrder)[keyof typeof StreetOrder]; /** * The side a country writes its house number on, or `null` where codex's sources disagree or state none. * * Read from the `house-number-precedes-street` claim. * That claim collects libaddressinput's `fmt` and `lfmt`, the OpenCage street order, * the board's hand-authored layout and a retrieved UPU S42 template. * * A side is returned only when at least one source states it and none states the other. * * Hong Kong's Chinese-script `fmt` writes the number after the street * and its Latin `lfmt` before it, so Hong Kong has no side. */ export declare function streetOrderForCountry(country: string): StreetOrder | null; /** * Whether a published value is a placeholder for an absent one, or holds no letter and no digit. */ export declare function isCORDISPlaceholder(value: string): boolean; /** * The personal-name form a participant's name takes, or `null` where it takes none. * * Exported so a test and a measurement can read the rule the adapter applies rather than a copy of it. */ export declare function naturalPersonForm(name: string, shortName: string, lexicon: PersonNameLexicon): CORDISRefusal | null; /** * The street line split on the side the country writes its number, or the refusal the line meets. * * `order` is `null` for a country with no unambiguous side, and such a line * is kept only where it holds no digit. * In a `country` that writes a repetition index, `20 BIS RUE LOUIS PHILIPPE` yields the house number * `20 BIS` and the street `RUE LOUIS PHILIPPE`, as {@linkcode joinRepetitionIndex} reads it. */ export declare function splitCORDISStreetLine(line: string, order: StreetOrder | null, country?: string): SplitStreetLine | { refused: CORDISRefusal; } | null; /** * The ISO 3166-1 alpha-2 code for a CORDIS `country` value, or `null` for one that maps to none. */ export declare function cordisCountryCode(value: string | null | undefined): string | null; /** * Read one published record into a row, or report why it yielded none. * * Exported because the refusal reasons are the measurement this adapter is checked by. */ export declare function readCORDISRecord(record: CORDISOrganizationRecord, lexicon: PersonNameLexicon, units: UnitSplitter): CORDISReading; /** * One distinct published record and what it yielded. */ export interface CORDISRecordReading { readonly record: CORDISOrganizationRecord; readonly reading: CORDISReading; } /** * Every distinct published record under `inputPath`, read once each. * * A record is distinct on the five fields that reach a row, so an organization that took part in several * projects with one address is read once, and one whose address changed is read once per version. * `onDuplicate` is called once for every participation row a record already read covers. * * The adapter and the measurement both read through this, so the counts a * measurement reports are the adapter's own. */ export declare function readCORDISRecords(inputPath: PathBuilderLike, lexicon: PersonNameLexicon, options?: { signal?: AbortSignal; onDuplicate?: () => void; onUnbalancedQuote?: () => void; streetIndex?: PathBuilderLike | null; }): AsyncGenerator; export declare function createCORDISAdapter(): CorpusAdapter; /** * The configured adapter instance registered with the corpus builder. */ export declare const cordisAdapter: CorpusAdapter; //# sourceMappingURL=adapter.d.ts.map