news: per-article proximate geolocation + GET /api/news/blips
Every graded article now carries best-effort geo on article_scores: - parse_map_scores extracts Location/Lat/Lon/Confidence per block (clamp_coords-validated; Unknown -> no geo; never invent a place) - place-name-only blocks resolve via a vendored offline GeoNames gazetteer (cities15000 + admin1 + country->capital), confidence approx - nullable location_name/lat/lon/location_confidence columns (alembic 014, single head; idempotent ensure_tables mirror) + partial bbox index - GET /api/news/blips: frozen contract, dedup by article id (latest geo wins), finite coords only, created_at DESC, bbox/since/limit, default 1000 max 5000, public read like /api/news/map - critical/high map pins, ticker, grading thresholds, dedupe unchanged Tests: 50 new summarizer geo tests (161 total), 18 new blips API contract tests; alembic upgrade heads proven on fresh DBs both start orders; forced batch on test DB yielded 10 non-critical blips with geo. Card: t_bc15eb53
This commit is contained in:
parent
5ea43a3d0b
commit
ca1c73e1a6
16 changed files with 39639 additions and 10 deletions
|
|
@ -314,6 +314,26 @@ class NewsMapItemOut(BaseModel):
|
|||
created_at: datetime
|
||||
|
||||
|
||||
class NewsBlipOut(BaseModel):
|
||||
"""One per-article proximate geo blip as exposed by GET /api/news/blips.
|
||||
|
||||
Frozen wire contract (card t_bc15eb53): every graded article with a
|
||||
derivable location, deduped by article id (latest grading wins).
|
||||
Unlike /api/news/map this is NOT limited to critical/high items.
|
||||
"""
|
||||
id: int
|
||||
headline: str
|
||||
url: Optional[str] = None
|
||||
domain: Optional[str] = None
|
||||
location_name: Optional[str] = None
|
||||
lat: float
|
||||
lon: float
|
||||
location_confidence: Optional[str] = None
|
||||
category: Optional[str] = None
|
||||
score: Optional[int] = None
|
||||
created_at: datetime
|
||||
|
||||
|
||||
class NewsModelId(BaseModel):
|
||||
"""One model id as exposed by GET /api/news/models."""
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue