class OutsideServiceCommon(serpy.DictSerializer): class_ = Field(schema_type=str, label='class', attr='class') _id = Field(label='id', attr='id', schema_type=str) circuit_breaker = MethodField(schema_type=CircuitBreakerSerializer, display_none=False) def get_circuit_breaker(self, obj): o = obj.get('circuit_breaker', None) return CircuitBreakerSerializer(o, display_none=False).data if o else None
class GeoStatusSerializer(serpy.Serializer): nb_addresses = Field(schema_type=int) nb_admins = Field(schema_type=int) nb_admins_from_cities = Field(schema_type=int) nb_pois = Field(schema_type=int) nb_ways = Field(schema_type=int) poi_sources = StringListField(display_none=True) street_network_sources = StringListField(display_none=True)
class EquipmentProvidersSerializer(NullableDictSerializer): key = Field(schema_type=str, display_none=False) codes_types = Field(schema_type=str, many=True, display_none=True) timeout = MethodField(schema_type=int, display_none=False) fail_max = MethodField(schema_type=int, display_none=False) def get_timeout(self, obj): return obj.get('timeout', None) def get_fail_max(self, obj): return obj.get('fail_max', None)
class RidesharingServicesSerializer(OutsideServiceCommon): rating_scale_min = MethodField(schema_type=int, display_none=False) rating_scale_max = MethodField(schema_type=int, display_none=False) crowfly_radius = Field(schema_type=int, display_none=False) network = Field(schema_type=str, display_none=False) def get_rating_scale_min(self, obj): return obj.get('rating_scale_min', None) def get_rating_scale_max(self, obj): return obj.get('rating_scale_max', None)
class AutocompleteSerializer(serpy.DictSerializer): class_ = Field(schema_type=str, label='class', attr='class') timeout = MethodField(schema_type=float, display_none=False) timeout_bragi_es = MethodField(schema_type=float, display_none=False) fast_timeout = MethodField(schema_type=float, display_none=False) fast_timeout_bragi_es = MethodField(schema_type=float, display_none=False) def get_timeout(self, obj): return obj.get('timeout', None) def get_timeout_bragi_es(self, obj): return obj.get('timeout_bragi_es', None) def get_fast_timeout(self, obj): return obj.get('fast_timeout', None) def get_fast_timeout_bragi_es(self, obj): return obj.get('fast_timeout_bragi_es', None)
class CircuitBreakerSerializer(serpy.DictSerializer): current_state = Field(schema_type=str, display_none=True) fail_counter = Field(schema_type=int, display_none=True) reset_timeout = Field(schema_type=int, display_none=True)
class TravelerProfilesSerializer(serpy.Serializer): bike_speed = Field(schema_type=float) bss_speed = Field(schema_type=float) car_speed = Field(schema_type=float) first_section_mode = StringListField() is_from_db = Field(schema_type=bool) last_section_mode = StringListField() max_bike_duration_to_pt = Field(schema_type=int) max_bss_duration_to_pt = Field(schema_type=int) max_car_duration_to_pt = Field(schema_type=int) max_walking_duration_to_pt = Field(schema_type=int) traveler_type = Field(schema_type=str) walking_speed = Field(schema_type=float) wheelchair = Field(schema_type=bool)
class ParametersSerializer(serpy.Serializer): bike_speed = Field(schema_type=float) bss_provider = Field(schema_type=bool) bss_speed = Field(schema_type=float) car_speed = Field(schema_type=float) car_no_park_speed = Field(schema_type=float) taxi_speed = Field(schema_type=float) journey_order = Field(schema_type=str) max_additional_connections = Field(schema_type=int) max_bike_duration_to_pt = Field(schema_type=int) max_bss_duration_to_pt = Field(schema_type=int) max_car_duration_to_pt = Field(schema_type=int) max_car_no_park_duration_to_pt = Field(schema_type=int) max_duration = Field(schema_type=int) max_nb_transfers = Field(schema_type=int) max_walking_duration_to_pt = Field(schema_type=int) min_bike = Field(schema_type=int) min_bss = Field(schema_type=int) min_car = Field(schema_type=int) min_taxi = Field(schema_type=int) night_bus_filter_base_factor = Field(schema_type=int) night_bus_filter_max_factor = Field(schema_type=float) priority = Field(schema_type=int) scenario = Field(schema_type=str, attr=str('_scenario_name')) successive_physical_mode_to_limit_id = Field(schema_type=str) walking_speed = Field(schema_type=float) walking_transfer_penalty = Field(schema_type=int) min_nb_journeys = Field(schema_type=int) max_nb_journeys = Field(schema_type=int) min_journeys_calls = Field(schema_type=int) max_successive_physical_mode = Field(schema_type=int) final_line_filter = Field(schema_type=bool) max_extra_second_pass = Field(schema_type=int) additional_time_after_first_section_taxi = Field(schema_type=int) additional_time_before_last_section_taxi = Field(schema_type=int)
class BssProviderSerializer(serpy.DictSerializer): network = Field(schema_type=str, display_none=True) operators = jsonschema.Field(schema_type=str, display_none=True, many=True)
class CommonStatusSerializer(NullableDictSerializer): status = Field(schema_type=str, display_none=False) dataset_created_at = Field(schema_type=str, display_none=False) is_realtime_loaded = Field(schema_type=bool, display_none=False) data_version = Field(schema_type=int, display_none=False) nb_threads = Field(schema_type=int, display_none=False) is_open_service = Field(schema_type=bool, display_none=False) is_connected_to_rabbitmq = Field(schema_type=bool, display_none=False) autocomplete = AutocompleteSerializer(display_none=False) end_production_date = Field(schema_type=str, display_none=False) realtime_proxies = StringListField(display_none=True) last_load_at = Field(schema_type=str, display_none=False) publication_date = Field(schema_type=str, display_none=False) street_networks = StreetNetworkSerializer(many=True, display_none=False) ridesharing_services = RidesharingServicesSerializer(many=True, display_none=False) start_production_date = Field(schema_type=str, display_none=False) last_load_status = Field(schema_type=bool, display_none=False) is_open_data = Field(schema_type=bool, display_none=False) last_rt_data_loaded = Field(schema_type=str, display_none=False) kraken_version = MethodField(schema_type=str, display_none=False) region_id = Field(schema_type=str, display_none=False, description='Identifier of the coverage') error = CoverageErrorSerializer(display_none=False) def get_kraken_version(self, obj): if "navitia_version" in obj: return obj["navitia_version"] if "kraken_version" in obj: return obj["kraken_version"] return None
class CoverageErrorSerializer(NullableDictSerializer): code = Field(schema_type=str) value = Field(schema_type=str)
class LinesSchema(serpy.Serializer): # This Class is not used as a serializer, but here only to get the schema duration = Field(schema_type=int, many=True) cell_lon = CellLonSchema()
class CellLonSchema(serpy.Serializer): # This Class is not used as a serializer, but here only to get the schema center_lon = Field(schema_type=float) max_lon = Field(schema_type=float) min_lon = Field(schema_type=float)
class StatusSerializer(serpy.DictSerializer): data_version = Field(schema_type=int) dataset_created_at = Field(schema_type=str) end_production_date = Field(schema_type=str) is_connected_to_rabbitmq = Field(schema_type=bool) is_open_data = Field(schema_type=bool) is_open_service = Field(schema_type=bool) is_realtime_loaded = Field(schema_type=bool) kraken_version = Field(schema_type=str, attr=str("navitia_version")) last_load_at = Field(schema_type=str) last_load_status = Field(schema_type=bool) last_rt_data_loaded = Field(schema_type=str) nb_threads = Field(schema_type=int) parameters = ParametersSerializer() publication_date = Field(schema_type=str) realtime_contributors = MethodField(schema_type=str, many=True, display_none=True) realtime_proxies = StringListField(display_none=True) start_production_date = Field(schema_type=str) status = Field(schema_type=str) traveler_profiles = TravelerProfilesSerializer(many=True) def get_realtime_contributors(self, obj): # so far, serpy cannot serialize an optional attr # this has to be done manually return obj.get('rt_contributors', [])
class ParametersSerializer(serpy.Serializer): bike_speed = Field(schema_type=float) bss_provider = Field(schema_type=bool) bss_speed = Field(schema_type=float) car_speed = Field(schema_type=float) factor_too_long_journey = Field(schema_type=int) journey_order = Field(schema_type=str) max_additional_connections = Field(schema_type=int) max_bike_duration_to_pt = Field(schema_type=int) max_bss_duration_to_pt = Field(schema_type=int) max_car_duration_to_pt = Field(schema_type=int) max_duration = Field(schema_type=int) max_duration_criteria = Field(schema_type=str) max_duration_fallback_mode = Field(schema_type=str) max_nb_transfers = Field(schema_type=int) max_walking_duration_to_pt = Field(schema_type=int) min_bike = Field(schema_type=int) min_bss = Field(schema_type=int) min_car = Field(schema_type=int) min_duration_too_long_journey = Field(schema_type=int) min_tc_with_bike = Field(schema_type=int) min_tc_with_bss = Field(schema_type=int) min_tc_with_car = Field(schema_type=int) night_bus_filter_base_factor = Field(schema_type=int) night_bus_filter_max_factor = Field(schema_type=float) priority = Field(schema_type=int) scenario = Field(schema_type=str, attr=str('_scenario_name')) successive_physical_mode_to_limit_id = Field(schema_type=str) walking_speed = Field(schema_type=float) walking_transfer_penalty = Field(schema_type=int)
class ParametersSerializer(serpy.Serializer): bike_speed = Field(schema_type=float) bss_provider = Field(schema_type=bool) bss_speed = Field(schema_type=float) car_speed = Field(schema_type=float) car_no_park_speed = Field(schema_type=float) taxi_speed = Field(schema_type=float) journey_order = Field(schema_type=str) max_additional_connections = Field(schema_type=int) max_bike_duration_to_pt = Field(schema_type=int) max_bss_duration_to_pt = Field(schema_type=int) max_car_duration_to_pt = Field(schema_type=int) max_car_no_park_duration_to_pt = Field(schema_type=int) max_ridesharing_duration_to_pt = Field(schema_type=int) max_taxi_duration_to_pt = Field(schema_type=int) max_duration = Field(schema_type=int) max_nb_transfers = Field(schema_type=int) max_walking_duration_to_pt = Field(schema_type=int) min_bike = Field(schema_type=int) min_bss = Field(schema_type=int) min_car = Field(schema_type=int) min_ridesharing = Field(schema_type=int) min_taxi = Field(schema_type=int) night_bus_filter_base_factor = Field(schema_type=int) night_bus_filter_max_factor = Field(schema_type=float) priority = Field(schema_type=int) scenario = Field(schema_type=str, attr=str('_scenario_name')) successive_physical_mode_to_limit_id = Field(schema_type=str) walking_speed = Field(schema_type=float) arrival_transfer_penalty = Field(schema_type=int) walking_transfer_penalty = Field(schema_type=int) min_nb_journeys = Field(schema_type=int) max_nb_journeys = Field(schema_type=int) min_journeys_calls = Field(schema_type=int) max_successive_physical_mode = Field(schema_type=int) final_line_filter = Field(schema_type=bool) max_extra_second_pass = Field(schema_type=int) additional_time_after_first_section_taxi = Field(schema_type=int) additional_time_before_last_section_taxi = Field(schema_type=int) max_walking_direct_path_duration = Field(schema_type=int) max_bike_direct_path_duration = Field(schema_type=int) max_bss_direct_path_duration = Field(schema_type=int) max_car_direct_path_duration = Field(schema_type=int) max_car_no_park_direct_path_duration = Field(schema_type=int) max_taxi_direct_path_duration = Field(schema_type=int) max_ridesharing_direct_path_duration = Field(schema_type=int) max_bike_direct_path_distance = Field(schema_type=int) max_bss_direct_path_distance = Field(schema_type=int) max_walking_direct_path_distance = Field(schema_type=int) max_car_direct_path_distance = Field(schema_type=int) max_car_no_park_direct_path_distance = Field(schema_type=int) max_ridesharing_direct_path_distance = Field(schema_type=int) max_taxi_direct_path_distance = Field(schema_type=int) max_nb_crowfly_by_mode = Field(schema_type=dict) places_proximity_radius = Field(schema_type=int) transfer_path = Field(schema_type=bool) access_points = Field(schema_type=bool) default_pt_planner = Field(schema_type=str) bss_rent_duration = Field(schema_type=int) bss_rent_penalty = Field(schema_type=int) bss_return_duration = Field(schema_type=int) bss_return_penalty = Field(schema_type=int)