Technical Overview
PathPay intentionally keeps a compact architecture: one primary CLI file plus a map-enabled variant. This section highlights the main components and data flow.
High-level architecture
CSV ingestion –
load_and_prepareconcatenates every file passed via--csv/--csv_dirand filters rows to Gwangjin/Songpa.Geocoding –
ensure_geocodeskeeps existinglat/lonvalues and calls Kakao Local for the missing ones.Candidate preselection –
preselect_candidateskeeps stations that lie within ~1 km of the straight-line path and sorts by price and proximity.Cost evaluation –
evaluate_total_costcompares the baseline route against the detour using Kakao Mobility Directions to compute distance/time deltas and monetary impact.Presentation – Results are sorted by effective price and printed, and a Kakao Map deeplink is generated for the best choice. The map variant can also produce Folium HTML visualizations.
Key modules
fuel_route_recommender.pyParses CLI arguments and orchestrates the run.
Loads and filters CSVs for Gwangjin/Songpa.
Geocodes stations if latitude/longitude is missing.
Calls Kakao Mobility for baseline and detour routes.
Calculates total cost, effective price, and prints the top 3 results.
fuel_route_recommender_with_map.pyExtends the base logic with
--save_mapto render Folium maps.Adds markers for origin, destination, and top 3 stations and draws simple polylines (straight lines, not polyline traces from Directions).
Technologies
Python Standard Library – Argument parsing, math utilities, filesystem access, rate limiting via
time.sleep.Pandas – Concatenating and cleaning CSVs, numeric conversion, and sorting candidates.
Requests – HTTP calls to Kakao Local and Mobility REST APIs.
Folium (optional) – Static HTML map generation.
API integrations
Kakao Local Search –
/v2/local/search/address.jsonservice used to convert textual addresses into WGS84 coordinates.Kakao Mobility Directions –
/v1/directionsendpoint used twice per station: once for the baseline route (origin → destination) and once for the detour (origin → station → destination).Kakao Map Deeplink – Simple
https://map.kakao.com/link/to/...URLs so users can open the recommended stopover directly in the Kakao Map app.
Extensibility hooks
Broader geography – Modify
load_and_prepareto adjust the지역filter and optionally bring in additional CSV columns.Alternative routing – Swap out Kakao Mobility with another routing provider by implementing equivalents of
route_distance_timeandroute_via_distance_time.Web UI – Expose the same calculations via FastAPI or Django if you need a hosted experience. The CLI’s calculation routines are reusable from other entry points.