{"slug": "smogcheck-offline", "title": "SmogCheck - offline", "summary": "A developer built SmogCheck, an offline walking-route planner for Lahore's smog season that uses OpenStreetMap data and a local Ollama tool-calling agent to steer pedestrians away from major traffic arteries. In a 2.5 km test radius around Gulberg, the planner cut time on arterial roads from 61% to 10% on a 4,653 m route versus the 3,537 m shortest path, and found a 3,457 m park loop with 17% on major roads. The system runs entirely on a laptop with Wi-Fi off, using road class and park proximity as exposure proxies rather than live air-quality data.", "body_md": "*This is a submission for the [Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass](https://dev.to/challenges/hacktoberfest-week1-2026-10-05)*\n\n**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.\n\nDuring 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.\n\nAn 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.\n\n**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.\n\nHow 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.]\n\n[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.]\n\nOne real result from my test area (a 2.5 km radius around Gulberg):\n\n| Route | Distance | On major roads | \n|---|---|---|\n| Shortest path | 3,537 m | **61%** | \n| SmogCheck | 4,653 m | **10%** | \n\nAbout 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.\n\n[FILL IN: screenshot of the red (shortest) vs blue (SmogCheck) map.]\n\n[FILL IN: embed your GitHub repo here, e.g. `{% embed https://github.com/algo-abdullah/smog-check %}`]\n\n```\nsmogcheck/\n├── data prep      # download + save the OSM graph, parks, trees\n├── score.py       # exposure-based edge costs\n├── parks.py       # park-loop generator\n└── agent.py       # Ollama tool-calling agent\n```\n\n**Open-source pieces**\n\n**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.\n\n**The scoring.** Every street segment gets a cost. Lower cost means a better route:\n\n```\nedges[\"cost\"] = edges[\"length\"] * (\n    1 + 2.0 * edges[\"major\"]            # penalize primary/secondary roads\n      - 0.8 * edges[\"park_frac\"]        # reward segments inside parks\n      - 0.1 * (edges[\"trees\"] / 5).clip(upper=1)   # small bonus for nearby trees\n)\n```\n\nThen plain Dijkstra over `cost` instead of `length`.\n\n**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.\n\n**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.\n\n**What went wrong**\n\n`llama-server`), and a clean reinstall solved it.\n[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.]\n\n[FILL IN: list any partner categories from the challenge page that apply, or delete this section.]", "url": "https://wpnews.pro/news/smogcheck-offline", "canonical_source": "https://dev.to/abdullah_amin_0019da25f92/smogcheck-offline-68a", "published_at": "2026-10-11 07:45:04+00:00", "updated_at": "2026-10-11 07:51:30.867892+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "artificial-intelligence", "large-language-models"], "entities": ["SmogCheck", "Lahore", "Gulberg", "OpenStreetMap", "Ollama", "llama-server", "GitHub"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/smogcheck-offline", "markdown": "https://wpnews.pro/news/smogcheck-offline.md", "text": "https://wpnews.pro/news/smogcheck-offline.txt", "jsonld": "https://wpnews.pro/news/smogcheck-offline.jsonld"}}