Office geocoding

From leopu00/job-hunter-team · View interactive version

Office geocoding is an AI agent skill from the GitHub repository leopu00/job-hunter-team. Geocode the precise office building (lat/lon/address) for a position AFTER location-enrichment has populated loc_city/loc_country. Use web search aggressively (3+ attempts) to find the company HQ/office address, then resolve coordinates via Nominatim/Photon. Skip ONLY after exhaustive search fails o

How to use this skill

Skill file

office-geocoding — coordinate precise dell'ufficio

Run dopo location-enrichment. Prerequisiti: loc_city e/o

loc_country popolati (da R12-15). Se la position è full-remote senza

city, skip immediato (no office da geocodare).

5 colonne da popolare

office_lat        numeric  latitudine WGS84 (es. 41.8933203)
office_lon        numeric  longitudine WGS84 (es. 12.4829321)
office_address    text     indirizzo completo dell'ufficio
office_geocoded   bool     true se hai eseguito geocoding
office_verified   bool     true se SEI SICURO sia l'ufficio giusto;
                           false se city-level fallback / multi-ambiguo

REGOLA d'oro: web verification obbligatoria

**NON salvare mai un indirizzo street-level senza prima averlo

verificato via web** come ufficio reale della company. La sequenza

corretta è web search PRIMA, geocoding DOPO — non l'inverso.

Sequenza canonica (sempre in quest'ordine)

  1. Tentativo 1 — Web search HQ company nella city

sede <city>", "<Company> office <city>", "<Company> contact"`

LinkedIn "About", Crunchbase, registri d'impresa (partitaiva.it,

cerved.com per IT), Google Maps result della company.

  1. Tentativo 2 — Estrazione da JD

indirizzo nel piè di pagina dello JD.

  1. Tentativo 3 — Webfetch di una sorgente sospetta

WebFetch della pagina ufficiale per estrarre.

  1. Geocoding via Nominatim/Photon SOLO dopo aver trovato

l'indirizzo. Nominatim/Photon convertono testo→coordinate, **non

sono verification**. Niente address da web → niente

office_verified=true.

  1. Fallback city-level quando tutti i tentativi sopra falliscono:

geocoda il nome city (es. "Roma, Italy"), salva con

office_verified=false e office_address = <city>, <country>.

**MAI lasciare NULL se la position ha city/country dal location-

enrichment** — usa il fallback city.

Quando skippa con TUTTO NULL

Solo se la position è full-remote senza loc_city/loc_country (niente

ufficio fisico da geocodare). Vedi sezione "Quando SKIP" sotto.

Precision level: `--location-precision`

office_verified stays, but on its own it is not enough: a city centre saved as an office looks

like an office on the map. Also write the LEVEL, with a single rule (office_verified follows it:

it is true only for address):

| --location-precision | When |

|---|---|

| address | street and house number, verified on the web (the golden rule above) |

| street | the street only, no number: on the map it is a DIFFERENT sign from an address |

| district | the district only |

| city | fallback to the city centre (office_address = <city>, <country>) |

| country | the country only |

Never write address without the house number. When in doubt write the lowest level you can

prove. A level already written does not go down by itself: only whoever says so with

--location-precision changes it.

Quando popolare con `office_verified=true`

Sei veramente sicuro che quell'indirizzo è l'ufficio giusto:

Quando popolare con `office_verified=false`

Hai coordinate ma con incertezza:

in <city>, candidate works from one of them"

Quando SKIP (lascia tutto NULL)

office_lat = NULL
office_lon = NULL
office_address = NULL
office_geocoded = false
office_verified = false

per quella posizione)

Workflow comandi

Step 1 — Web search HQ company

# Cerca la sede principale della company in quella city
# Prova 2-3 query diverse se la prima non chiarisce

Usa il tool WebSearch con query tipo:

Per JD italiane in particolare cerca anche:

infoimprese.it per le aziende italiane

Step 2 — Geocoding via Nominatim (1 req/sec rate limit)

# URL-encode la query
Q=$(jq -nr --arg s "<address found> <city>" '$s | @uri')

python3 /app/shared/skills/safe_fetch.py \
  --user-agent 'jht-analyst/1.0 (+https://github.com/leopu00/job-hunter-team)' \
  "https://nominatim.openstreetmap.org/search?q=${Q}&format=json&limit=1"

Risposta JSON: [{"lat": "...", "lon": "...", "display_name": "..."}].

Estrai lat, lon, display_name (= office_address).

Rate limit: sleep 1.2 sec tra query Nominatim. Se 429: switch a Photon.

Step 3 — Fallback Photon (komoot, no rate limit visibile)

Q=$(jq -nr --arg s "<Company> <City>" '$s | @uri')
python3 /app/shared/skills/safe_fetch.py \
  --user-agent 'jht-analyst/1.0' \
  "https://photon.komoot.io/api?q=${Q}&limit=1"

GeoJSON: features[0].geometry.coordinates = [lon, lat] (NB ordine

invertito! Photon = [lon, lat], Nominatim = {"lat","lon"}).

Step 4 — UPDATE Supabase via wrapper

python3 /app/shared/skills/db_update.py position <ID> \
  --office-lat 41.8933203 \
  --office-lon 12.4829321 \
  --office-address "Via Roma 1, 00100 Roma, Italy" \
  --office-geocoded true \
  --office-verified true \
  --location-precision address \
  --action geocode --outcome updated

--action geocode + --office-geocoded true|false is also the completion

ACK for an on-demand request: db_update.py clears geocode_requested in

the same SQLite transaction as the result. Do not toggle the request by hand.

Care-mode jobs use the same write path but remain selected exclusively by

next-for-geocode-missing and its enrichment-policy gates.

Per skip dopo 3 tentativi:

python3 /app/shared/skills/db_update.py position <ID> \
  --office-geocoded false --office-verified false \
  --action geocode --outcome failed
# (lat/lon/address restano NULL)

Casi tipici risolti

Caso 1 — Company italiana con sede unica chiara

"Bending Spoons" + "Milano"
→ web search: "Bending Spoons via Nino Bonnet 10, 20154 Milano"
→ Nominatim: 45.4870, 9.1908
→ office_address = "Bending Spoons Spa, Via Nino Bonnet, Milano"
→ office_verified = TRUE

Caso 2 — Multi-sede in stessa city (TBD esplicito)

"ION Group" + "Roma" → ha 3 uffici a Roma (Eur, Centro, Tiburtina)
→ JD non specifica quale → office_verified = FALSE
→ Usa coordinata della sede principale (HQ Roma)
→ office_address = "ION Trading Italy, Viale dell'Aeronautica 100, Roma"

Caso 3 — JD include indirizzo nel testo

JD: "...vieni a trovarci in Via Tagliamento 45, Roma..."
→ Estrai direttamente l'indirizzo dal jd_text
→ Geocoda quello → office_verified = TRUE

Caso 4 — Skip per ambiguità

"IBM" + "Roma" + remote-eligible
→ IBM ha 4 sedi a Roma, JD non specifica
→ office_geocoded=true, office_verified=false, coordinata sede HQ Roma
→ location_notes già contiene "IBM Roma multi-sede"

Caso 5 — Skip per full remote

work_mode = remote, loc_city = NULL
→ Position non ha ufficio fisico → tutto NULL
→ office_geocoded = false, office_verified = false

Rate limit policy

Nominatim per i prossimi 5 minuti.

Vietati

ancorato a una fonte web (sito company / LinkedIn / registro

impresa) → rischio di geocodare un nome simile in un'altra città

fallback obbligatorio office_address = "<city>, <country>" con

office_verified=false

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.