Skip to content

Navigation

Connection dataclass

Dataclass supposed to store the data of a single vvs connection

Attributes:

Name Type Description
train_name str

Name of the train

start_location str

Name of the starting location

start_time datetime

Departure time of the train

end_lcocation str

Name of the end location

end_time datetime

Arrival time of the train

MapsTrip dataclass

Dataclass supposed to store the data of a connection retrieved from google maps

Attributes:

Name Type Description
duration int

Duration in minutes

distance int

Distance in meters

MapsTripMode

Bases: str, Enum

Enum for google maps api trip modes

Trip dataclass

Dataclass supposed to store the data of a vvs trip

Attributes:

Name Type Description
duration int

Time needed for the entire trip in minutes

connections list[Connection]

All connections that are part of the trip

get_latest_connection(start_station, end_station, arrival_time)

Provides a trip from the start location to the end location before a deadline

Parameters:

Name Type Description Default
start_station str

VVS-id for starting station

required
end_station str

VVS-id for end station

required
arrival_time datetime

Latest possible time for arrival

required

Returns:

Type Description
Trip | None

An object containing all the information about the trip

get_maps_connection(start_location, end_location, mode)

Provides the distance and duration for a trip with a specific transportation type

Parameters:

Name Type Description Default
start_location str

Name of the location the trip starts

required
end_location str

Name of the location the trip ends

required
mode MapsTripMode

Type of transportation. Possible values: 'driving', 'walking', 'bicycling' or 'transit'

required

Returns:

Type Description
MapsTrip

A MapsTrip object containing the distance and duration of the trip

get_next_connection(start_station, end_station)

Provides the next trip from the start location to the end location

Parameters:

Name Type Description Default
start_station str

VVS-id for starting station

required
end_station str

VVS-id for end station

required

Returns:

Type Description
Trip | None

An object containing all the information about the trip