mirror of
https://github.com/zvx-echo6/recon.git
synced 2026-06-10 08:54:34 +02:00
Per-tag HTTP wrapper over wiki_rewrite.rewrite_wiki_link so the (future) navi-places service can rewrite OSM wiki tags to local Kiwix URLs over HTTP instead of importing recon's wiki_rewrite module (which talks to Kiwix on localhost:8430 and the wiki_cache table in /opt/recon/data/place_cache.db). Companion to PR #8 (/api/wiki-enrich) — Matt picked option B (HTTP-couple the Kiwix offline-wiki rewriting too, since it matters in prod). GET /api/wiki-rewrite?tag=<wikipedia|wikidata|wikivoyage|appropedia>&value=<raw> -> 200 {url, status} where status is "local" | "public" | "original" -> 400 on missing value or unknown tag -> no 404 (unclassifiable value echoes back with status "original", mirroring rewrite_wiki_link) Public (no auth), like /api/place/* and /api/wiki-enrich. Changes (additive only): - lib/wiki_rewrite_api.py: new wiki_rewrite_bp blueprint. Thin route directly over the existing rewrite_wiki_link(tag, value) — no extraction needed (it's already a clean standalone function, unlike wiki-enrich's lookup). - lib/api.py: register the blueprint (one block). - lib/wiki_rewrite_api_test.py: 5 tests (local Kiwix hit, public fallback, unclassifiable -> original, missing value -> 400, unknown tag -> 400), stubbing check_kiwix_has_article (no Kiwix/DB), plain-assert + __main__ runner. Verified green against recon's venv (flask 3.1.2). Does NOT touch place_detail's in-process _enrich_wiki_links — that gets removed in a later PR once navi-places is live (same as PR #8). wiki_cache stays in recon's own place_cache.db post-cutover (harmless positive-cache duplication). Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| acquisition | ||
| offroute | ||
| processors | ||
| __init__.py | ||
| address_book.py | ||
| address_book_api.py | ||
| address_book_test.py | ||
| api.py | ||
| api_keys_admin.py | ||
| aurora_nav_tool.py | ||
| auth.py | ||
| contacts.py | ||
| contacts_api.py | ||
| deployment_config.py | ||
| dispatcher.py | ||
| embedder.py | ||
| enricher.py | ||
| extractor.py | ||
| filing.py | ||
| geocode.py | ||
| geocode_test.py | ||
| google_places.py | ||
| ingester.py | ||
| key_manager.py | ||
| landclass.py | ||
| landclass_test.py | ||
| nav_tools.py | ||
| nav_tools_test.py | ||
| netsyms.py | ||
| netsyms_api.py | ||
| netsyms_test.py | ||
| new_pipeline.py | ||
| organizer.py | ||
| osm_categories.py | ||
| overture.py | ||
| peertube_collector.py | ||
| peertube_scraper.py | ||
| place_detail.py | ||
| query_router.py | ||
| query_router_test.py | ||
| reverse_bundle_test.py | ||
| scraper_runner.py | ||
| status.py | ||
| utils.py | ||
| web_scraper.py | ||
| wiki_enrich_api.py | ||
| wiki_enrich_api_test.py | ||
| wiki_rewrite.py | ||
| wiki_rewrite_api.py | ||
| wiki_rewrite_api_test.py | ||
| zim_monitor.py | ||