Add place detail proxy with Nominatim-first routing and Overpass fallback

New /api/place/<osm_type>/<osm_id> endpoint returns cleaned OSM tag data
for PlaceDetail panel enrichment. Routes to local Nominatim (Idaho coverage)
first, falls back to Overpass public API for out-of-region queries. Responses
cached in SQLite (data/place_cache.db) with no expiry.

New modules: lib/place_detail.py (proxy + cache), lib/osm_categories.py
(~50 category humanization mappings). Profile YAMLs updated with
place_details config block and has_nominatim_details flag.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Matt 2026-04-21 03:06:51 +00:00
commit 2121ee4936
5 changed files with 574 additions and 2 deletions

View file

@ -25,6 +25,7 @@ from werkzeug.utils import secure_filename
from .utils import get_config, content_hash, clean_filename_to_title, derive_source_and_category, generate_download_url, setup_logging
from .status import StatusDB
from .deployment_config import get_deployment_config
from .place_detail import get_place_detail
logger = setup_logging('recon.api')
@ -1186,6 +1187,13 @@ def api_traffic_flow(z, x, y):
return 'Upstream timeout', 504
@app.route('/api/place/<osm_type>/<int:osm_id>')
def api_place_detail(osm_type, osm_id):
"""Proxy place details from local Nominatim or Overpass API."""
result, status = get_place_detail(osm_type, osm_id)
return jsonify(result), status
@app.route('/api/config')
def api_config():
"""Return deployment profile config for frontend consumption."""