perf: reverse enrichment order — direct parcel details first, skip immApps

- fetchImmovableParcelDetails called FIRST (1 call, no applicationId needed)
- app-based fetchParcelFolosinte only as fallback when direct returns nothing
- SOLICITANT skipped entirely (was always '-' for old CF records)
- Remove unused pickApplication helper
- Net savings: ~500+ API calls per UAT enrichment (50-65% reduction)
- copycf/get returns same data as list (no enrichment value, kept as utility)
This commit is contained in:
AI Assistant
2026-03-08 01:15:28 +02:00
parent aee28b6768
commit bcc7a54325
3 changed files with 60 additions and 77 deletions
@@ -483,14 +483,19 @@ export async function syncNoGeometryParcels(
const cadRef = (item.identifierDetails ?? "").toString().trim();
const hasPaperLb = !!(item.paperLbNo ?? "").toString().trim();
const hasPaperCad = !!(item.paperCadNo ?? "").toString().trim();
const hasLandbook = typeof item.hasLandbook === "number" ? item.hasLandbook : 0;
const hasLandbook =
typeof item.hasLandbook === "number" ? item.hasLandbook : 0;
const hasArea =
(typeof item.measuredArea === "number" && item.measuredArea > 0) ||
(typeof item.legalArea === "number" && item.legalArea > 0);
const hasIdentification = !!cadRef || hasPaperLb || hasPaperCad;
// Only keep items that pass the quality gate (active + hasLandbook + identification/area)
if (status === 1 && hasLandbook === 1 && (hasIdentification || hasArea)) {
if (
status === 1 &&
hasLandbook === 1 &&
(hasIdentification || hasArea)
) {
validImmPks.add(pk);
}
}
@@ -556,7 +561,8 @@ export async function syncNoGeometryParcels(
}
// Quality gate 2: must be an electronic immovable (hasLandbook=1)
const hasLandbook = typeof item.hasLandbook === "number" ? item.hasLandbook : 0;
const hasLandbook =
typeof item.hasLandbook === "number" ? item.hasLandbook : 0;
if (hasLandbook !== 1) {
filteredOut++;
return false;