80 lines
2.4 KiB
TypeScript
80 lines
2.4 KiB
TypeScript
interface NarFileInfo {
|
|
filename: string;
|
|
fullPath: string;
|
|
sizeBytes: number;
|
|
sizeFormatted: string;
|
|
provinceCode: string;
|
|
provinceName: string;
|
|
provinceAbbr: string;
|
|
type: 'address' | 'location';
|
|
partNumber?: number;
|
|
}
|
|
interface NarDataset {
|
|
provinceCode: string;
|
|
provinceName: string;
|
|
provinceAbbr: string;
|
|
addressFiles: NarFileInfo[];
|
|
locationFiles: NarFileInfo[];
|
|
totalAddressSize: number;
|
|
totalLocationSize: number;
|
|
}
|
|
interface LocationLookup {
|
|
lat: number;
|
|
lng: number;
|
|
fedDistrict?: string;
|
|
fedCode?: string;
|
|
}
|
|
export interface ServerImportOptions {
|
|
provinceCode: string;
|
|
filterType: 'none' | 'city' | 'postalPrefix' | 'cut';
|
|
filterCity?: string;
|
|
filterPostalPrefix?: string;
|
|
cutId?: string;
|
|
residentialOnly: boolean;
|
|
deduplicateRadius: number;
|
|
batchSize: number;
|
|
}
|
|
export interface ServerImportResult {
|
|
provinceCode: string;
|
|
provinceName: string;
|
|
totalRows: number;
|
|
locationsCreated: number;
|
|
addressesCreated: number;
|
|
skippedDuplicate: number;
|
|
skippedOutOfBounds: number;
|
|
skippedNonResidential: number;
|
|
skippedInvalid: number;
|
|
errors: string[];
|
|
durationMs: number;
|
|
}
|
|
export interface ImportProgress {
|
|
status: 'loading-locations' | 'importing' | 'creating-records' | 'complete' | 'failed';
|
|
totalRows: number;
|
|
locationsCreated: number;
|
|
addressesCreated: number;
|
|
skippedDuplicate: number;
|
|
skippedOutOfBounds: number;
|
|
skippedNonResidential: number;
|
|
skippedInvalid: number;
|
|
currentFile: string;
|
|
provinceName: string;
|
|
error?: string;
|
|
result?: ServerImportResult;
|
|
}
|
|
export declare function writeProgress(importId: string, progress: ImportProgress): Promise<void>;
|
|
export declare const narImportService: {
|
|
/** List available NAR datasets grouped by province */
|
|
listDatasets(): Promise<{
|
|
narDir: string | null;
|
|
datasets: NarDataset[];
|
|
}>;
|
|
/**
|
|
* Load Location file(s) into a lookup Map for a given province.
|
|
* Returns Map<LOC_GUID, { lat, lng, fedDistrict, fedCode }>.
|
|
*/
|
|
loadLocationLookup(locationFiles: NarFileInfo[]): Promise<Map<string, LocationLookup>>;
|
|
/** Import a province's NAR data using Location+Address file join */
|
|
importProvince(userId: string, options: ServerImportOptions, importId?: string): Promise<ServerImportResult>;
|
|
};
|
|
export {};
|
|
//# sourceMappingURL=nar-import.service.d.ts.map
|