fix: géolocalisation Cesium+ — 0 résultats corrigé

- CesiumAdapter : terms query en minuscules (champ title analysé par ES)
- CesiumAdapter : z.coerce.number() pour geoPoint.lat/lon (37% des profils
  stockent les coordonnées en string → ZodError silencieux → 0 géolocalisées)
- CesiumAdapter : clé de la Map en toLowerCase() pour cohérence
- DataService : lookup geoMap par fromName.toLowerCase()

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
syoul
2026-03-22 17:05:04 +01:00
parent 93daec7631
commit 71b457892e
2 changed files with 6 additions and 6 deletions

View File

@@ -48,7 +48,7 @@ async function fetchLiveTransactions(periodDays: number): Promise<{
// Seules les transactions avec un profil géo entrent dans le heatmap
const geolocated: Transaction[] = [];
for (const t of rawTransfers) {
const geo = geoMap.get(t.fromName);
const geo = geoMap.get(t.fromName.toLowerCase());
if (!geo) continue; // pas de profil → exclu du heatmap
geolocated.push({

View File

@@ -27,8 +27,8 @@ const HitSchema = z.object({
title: z.string().optional(),
city: z.string().optional(),
geoPoint: z.object({
lat: z.number().min(-90).max(90),
lon: z.number().min(-180).max(180),
lat: z.coerce.number().min(-90).max(90),
lon: z.coerce.number().min(-180).max(180),
}).optional(),
}),
});
@@ -58,8 +58,8 @@ export async function resolveGeoByNames(
query: {
bool: {
must: [
// Champ "title" analysé (lowercase tokens) — title.keyword retourne 0 résultats
{ terms: { title: unique } },
// Champ "title" analysé (lowercase tokens) — doit envoyer en minuscules
{ terms: { title: unique.map((n) => n.toLowerCase()) } },
],
filter: [
{ exists: { field: 'geoPoint' } },
@@ -86,7 +86,7 @@ export async function resolveGeoByNames(
for (const hit of parsed.hits.hits) {
const src = hit._source;
if (src.geoPoint && src.title) {
result.set(src.title, {
result.set(src.title.toLowerCase(), {
name: src.title,
city: src.city ?? 'Inconnue',
lat: src.geoPoint.lat,