This is a submission for the Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass
SmogCheck is an offline walking-route planner for Lahore's smog season. You ask it, in plain English, something like "Where can I take a 3 km walk from Gulberg?", and it plans a loop that stays off the big traffic arteries and goes through a park.
During peak smog, the usual advice is "stay indoors", but people still need to walk, and the default route from any maps app is the shortest one, which usually runs along Main Boulevard or Ferozepur Road. SmogCheck picks quieter streets and parks instead, and the whole thing runs on my laptop with Wi-Fi off.
An honest note on what it does not do: it has no live air-quality data. Offline, that isn't available. It uses proxies for exposure: road class (primary and secondary roads are penalized) and proximity to parks and mapped trees. I'd rather call it a "low-exposure route finder" than pretend it measures clean air.
Who it's for: anyone in Lahore who wants to walk or run during smog season without sending their daily routes to a cloud service.
How it gets people outside: the screen part is a single question and a map. The rest of the experience is the walk. [FILL IN: one line about where you walked.]
[FILL IN: link to a short screen recording, made with Wi-Fi off. Show: the question typed in, the answer, and result.html opening with the route.]
One real result from my test area (a 2.5 km radius around Gulberg):
| Route | Distance | On major roads |
|---|---|---|
| Shortest path | 3,537 m | 61% |
| SmogCheck | 4,653 m | 10% |
About 1.1 km of extra walking for an 84% cut in time spent on arterial roads. For the loop query, the planner found a 3,457 m round trip with 17% on major roads, through a 12.5 ha park.
[FILL IN: screenshot of the red (shortest) vs blue (SmogCheck) map.]
[FILL IN: embed your GitHub repo here, e.g. {% embed https://github.com/algo-abdullah/smog-check %}]
smogcheck/
βββ data prep # download + save the OSM graph, parks, trees
βββ score.py # exposure-based edge costs
βββ parks.py # park-loop generator
βββ agent.py # Ollama tool-calling agent
Open-source pieces
The data. I downloaded OpenStreetMap data once for a 2.5 km radius around Gulberg: a walking graph (5,327 nodes, 14,546 street segments), 77 park polygons and 222 mapped trees. After that, everything is saved locally.
The scoring. Every street segment gets a cost. Lower cost means a better route:
edges["cost"] = edges["length"] * (
1 + 2.0 * edges["major"] # penalize primary/secondary roads
- 0.8 * edges["park_frac"] # reward segments inside parks
- 0.1 * (edges["trees"] / 5).clip(upper=1) # small bonus for nearby trees
)
Then plain Dijkstra over cost instead of length.
The loop finder. My first idea was to reward park segments in the cost function. It barely worked, because OSM has few mapped footpaths inside Lahore's parks (only 274 of 14,546 segments touch a park). So instead, the loop planner treats parks as destinations: it routes to each park, comes back by a different path (reusing the outbound streets costs 3x), and picks the one closest to the requested distance.
The AI part. The model doesn't do any routing. A 3B model is bad at geometry, so I gave it two tools, plan_route and plan_park_loop. The model reads the question, picks a tool and its arguments, and then explains the result. The routing stays deterministic and testable.
What went wrong
llama-server), and a clean reinstall solved it.
[FILL IN. This is the part judges look for. Suggestions: where you started, what time of day, how long it took, how the route felt compared with the main road, any place where the map was wrong (a closed gate, a missing path, a street that turned out to be busy), and 2-3 photos.]
[FILL IN: list any partner categories from the challenge page that apply, or delete this section.]