#pairing #nearest-neighbor #geo #geohash #proximity

bin+lib geoprox

A Geo-Proximity detection service for efficient real-time geo-aware contract pairing. Ideal for rideshare pairing services

1 unstable release

0.1.0 May 1, 2024

#2 in #geohash

Download history 119/week @ 2024-04-28 4/week @ 2024-05-05

123 downloads per month

MIT/Apache

22KB
285 lines

GeoProx

A Geo-Proximity detection service for efficient real-time geo-aware contract pairing.

This is a service that allows you to determine which users are nearby a contract and can be applied to applications like Uber, Lyft, Grubhub.

Goals

  • Keep track of approximate location of riders

  • When order is placed should return set of drivers nearby the pickup location

Getting Started

# with cargo
cargo run -- --help

# or if you have just
just run

API Endpoints

Method Endpoint Payload Description
POST /rider/ { uid: number, position: [number, number] } Place rider
DELETE /rider/ { uid: number } Remove rider
POST /search/ { distance: number, position: [number, number] } Search nearby riders

Todos

  • Improve testing coverage

    • Examine potential edge cases (i.e geohash region boundary)
  • Determine horizontal scaling strategy

    • Distributed in-memory cache could work
    • Another idea is distribute state via a consensus algorithm like Raft
    • Long term persistence may be achieved with a NoSQL solution
  • Add gRPC support and OpenAPI spec schema (w/ codegen)

  • Rename semantics to generalize the API conventions

    • "order" to "contract"
    • "rider" to "user"
  • Possibly handle internal queue state for riders (when active and not active)

  • Possibly leverage SSE for place_order in case a rider is not found at first.

Dependencies

~17–48MB
~707K SLoC