Dernier recours quand l'adresse exacte est introuvable : placer le Service Location au CENTROÏDE (rqa_addresses) de son code postal (préféré) sinon de sa ville → le job apparaît dans le bon secteur. - Hub : applyAreaFallback() (CTE centroïdes CP/ville, index-friendly) + POST /address/conformity/apply-area. Statut 'area', linked_address '≈ centre <CP/ville>'. Hors-QC/junk (absents de rqa_addresses) restent unmatched. - Ops : carte stat « ≈ Secteur (CP/ville) » + bouton « ≈ Centre CP/ville (reste) » dans la page Conformité. Exécuté : 317 placés (303 par code postal, 14 par ville) → unmatched 365 → 48 (Toronto/boîtes postales/junk). État final : validated 16 257 · review 489 · area 317 · unmatched 48 → 99,7 % des services ont une position. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
30 lines
1.7 KiB
JavaScript
30 lines
1.7 KiB
JavaScript
/**
|
|
* API Conformité des adresses — appelle targo-hub /address/conformity/*.
|
|
* Source de vérité : Service Location (lien AQ local rqa_addresses). Voir services/targo-hub/lib/address-conformity.js.
|
|
*/
|
|
import { HUB_URL as HUB } from 'src/config/hub'
|
|
|
|
async function jget (path) {
|
|
const r = await fetch(HUB + path)
|
|
if (!r.ok) throw new Error('Address API ' + r.status)
|
|
return r.json()
|
|
}
|
|
async function jpost (path, body) {
|
|
const r = await fetch(HUB + path, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body || {}) })
|
|
if (!r.ok) throw new Error('Address API ' + r.status)
|
|
return r.json()
|
|
}
|
|
|
|
export const conformityStats = () => jget('/address/conformity/stats')
|
|
export const conformityList = (p) => jget('/address/conformity/list?' + new URLSearchParams(p).toString())
|
|
export const conformityCandidates = (q) => jget('/address/conformity/candidates?q=' + encodeURIComponent(q))
|
|
// action: approve | correct | gps | reject (+ aq_address_id/linked_address/latitude/longitude selon l'action)
|
|
export const conformityResolve = (body) => jpost('/address/conformity/resolve', body)
|
|
|
|
// ── Registre des campings (géoloc de remplacement fixe par camping) ──
|
|
export const campingsList = () => jget('/address/conformity/campings')
|
|
export const campingsUpsert = (body) => jpost('/address/conformity/campings', body) // {keyword,name,address,latitude,longitude}
|
|
export const campingsApply = () => jpost('/address/conformity/campings/apply', {})
|
|
// Dernier repli : placer les unmatched restants au centre du code postal (sinon ville) → statut 'area'
|
|
export const conformityApplyArea = () => jpost('/address/conformity/apply-area', {})
|