Skip to content

Instantly share code, notes, and snippets.

@bertt
Created May 6, 2026 17:01
Show Gist options
  • Select an option

  • Save bertt/38698eb13fa220edf6574a56df9b3fb1 to your computer and use it in GitHub Desktop.

Select an option

Save bertt/38698eb13fa220edf6574a56df9b3fb1 to your computer and use it in GitHub Desktop.
gtfs datamodel
```mermaid
erDiagram
AGENCY {
string agency_id PK
string agency_name
string agency_url
}
ROUTES {
string route_id PK
string agency_id FK
string route_short_name
string route_type
}
TRIPS {
string trip_id PK
string route_id FK
string service_id FK
string shape_id FK
}
STOP_TIMES {
string trip_id FK
string stop_id FK
int stop_sequence PK
string arrival_time
string departure_time
}
STOPS {
string stop_id PK
string stop_name
float stop_lat
float stop_lon
string parent_station FK
}
CALENDAR {
string service_id PK
int monday
int tuesday
int wednesday
int thursday
int friday
}
%% RELATIES
AGENCY ||--o{ ROUTES : has
ROUTES ||--o{ TRIPS : has
TRIPS ||--o{ STOP_TIMES : contains
STOPS ||--o{ STOP_TIMES : used_in
TRIPS }o--|| CALENDAR : runs_on
STOPS ||--o{ STOPS : parent_of
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment