Skip to content

Commit

Permalink
fix incorrect type for direction id, write pseudocode for direction id
Browse files Browse the repository at this point in the history
  • Loading branch information
kylerchin committed Apr 7, 2024
1 parent e97e896 commit 7f872f7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
33 changes: 33 additions & 0 deletions algo-for-fetching-departures-for-stop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
- for stop id, fetch all the stops

```rs
fn get_departures(stop_id: String, chateau: String) -> DepartureBoard {}
```

```rs
struct DepartureBoard {
updated_time_ms: u64,
departures: Vec<DeparturesPerRoute>>
}

struct DeparturesPerRoute {
route_id: String,
chateau: String,
//headsign -> Sorted Vec of Departures
directions: BTreeMap<String, Vec<DepartureArrivalEvent>>
}

struct DepartureArrivalEvent {
stop_id: String,
stop_location: geo::Point,
stop_code: String,
scheduled_departure_time_s: Option<u64>,
//optional if the service is the last stop
scheduled_arrival_time_s: Option<u64>,
actual_departure_time_s: Option<u64>,
actual_arrival_time_s: Option<u64>,
has_realtime: bool,
trip: gtfs_rt::TripDescriptor,
is_frequency: bool,
}
```
2 changes: 1 addition & 1 deletion src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub struct CompressedTrip {
attempt_id: String,
service_id: String,
trip_short_name: Option<String>,
direction_id: Option<i16>,
direction_id: Option<bool>,
block_id: String,
wheelchair_accessible: i16,
bikes_allowed: i16,
Expand Down

0 comments on commit 7f872f7

Please sign in to comment.