fix: scan math consistency + stale enrichment detection + re-enrichment
- withGeometry = matched immovable count (not GIS feature count) — numbers always add up - Added remoteGisCount to show raw GIS layer count separately - Enrichment completeness check: ENRICHMENT_REQUIRED_KEYS 7-field schema - localDbEnrichedComplete vs localDbEnriched detects stale enrichment - UI: orange warning when enrichment incomplete (missing PROPRIETARI_VECHI) - UI: workflow preview uses enrichedComplete for accurate time estimate - UI: note when GIS feature count differs from matched immovable count - enrich-service: re-enriches features with incomplete schema instead of skipping
This commit is contained in:
@@ -171,6 +171,7 @@ export async function enrichFeatures(
|
||||
attributes: true,
|
||||
cadastralRef: true,
|
||||
enrichedAt: true,
|
||||
enrichment: true,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -400,17 +401,34 @@ export async function enrichFeatures(
|
||||
const feature = terenuri[index]!;
|
||||
const attrs = feature.attributes as Record<string, unknown>;
|
||||
|
||||
// Skip features already enriched (resume after crash/interruption)
|
||||
// Skip features with complete enrichment (resume after crash/interruption).
|
||||
// Re-enrich if enrichment schema is incomplete (e.g., missing PROPRIETARI_VECHI
|
||||
// added in a later version).
|
||||
if (feature.enrichedAt != null) {
|
||||
enrichedCount += 1;
|
||||
if (index % 50 === 0) {
|
||||
options?.onProgress?.(
|
||||
index + 1,
|
||||
terenuri.length,
|
||||
"Îmbogățire parcele (skip enriched)",
|
||||
);
|
||||
const enrichJson = feature.enrichment as Record<string, unknown> | null;
|
||||
const isComplete =
|
||||
enrichJson != null &&
|
||||
[
|
||||
"NR_CAD",
|
||||
"NR_CF",
|
||||
"PROPRIETARI",
|
||||
"PROPRIETARI_VECHI",
|
||||
"ADRESA",
|
||||
"CATEGORIE_FOLOSINTA",
|
||||
"HAS_BUILDING",
|
||||
].every((k) => k in enrichJson && enrichJson[k] !== undefined);
|
||||
if (isComplete) {
|
||||
enrichedCount += 1;
|
||||
if (index % 50 === 0) {
|
||||
options?.onProgress?.(
|
||||
index + 1,
|
||||
terenuri.length,
|
||||
"Îmbogățire parcele (skip enriched)",
|
||||
);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
// Stale enrichment — will be re-enriched below
|
||||
}
|
||||
|
||||
const immovableId = attrs.IMMOVABLE_ID ?? "";
|
||||
|
||||
Reference in New Issue
Block a user