Jayden Wang

Engineering, 2026

Map apps find the shortest walk. SafePath also finds the safest one. Then it shows you what the safer route costs.

Finished and live: anyone can open the demo and plan a walk. It earned me college credit and a certificate in Penn's ESAP course.

A walking-route planner for the area around Penn. It draws the shortest and the safest route on one map, so you can see for yourself what the safer one costs.

Role
Solo. Final project for the computer course at Penn's Engineering Summer Academy (ESAP). It earned me college credit and a certificate.
My contribution
I built all of it alone: cleaning the city's crime data, the risk score on every street, the routing, the web app, and the checks that guard them.
Built with
Python, Flask, pandas / GeoPandas, NetworkX / OSMnx, SQLite, Folium
Links
  • 10 high-risk blocks on the shortest walk from Penn Park to Mill Creek; the safe route has none
  • 107 m extra walking that costs
  • 106,881 recorded incidents behind the risk score
Map of West Philadelphia with two walking routes from Penn Park to Mill Creek: a dashed blue shortest route and a solid green safest route, over streets shaded orange to red by risk.
Fig 1From Penn Park (green pin) to Mill Creek (red flag). The shortest route is dashed blue; the safest is green. The thick red stretches on the blue line are the high-risk blocks the green route goes around.

Why this project

The first time I was in a foreign city on my own, I picked my walking routes by instinct, and I had no way to tell whether the instinct was any good. Routing apps answer “shortest”. This one also answers “safest”, from the city’s own record of where crime has been reported, and draws both routes on the same map so you can see what the safer one costs.

The routing was the easy part. My first two ways of checking whether it worked were both wrong.

From a spreadsheet to a score on every street

I took the city’s 2024 to 2026 incident files, dropped duplicates and rows with no location, and kept the 3.5 km box around Penn: 397,464 rows became 106,881 incidents. OSMnx gave me the walkable street network for the same box. I attached each incident to the streets near it, scored every street, and routed on the result with NetworkX.

The risk score had been measuring street length

Three comparisons before and after dropping the division by length. The correlation between risk and street length goes from minus 0.719 to plus 0.258. The typical flagged block goes from under 10 meters to 44 meters. Before the fix, 81% of flagged blocks were crossings under 10 meters.
Fig 2The first score mostly measured how short a street is. Flagged means above the ninetieth percentile.

My first score divided each street’s crime weight by its length, which made the most dangerous places in the city three-meter crosswalk stubs. Ranking streets against one another instead fixed it, on the same data.

Two checks that failed in opposite directions

The first check added up the risk along each route and compared the totals. They differed by 1 to 2%, because the risk field is smooth and summing over a whole route washes the difference out.

The second check measured how much longer the safe route is, and it failed the other way. On a grid, moving one street over changes almost every block and barely changes the distance. A route whose blocks were 92% different read as “the same route” because it was only 3.4% longer.

I replaced both with things a person can picture: the number of high-risk blocks on each route, the meters of high-risk street, and how much of the two routes is different. Fig 3 shows three routes under those measures.

Three example routes, shortest against safest. Penn Park to Mill Creek: 10 high-risk blocks drop to 0 for 107 meters more walking. Van Pelt Library to 30th Street Station: 4 drop to 0 for 40 meters more. Market Street to Mantua, which starts inside a hotspot: 115 meters of high-risk street drop to 56 for 304 meters more.
Fig 3Each square is one high-risk block. The last route starts inside a hotspot, so it is measured in meters of high-risk street.
The demo's 'Why this route?' popup for Penn Park to Mill Creek: shortest route 10 high-risk blocks, safest route 0; 92% of segments differ, for 106.6 m more.
Fig 4What the demo tells you after every route: high-risk blocks on each side, and what the detour costs in meters.

Saying when it cannot help

The list of high-risk blocks a route avoids depends on which way you ask: ask the other way and you get the ones the safe route walks into. The demo reports both. When you start inside a hotspot, the safe route can leave five high-risk blocks and enter five others. Then the number that still means something is the meters of high-risk street, 115 down to 56, and the demo says so instead of claiming it avoided five. A self-check locks that in.

The popup once read “Fraud (1850)” over ten blocks. Each incident is attached to every street near it, about 112 streets on average, so adding the counts along a route counted the same incident many times over. It now ranks the incident types by how many flagged blocks list them first, shows no count, and says why.

What the data can’t tell you

The score is built from incidents reported to the police, which is not the same as all crime. Some kinds of crime are reported less often than others, and reporting and policing differ between neighborhoods, so part of a street’s score reflects where reports were made. The red shading on the map shows where incidents were recorded. It says nothing about the people who live on those streets. The demo uses the score for one thing: comparing two routes for a single walk.

Status

Finished and online. Thirteen self-checks run inside the code: no test framework, just the smallest thing that fails if the logic breaks. The demo covers the area around Penn, where the data is.

Skills & tools

Language
Python
Web app
Flask, Folium, SQLite
Data
pandas / GeoPandas
Routing
NetworkX / OSMnx
Method
Percentile-rank normalization, comparing routes by high-risk blocks and high-risk meters