#25 GRFS export TODOs
All checks were successful
Amarillo/amarillo-gitea/amarillo-core/pipeline/head This commit looks good

This commit is contained in:
Csaba 2024-01-18 14:55:51 +01:00
parent ebbbf28432
commit 25ac460836
3 changed files with 6 additions and 0 deletions

View file

@ -243,6 +243,7 @@ class Agency(BaseModel):
#""" #"""
}) })
# TODO: add driver model class and add it to carpool as an optional field
class Carpool(BaseModel): class Carpool(BaseModel):
id: str = Field( id: str = Field(
description="ID of the carpool. Should be supplied and managed by the " description="ID of the carpool. Should be supplied and managed by the "

View file

@ -1,6 +1,9 @@
from collections import namedtuple from collections import namedtuple
from datetime import timedelta from datetime import timedelta
# TODO: create namedtuples for driver.txt and additional_ridesharing_info.txt
# TODO: add driver_id to GtfsTrip
GtfsFeedInfo = namedtuple('GtfsFeedInfo', 'feed_id feed_publisher_name feed_publisher_url feed_lang feed_version') GtfsFeedInfo = namedtuple('GtfsFeedInfo', 'feed_id feed_publisher_name feed_publisher_url feed_lang feed_version')
GtfsAgency = namedtuple('GtfsAgency', 'agency_id agency_name agency_url agency_timezone agency_lang agency_email') GtfsAgency = namedtuple('GtfsAgency', 'agency_id agency_name agency_url agency_timezone agency_lang agency_email')
GtfsRoute = namedtuple('GtfsRoute', 'agency_id route_id route_long_name route_type route_short_name') GtfsRoute = namedtuple('GtfsRoute', 'agency_id route_id route_long_name route_type route_short_name')

View file

@ -16,6 +16,7 @@ logger = logging.getLogger(__name__)
class Trip: class Trip:
# TODO: add driver attributes, additional ridesharing info
def __init__(self, trip_id, route_name, headsign, url, calendar, departureTime, path, agency, lastUpdated, stop_times, bbox): def __init__(self, trip_id, route_name, headsign, url, calendar, departureTime, path, agency, lastUpdated, stop_times, bbox):
if isinstance(calendar, set): if isinstance(calendar, set):
self.runs_regularly = True self.runs_regularly = True
@ -214,6 +215,7 @@ class TripTransformer:
max([pt[0] for pt in path.coordinates]), max([pt[0] for pt in path.coordinates]),
max([pt[1] for pt in path.coordinates])) max([pt[1] for pt in path.coordinates]))
# TODO: pass driver and ridesharing info object to the Trip constructor
trip = Trip(trip_id, route_name, headsign, str(carpool.deeplink), carpool.departureDate, carpool.departureTime, carpool.path, carpool.agency, carpool.lastUpdated, stop_times, bbox) trip = Trip(trip_id, route_name, headsign, str(carpool.deeplink), carpool.departureDate, carpool.departureTime, carpool.path, carpool.agency, carpool.lastUpdated, stop_times, bbox)
return trip return trip