from jormungandr.timezone import set_request_timezone from jormungandr.interfaces.v1.errors import ManageError from jormungandr.utils import date_to_timestamp from jormungandr.interfaces.parsers import UnsignedInteger from jormungandr.interfaces.v1.journey_common import JourneyCommon from jormungandr.interfaces.v1.fields import DateTime from jormungandr.interfaces.v1.serializer.api import GraphicalIsrochoneSerializer from jormungandr.interfaces.v1.decorators import get_serializer graphical_isochrone = { "geojson": JsonString(), "max_duration": fields.Integer(), "min_duration": fields.Integer(), 'from': PbField(place, attribute='origin'), "to": PbField(place, attribute="destination"), 'requested_date_time': DateTime(), 'min_date_time': DateTime(), 'max_date_time': DateTime() } graphical_isochrones = { "isochrones": NonNullList(NonNullNested(graphical_isochrone), attribute="graphical_isochrones"), "error": PbField(error, attribute='error'), "feed_publishers": fields.List(NonNullNested(feed_publisher)), "links": fields.List(Links()), "warnings": ListLit([fields.Nested(beta_endpoint)]), 'context': context }
Links, JsonString, place,\ ListLit, beta_endpoint, feed_publisher from jormungandr.timezone import set_request_timezone from jormungandr.interfaces.v1.errors import ManageError from jormungandr.utils import date_to_timestamp from jormungandr.interfaces.parsers import UnsignedInteger from jormungandr.interfaces.v1.journey_common import JourneyCommon from jormungandr.interfaces.v1.fields import DateTime, context from jormungandr.interfaces.v1.serializer.api import HeatMapSerializer from jormungandr.interfaces.v1.decorators import get_serializer heat_map = { "heat_matrix": JsonString(), 'from': PbField(place, attribute='origin'), "to": PbField(place, attribute="destination"), 'requested_date_time': DateTime() } heat_maps = { "heat_maps": NonNullList(NonNullNested(heat_map)), "error": PbField(error, attribute='error'), "links": fields.List(Links()), "warnings": ListLit([fields.Nested(beta_endpoint)]), "feed_publishers": fields.List(NonNullNested(feed_publisher)), "context": context } class HeatMap(JourneyCommon):
"geojson": SectionGeoJson(), "path": NonNullList(NonNullNested({ "length": fields.Integer(), "name": fields.String(), "duration": fields.Integer(), "direction": fields.Integer() }), attribute="street_network.path_items"), "transfer_type": enum_type(), "stop_date_times": NonNullList(NonNullNested(stop_date_time)), "departure_date_time": DateTime(attribute="begin_date_time"), "base_departure_date_time": DateTime(attribute="base_begin_date_time"), "arrival_date_time": DateTime(attribute="end_date_time"), "base_arrival_date_time": DateTime(attribute="base_end_date_time"), "co2_emission": Co2Emission(), } cost = { 'value': fields.String(), 'currency': fields.String(), }
return i_manager.dispatch(args, self.endpoint, instance_name=self.region) class date_time_links(fields.Raw): def output(self, key, obj): disruption_links = [create_internal_link(_type="disruption", rel="disruptions", id=uri) for uri in obj.impact_uris] properties_links = pt.make_properties_links(obj.properties) return properties_links + disruption_links date_time = { "date_time": SplitDateTime(date='date', time='time'), "base_date_time": DateTime(), "additional_informations": additional_informations(), "links": date_time_links(), 'data_freshness': enum_type(attribute='realtime_level'), } row = { "stop_point": PbField(stop_point), "date_times": fields.List(fields.Nested(date_time)) } header = { "display_informations": PbField(display_informations_vj, attribute='pt_display_informations'), "additional_informations": NonNullList(PbEnum(response_pb2.SectionAdditionalInformationType)), "links": UrisToLinks()