Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea72635bcb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if route == '/api/geo/suspects': | ||
| lat_col = str(payload.get('lat_col', '')).strip() | ||
| lon_col = str(payload.get('lon_col', '')).strip() | ||
| threshold_km = float(payload.get('threshold_km', 25) or 25) |
There was a problem hiding this comment.
Preserve zero threshold values in geo suspects API
The threshold parsing uses float(payload.get('threshold_km', 25) or 25), which treats a valid numeric 0 as falsy and silently replaces it with 25. This changes user-requested behavior: when the client sends threshold_km: 0 (the UI allows this with min="0"), distances below 25 km are not flagged even though the request asked for a zero-distance cutoff.
Useful? React with 👍 / 👎.
Motivation
Description
bitnet_tools/geo.pyimplementingvalidate_lat_lon(lat, lon),haversine_km(...), andflag_geo_suspects(rows, lat_col, lon_col, threshold_km=25)and exposing reason constants (MISSING_OR_NON_NUMERIC,OUT_OF_RANGE,DISTANCE_THRESHOLD_EXCEEDED).bitnet_tools/web.pywith helper functions (_rows_from_csv_text,_build_geojson_feature_collection,_write_geo_suspect_artifacts) and a new endpointPOST /api/geo/suspectsthat accepts column names and threshold and returns counts, inline rows (optional), and artifact paths (CSV/JSON, optional GeoJSON).is_suspect,suspect_reason, anddistance_kmcolumns and persist artifacts under.bitnet_cache/geo_suspects/....bitnet_tools/ui/index.htmland wire frontend logic inbitnet_tools/ui/app.jsto collect parameters and trigger the/api/geo/suspectscall, showing a download/artifact summary without rendering any map tiles.tests/test_geo.pyverifies range checks, Haversine scale, missing/non-numeric handling and distance-threshold behavior;tests/test_web.pyextended with API success/error contract checks for/api/geo/suspects.Testing
pytest -q tests/test_geo.py tests/test_web.py tests/test_ui_contract.pyand all tests passed (20 passed).tests/test_geo.pyand the extended assertions intests/test_web.py.Codex Task