spb/datacenterindex
Public
HTML 53.9%
TypeScript 44.5%
JavaScript 0.6%
SQL 0.5%
1/**2 * Boundary between the crawl runtime (context, documents, scheduling) and the ingest layer3 * (reconciliation, persistence, provenance, events). Both sides implement against this file.4 */5import type { NormalizedEntity, DetectedChange } from "@dci/core";67export interface IngestRun {8 connectorId: string;9 sourceId: string;10 runId: string;11 sourceKind: string;12 sourcePriority: number;13 dryRun: boolean;14}1516export interface IngestDocRef {17 documentId: string;18 url: string;19 pageType: string;20 fetchedAt: string;21}2223export interface IngestStats {24 received: number;25 created: number;26 updated: number;27 unchanged: number;28 merged: number;29 pendingMatches: number;30 rejected: number;31 events: number;32 provenanceRows: number;33 byType: Record<string, number>;34 changes: DetectedChange[];35 /** entity ids touched: [{type,id}] for documents.entity_refs */36 refs: Array<{ type: string; id: string }>;37 /** data-quality counters (optional, additive): operators inferred from a canonical name prefix */38 inferredOperators?: number;39 /** coordinates dropped because the point lies in another country than the one the source states */40 geoCountryMismatch?: number;41 /** field values kept in provenance but not written to a column (e.g. pre-1980 opening dates from OSM) */42 implausibleDropped?: number;43 /** projects folded into an already-known announcement (same operator, city, MW ±10 %, within 30 days) */44 projectDedup?: number;45 /** claims rows written */46 claims?: number;47 /** quality flags written */48 qualityFlags?: number;49 /** figures kept as claims but not assigned to a column (portfolio / company / unknown scope, market statistics) */50 unscopedClaims?: number;51 /** project candidates vetoed by the announcement classifier (appointments, financing, PPAs, market research…) */52 projectsVetoed?: number;53 /** building records linked to their campus record instead of being flagged as duplicates */54 campusLinks?: number;55 /** hidden projects restored because a re-extraction qualified them again */56 projectsRequalified?: number;57}5859export type IngestFn = (run: IngestRun, entities: NormalizedEntity[], doc: IngestDocRef | null) => Promise<IngestStats>;60