class SoftlogNotfisSchema(Schema): class Meta: type_ = 'softlog_notfis' self_view = 'softlog_notfis_detail' self_view_kwargs = {'id': '<id>'} self_view_many = 'softlog_notfis_list' id = fields.Integer(as_string=True, dump_only=True) serie_doc = StringTrim(required=True, validate=validate.Length(max=3)) numero_doc = StringTrim(required=True, validate=validate.Length(max=9)) chave_doc = StringTrim(validate=validate.Length(max=44)) data_emissao = fields.DateTime(required=True) valor = fields.Decimal(required=True, places=2, as_string=True) valor_produtos = fields.Decimal(places=2, as_string=True) peso = fields.Decimal(required=True, places=4, as_string=True) peso_liquido = fields.Decimal(places=4, as_string=True) volumes = fields.Integer(as_string=True, dump_only=True) volume_cubico = fields.Decimal(places=4, as_string=True) numero_pedido = StringTrim(validate=validate.Length(max=30)) natureza_carga = StringTrim(validate=validate.Length(max=30)) remetente_cnpj_cpf = StringTrim(required=True, validate=validate.Length(max=14)) remetente_nome = StringTrim(required=True, validate=validate.Length(max=50)) remetente_inscricao_estadual = StringTrim(validate=validate.Length(max=18)) remetente_endereco = StringTrim(required=True, validate=validate.Length(max=100)) remetente_numero = StringTrim(validate=validate.Length(max=50)) remetente_bairro = StringTrim(required=True, validate=validate.Length(max=30)) remetente_cod_mun_ibge = StringTrim(required=True, validate=validate.Length(max=7)) remetente_cep = StringTrim(required=True, validate=validate.Length(max=8)) remetente_email = StringTrim() remetente_celular = StringTrim() destinatario_nome = StringTrim(required=True, validate=validate.Length(max=50)) destinatario_cnpj_cpf = StringTrim(required=True, validate=validate.Length(max=14)) destinatario_inscricao_estadual = StringTrim(validate=validate.Length( max=18)) destinatario_endereco = StringTrim(required=True, validate=validate.Length(max=100)) destinatario_numero = StringTrim(validate=validate.Length(max=10)) destinatario_bairro = StringTrim(required=True, validate=validate.Length(max=30)) destinatario_cod_mun_ibge = StringTrim(required=True, validate=validate.Length(max=7)) destinatario_cep = StringTrim(required=True, validate=validate.Length(max=8)) destinatario_email = StringTrim() destinatario_celular = StringTrim() destinatario_whatsapp = StringTrim() data_registro = fields.DateTime() placa_veiculo = StringTrim(validate=validate.Length(max=8)) frete_cif_fob = fields.Integer(as_string=True, dump_only=True) unidade = StringTrim(validate=validate.Length(max=10)) rastreamento = StringTrim() user_api_id = fields.Integer(as_string=True, load_only=True)
class EventSchema(Schema): id = fields.Integer(dump_only=True) instatid = fields.Integer() match_instatid = fields.Integer() player_instatid = fields.Integer() player_id = fields.Integer() player_name = fields.String() team_instatid = fields.Integer() team_id = fields.Integer() # match_id = fields.Integer() order_i = fields.Integer() end = fields.Decimal() half = fields.Integer() pos_x = fields.Decimal() pos_y = fields.Decimal() type = fields.Integer() creation_time = fields.DateTime(dump_only=True) # self links def get_top_level_links(self, data, many): if many: self_link = "/data/" else: self_link = "/data/{}".format(data['id']) return {'self': self_link} class Meta: type_ = 'data'
class XMLModelsPassSchema(Schema): id = fields.Integer() match_instatid = fields.Integer() team_instatid = fields.Integer() player_instatid = fields.Integer() zone = fields.String() zone_target = fields.String() time = fields.Decimal() time_target = fields.Decimal() type = fields.String() pos_x = fields.Integer() pos_x_target = fields.Integer() pos_y = fields.Integer() pos_y_target = fields.Integer() creation_time = fields.DateTime(dumponly=True) # self links def get_top_level_links(self, data, many): if many: self_link = "/data/" else: self_link = "/data/{}".format(data['id']) return {'self': self_link} class Meta: type_ = 'data'
class ShotsModelSchema(Schema): id = fields.Integer() match_instatid = fields.Integer() team_instatid = fields.Integer() type = fields.String() action = fields.String() px = fields.Decimal() py = fields.Decimal() xG = fields.Decimal() # self links def get_top_level_links(self, data, many): if many: self_link = "/data/" else: self_link = "/data/{}".format(data['id']) return {'self': self_link} class Meta: type_ = 'data'
class RaceSchema(Schema): id = fields.Integer(dump_only=True) name = fields.String() running_race_type = fields.Integer() distance = fields.Decimal() city = fields.String() country = fields.String() url = fields.String() class Meta: type_ = 'race'
class ItemSchema(Schema): id = fields.UUID(dump_only=True) name = fields.Str() description = fields.Str() price = fields.Decimal(places=2) class Meta: type_ = "items" self_view = "items.items" self_view_kwargs = {"item_id": "<id>"} self_view_many = "items.items" strict = True
class PulseSchema(Schema): class Meta: type_ = 'pulse' self_view = 'pulse_detail' self_view_kwargs = {'id': '<id>'} self_view_many = 'pulses_list' id = fields.Integer() name = fields.Str() type = fields.Str(validate=validate.OneOf(PULSE_TYPES)) max_rabi_rate = fields.Integer(validate=validate.Range(min=0,max=100)) polar_angle = fields.Decimal(validate = validate.Range(min=0,max=1))
class ItemSchema(Schema): class Meta: type_ = 'items' self_view = 'item_detail' self_view_kwargs = {'id': '<id>'} self_view_many = 'item_list' id = fields.Str(dump_only=True) name = fields.Str() description = fields.Str() price = fields.Decimal(places=2, rounding=None, allow_nan=False, as_string=True) image = fields.Str()
class CharacterizationSchema(Schema): id = fields.Function(lambda x: '%s(%s, %s)' % (x.quantity.external_ref, x.flow.external_ref, x.flow[ 'Compartment'][-1])) flow = fields.Relationship(related_url='/{flow_link}', related_url_kwargs={'flow_link': '<flow.link>'}) context = fields.List(fields.Str(), attribute='flow.Compartment') quantity = fields.Relationship( related_url='/{quantity_link}', related_url_kwargs={'quantity_link': '<quantity.link>'}) value = fields.Dict(keys=fields.Str(), values=fields.Decimal(), attribute='_locations') class Meta: type_ = 'characterization' strict = True
class PlayerSchema(Schema): id = fields.Integer(dump_only=True) instatid = fields.Integer() name = fields.String(validate=not_blank) contract = fields.String() nationality = fields.String(validate=not_blank) team_instatid = fields.Integer() birthday = fields.String() weight = fields.Integer() height = fields.Integer() left_foot = fields.Integer() right_foot = fields.Integer() creation_time = fields.DateTime(dump_only=True) team_id = fields.Integer() contract_tm = fields.String() team_member_since_tm = fields.String() market_value_tm = fields.Decimal() name_tm = fields.String() player_number_tm = fields.Integer() birthday_tm = fields.String() url_tm = fields.String() nationality_tm = fields.String() height_tm = fields.Integer() foot_tm = fields.String() position_tm = fields.String() creation_time_tm = fields.Date() # self links def get_top_level_links(self, data, many): if many: self_link = "/data/" else: self_link = "/data/{}".format(data['id']) return {'self': self_link} class Meta: type_ = 'data'
class SparkWyModelsSeasonTeamSchema(Schema): id = fields.Integer() league_wyid = fields.Integer() league_name = fields.String() team_wyid = fields.Integer() season_wyid = fields.Integer() season = fields.String() city = fields.String() country = fields.String() team_name = fields.String() minutes = fields.Integer() xG_after_corner = fields.Decimal() xG_after_free_kick = fields.Decimal() xG_after_throw_in = fields.Decimal() op_shots = fields.Decimal() op_xG = fields.Decimal() maintenance = fields.Decimal() sustained_threat = fields.Decimal() counter_attacks = fields.Decimal() fast_tempo = fields.Decimal() ppda = fields.Decimal() op_xG_per_shot = fields.Decimal() avg_def_line = fields.Decimal() opp_half_left_wp_percentage = fields.Decimal() opp_half_mid_wp_percentage = fields.Decimal() opp_half_right_wp_percentage = fields.Decimal() own_half_left_wp_percentage = fields.Decimal() own_half_mid_wp_percentage = fields.Decimal() own_half_right_wp_percentage = fields.Decimal() returned_possession_percentage = fields.Decimal() pressed_sequence_percentage = fields.Decimal() possession_percentage = fields.Decimal() attack_speed = fields.Decimal() passes_per_possession = fields.Decimal() xG_after_corner_p90 = fields.Decimal() xG_after_throw_in_p90 = fields.Decimal() xG_after_free_kick_p90 = fields.Decimal() maintenance_p90 = fields.Decimal() sustained_threat_p90 = fields.Decimal() counter_attacks_p90 = fields.Decimal() fast_tempo_p90 = fields.Decimal() # self links def get_top_level_links(self, data, many): if many: self_link = "/data/" else: self_link = "/data/{}".format(data['id']) return {'self': self_link} class Meta: type_ = 'data'
class SparkWyModelsMatchPlayerSchema(Schema): id = fields.Integer(dump_only=True) league_wyid = fields.Integer() league_tier = fields.Integer() league_name = fields.String() country_name = fields.String() season_wyid = fields.Integer() season = fields.String() match_wyid = fields.Integer() team_wyid = fields.Integer() team_name = fields.String() player_wyid = fields.Integer() player_name = fields.String() nationality = fields.String() birthday = fields.Date() height = fields.Integer() weight = fields.Integer() primary_position_name = fields.String() primary_position_code = fields.String() primary_position_percentage = fields.Decimal() secondary_position_name = fields.String() secondary_position_code = fields.String() secondary_position_percentage = fields.Decimal() third_position_name = fields.String() third_position_code = fields.String() third_position_percentage = fields.Decimal() foot = fields.String() matches_count = fields.Integer() minutes = fields.Integer() shots = fields.Integer() touch_in_box = fields.Integer() offsides = fields.Integer() penalties = fields.Integer() yellow_cards = fields.Integer() red_cards = fields.Integer() goals = fields.Integer() assists = fields.Integer() passes = fields.Integer() runs = fields.Integer() buildup = fields.Integer() maintenance = fields.Integer() sustained_threat = fields.Integer() fast_tempo = fields.Integer() counter_attacks = fields.Integer() shots_by_primary_foot_percentage = fields.Decimal() xg_total = fields.Decimal() runs_p100_actions = fields.Decimal() passes_p100_actions = fields.Decimal() average_x = fields.Decimal() average_y = fields.Decimal() average_shot_distance = fields.Decimal() scoring_contribution_p90 = fields.Decimal() counterpressing_recoveries_low_p90 = fields.Decimal() counterpressing_recoveries_mid_p90 = fields.Decimal() counterpressing_recoveries_high_p90 = fields.Decimal() recoveries_low_p90 = fields.Decimal() recoveries_mid_p90 = fields.Decimal() recoveries_high_p90 = fields.Decimal() infractions_low_p90 = fields.Decimal() infractions_mid_p90 = fields.Decimal() infractions_high_p90 = fields.Decimal() padj_interceptions_p90 = fields.Decimal() padj_aerial_duels_p90 = fields.Decimal() padj_sliding_tackles_p90 = fields.Decimal() padj_clearance_p90 = fields.Decimal() padj_offensive_duels_p90 = fields.Decimal() padj_defensive_duels_p90 = fields.Decimal() assists_p90 = fields.Decimal() second_assists_p90 = fields.Decimal() third_assists_p90 = fields.Decimal() key_passes_p90 = fields.Decimal() passes_to_final_third_p90 = fields.Decimal() progressive_passes_p90 = fields.Decimal() forward_passes_p90 = fields.Decimal() lateral_passes_p90 = fields.Decimal() back_passes_p90 = fields.Decimal() linkup_plays_p90 = fields.Decimal() long_passes_p90 = fields.Decimal() missed_balls_p90 = fields.Decimal() crosses_p90 = fields.Decimal() progressive_run_p90 = fields.Decimal() accelerations_p90 = fields.Decimal() interceptions_p90 = fields.Decimal() sliding_tackles_p90 = fields.Decimal() aerial_duels_p90 = fields.Decimal() clearances_p90 = fields.Decimal() offensive_duels_p90 = fields.Decimal() defensive_duels_p90 = fields.Decimal() loose_ball_duels_p90 = fields.Decimal() ball_recoveries_p90 = fields.Decimal() padj_loose_ball_duels_p90 = fields.Decimal() shots_blocked_p90 = fields.Decimal() successful_passes_low_p90 = fields.Decimal() successful_passes_mid_p90 = fields.Decimal() successful_passes_high_p90 = fields.Decimal() short_or_medium_passes_p90 = fields.Decimal() padj_recoveries_low_p90 = fields.Decimal() padj_recoveries_mid_p90 = fields.Decimal() padj_recoveries_high_p90 = fields.Decimal() pressing_duels_p90 = fields.Decimal() passes_to_penalty_area_p90 = fields.Decimal() deep_completions_p90 = fields.Decimal() head_passes_p90 = fields.Decimal() deep_completed_crosses_p90 = fields.Decimal() free_kick_crosses_p90 = fields.Decimal() dribble_defences_p90 = fields.Decimal() lost_dribble_defences_p90 = fields.Decimal() shots_by_left_p90 = fields.Decimal() shots_by_right_p90 = fields.Decimal() shots_by_head_or_other_p90 = fields.Decimal() xg_p90 = fields.Decimal() xg_per_shot = fields.Decimal() non_penalty_goals_p90 = fields.Decimal() non_penalty_goals = fields.Integer() goals_by_head_or_other = fields.Integer() goals_by_head_or_other_p90 = fields.Decimal() opp_half_touches_p90 = fields.Decimal() open_play_shots_p90 = fields.Decimal() big_chances_p90 = fields.Decimal() shots_after_long_pass_p90 = fields.Decimal() shots_after_cross_p90 = fields.Decimal() shots_after_through_pass_p90 = fields.Decimal() own_shots_p90 = fields.Decimal() non_fk_outside_box_shots_p90 = fields.Decimal() non_p_dz_shots_p90 = fields.Decimal() long_balls_p90 = fields.Decimal() long_balls_received_p90 = fields.Decimal() crosses_into_small_box_p90 = fields.Decimal() received_passes_into_box_p90 = fields.Decimal() op_xA_p90 = fields.Decimal() op_second_xA_p90 = fields.Decimal() op_third_xA_p90 = fields.Decimal() op_xg_build_up_p90 = fields.Decimal() op_xg_chain_p90 = fields.Decimal() take_ons_p90 = fields.Decimal() spaces_p90 = fields.Decimal() take_ons_in_final_third_p90 = fields.Decimal() take_ons_in_box_p90 = fields.Decimal() danger_zone_entries_p90 = fields.Decimal() dispossessed_p90 = fields.Decimal() free_kick_shots_p90 = fields.Decimal() lost_balls_opp_half_p90 = fields.Decimal() lost_balls_own_half_p90 = fields.Decimal() lost_balls_leading_to_opp_shot_p90 = fields.Decimal() sp_xG_p90 = fields.Decimal() sp_xA_p90 = fields.Decimal() xG_from_corner_p90 = fields.Decimal() high_crosses_p90 = fields.Decimal() low_crosses_p90 = fields.Decimal() blocked_crosses_p90 = fields.Decimal() touch_in_box_p90 = fields.Decimal() successful_passes_to_final_third_percentage = fields.Decimal() passes_runs_percentage = fields.Decimal() spaces_total_runs_percentage = fields.Decimal() xa_per_key_passes = fields.Decimal() successful_take_ons_in_box_percentage = fields.Decimal() successful_crosses_percentage = fields.Decimal() successful_dribbles_percentage = fields.Decimal() successful_take_ons_percentage = fields.Decimal() successful_spaces_percentage = fields.Decimal() long_balls_completion = fields.Decimal() opp_half_touches_ratio = fields.Decimal() successful_crosses_into_small_box_percentage = fields.Decimal() accurate_dz_shots_percentage = fields.Decimal() successful_progressive_passes_percentage = fields.Decimal() won_dribble_defences_percentage = fields.Decimal() dz_scoring_percentage = fields.Decimal() own_shots_percentage = fields.Decimal() scoring_percentage = fields.Decimal() successful_long_passes_percentage = fields.Decimal() conversion_rate = fields.Decimal() successful_head_passes_percentage = fields.Decimal() successful_passes_to_penalty_area_percentage = fields.Decimal() loose_ball_duels_won_percentage = fields.Decimal() short_or_medium_passes_percentage = fields.Decimal() offensive_duels_won_percentage = fields.Decimal() defensive_duels_won_percentage = fields.Decimal() successful_sliding_tackles_percentage = fields.Decimal() air_challenges_completion = fields.Decimal() patch_p90 = fields.Decimal() yellow_cards_p90 = fields.Decimal() red_cards_p90 = fields.Decimal() returned_possession_p90 = fields.Decimal() shots_p90 = fields.Decimal() passes_p90 = fields.Decimal() dribbles_p90 = fields.Decimal() lost_balls_p90 = fields.Decimal() padj_offensive_ground_duels_p90 = fields.Decimal() padj_defensive_ground_duels_p90 = fields.Decimal() counterpressing_recoveries_p90 = fields.Decimal() infractions_p90 = fields.Decimal() final_third_touches_p90 = fields.Decimal() passes_into_final_third_p90 = fields.Decimal() final_third_entries_p90 = fields.Decimal() buildup = fields.Integer() maintenance = fields.Integer() sustained_threat = fields.Integer() fast_tempo = fields.Integer() counter_attacks = fields.Integer() opp_half_left_wp_percentage = fields.Decimal() opp_half_mid_wp_percentage = fields.Decimal() opp_half_right_wp_percentage = fields.Decimal() own_half_left_wp_percentage = fields.Decimal() own_half_mid_wp_percentage = fields.Decimal() own_half_right_wp_percentage = fields.Decimal() successful_offensive_ground_duels_percentage = fields.Decimal() successful_defensive_ground_duels_percentage = fields.Decimal() padj_ball_recoveries_p90 = fields.Decimal() padj_patch_p90 = fields.Decimal() padj_returned_possession_p90 = fields.Decimal() padj_counterpressing_recoveries_p90 = fields.Decimal() number_of_events = fields.Integer() shot_distance_sum = fields.Decimal() won_dribble_defences = fields.Integer() smart_and_through_passes_p90 = fields.Decimal() smart_passes_p90 = fields.Decimal() through_passes_p90 = fields.Decimal() successful_smart_passes_percentage = fields.Decimal() successful_through_passes_percentage = fields.Decimal() dz_goals = fields.Integer() all_opp_half_wp_count = fields.Integer() all_own_half_wp_count = fields.Integer() offensive_ground_duels = fields.Integer() defensive_ground_duels = fields.Integer() successful_smart_and_through_passes_percentage = fields.Decimal() op_xG_p90 = fields.Decimal() np_xG_p90 = fields.Decimal() np_xG = fields.Decimal() touches_in_box = fields.Integer() opp_half_left_wp_percentage = fields.Decimal() opp_half_mid_wp_percentage = fields.Decimal() opp_half_right_wp_percentage = fields.Decimal() own_half_left_wp_percentage = fields.Decimal() own_half_mid_wp_percentage = fields.Decimal() own_half_right_wp_percentage = fields.Decimal() xA_p90 = fields.Decimal() xA = fields.Decimal() padj_lost_dribble_defences_p90 = fields.Decimal() def get_top_level_links(self, data, many): if many: self_link = "/data/" else: self_link = "/data/{}".format(data['id']) return {'self': self_link} class Meta: type_ = 'data'
class OrderSchema(BaseSchema): """ Schema describing an Order resource. Attributes: id (``UUID``): Order's ID date (:any:`datetime`): Order's creation date total_price (:any:`decimal.Decimal`): Order's total price, if passed through validation should be at least equal to 0 delivery_address (``Relationship``): :any:`Address` specified for delivery. Should be `owned` by the order's author. items (``Relationship``):list of :any:`Item` in the order. Objects in the relationship list is generated through the :any:`OrderItemSchema`. If passed while validating should not be empty. user (``Relationship``): the :any:`models.User` that created the Order. """ class Meta: type_ = 'order' self_url_many = '/orders/' self_url = '/orders/{id}' self_url_kwargs = {'id': '<id>'} json_module = simplejson id = fields.Str(dump_only=True, attribute='uuid') date = fields.DateTime(attribute='created_at', dump_only=True) total_price = fields.Decimal( dump_only=True, places=2, validate=MORE_THAN_ZERO, ) delivery_address = fields.Relationship( required=True, include_resource_linkage=True, type_='address', schema='AddressSchema', id_field='uuid', ) items = fields.Relationship( many=True, include_resource_linkage=True, type_='item', schema='OrderItemSchema', id_field='item.uuid', attribute='order_items', required=True, validate=NOT_EMPTY, ) user = fields.Relationship( include_resource_linkage=True, type_='user', schema='UserSchema', id_field='uuid', required=True, )
class XMLAvgTierPositionSchema(Schema): id = fields.Integer() position = fields.String() tier = fields.Integer() player_instatid = fields.Integer() player_id = fields.Integer() team_instatid = fields.Integer() team_id = fields.Integer() season = fields.String() season_half = fields.Integer() creation_time = fields.DateTime(dumponly=True) total_goals = fields.Integer() average_x = fields.Decimal() average_y = fields.Decimal() shots_p90 = fields.Decimal() box_shots_p90 = fields.Decimal() outside_penalty_box_shots_p90 = fields.Decimal() scoring_contribution_p90 = fields.Decimal() percentage_of_own_created_shots = fields.Decimal() scoring_percentage = fields.Decimal() touches_in_box = fields.Decimal() assists_p90 = fields.Decimal() key_passes_acc_p90 = fields.Decimal() throughballs_p90 = fields.Decimal() lost_balls_p90 = fields.Decimal() passes_p90 = fields.Decimal() passes_completion = fields.Decimal() passes_to_the_box = fields.Decimal() danger_zone_entries_p90 = fields.Decimal() long_balls_p90 = fields.Decimal() long_balls_completion = fields.Decimal() crosses_successful_p90 = fields.Decimal() crosses_completion = fields.Decimal() dribbles_successful_p90 = fields.Decimal() dribbles_completion = fields.Decimal() space_defending_p90 = fields.Decimal() successful_tackles_p90 = fields.Decimal() tackles_completion = fields.Decimal() interceptions_p90 = fields.Decimal() padj_tackles_p90 = fields.Decimal() padj_interceptions_p90 = fields.Decimal() won_balls_p90 = fields.Decimal() won_balls_on_opposition_half_p90 = fields.Decimal() challenges_p90 = fields.Decimal() challenges_success_rate = fields.Decimal() long_balls_success = fields.Decimal() long_balls_received_p90 = fields.Decimal() air_challenges_success_rate = fields.Decimal() air_challenges_p90 = fields.Decimal() per90 = fields.Decimal() own_created_shots_p90 = fields.Decimal() accurate_passes_p90 = fields.Decimal() crosses_p90 = fields.Decimal() dribbles_p90 = fields.Decimal() tackles_p90 = fields.Decimal() won_challenges_p90 = fields.Decimal() won_air_challenges_p90 = fields.Decimal() opp_half_touches = fields.Decimal() opp_half_touches_ratio = fields.Decimal() non_penalty_goals = fields.Decimal() long_balls_successful_p90 = fields.Decimal() conversion_rate = fields.Decimal() picking_up_second_balls = fields.Decimal() matches_count = fields.Decimal() average_minutes = fields.Decimal() # self links def get_top_level_links(self, data, many): if many: self_link = "/data/" else: self_link = "/data/{}".format(data['id']) return {'self': self_link} class Meta: type_ = 'data'
class XMLModelsSeasonTeamSchema(Schema): id = fields.Integer(dump_only=True) team_instatid = fields.Integer() league_instatid = fields.Integer() season = fields.String() minutes = fields.Decimal() points = fields.Integer() xPoints = fields.Integer() xPoints_ours = fields.Integer() goals_for = fields.Decimal() goals_against = fields.Decimal() xG_for_p90 = fields.Decimal() xG_against_p90 = fields.Decimal() shots_for = fields.Decimal() shots_against = fields.Decimal() shots_on_target = fields.Decimal() shots_on_target_againts = fields.Decimal() headed_shots = fields.Decimal() dangerzone_shots_p90 = fields.Decimal() dangerzone_shots_against_p90 = fields.Decimal() xG_per_shot = fields.Decimal() average_distance_of_shots = fields.Decimal() average_distance_of_shots_against = fields.Decimal() passes_p90 = fields.Decimal() passes_succes_rate = fields.Decimal() average_direction_of_pass = fields.Decimal() passes_to_the_box_p90 = fields.Decimal() passes_to_the_box_against_p90 = fields.Decimal() dangerzone_entries_p90 = fields.Decimal() crosses_p90 = fields.Decimal() shots_from_crosses = fields.Decimal() avg_number_of_passes_before_shot = fields.Decimal() passes_in_buildup = fields.Decimal() passes_in_middle_third = fields.Decimal() passes_in_final_third = fields.Decimal() long_balls = fields.Decimal() lost_balls = fields.Decimal() buildup = fields.Decimal() maintenance = fields.Decimal() counter_attacking = fields.Decimal() sustainable_threat = fields.Decimal() fast_tempo = fields.Decimal() high_press = fields.Decimal() tts_for = fields.Decimal() tts_against = fields.Decimal() tts_difference = fields.Decimal() tts_tackle = fields.Decimal() tts_interception = fields.Decimal() tts_turnover = fields.Decimal() won_balls_opp_half = fields.Decimal() won_balls_final_third = fields.Decimal() won_balls_middle_third = fields.Decimal() won_balls_own_third = fields.Decimal() avg_height_of_turnover = fields.Decimal() tackles_total = fields.Decimal() tackles_success_rate = fields.Decimal() headers_total = fields.Decimal() headers_success_rate = fields.Decimal() challenges_total = fields.Decimal() challenges_success_rate = fields.Decimal() lost_headers_in_own_box = fields.Decimal() won_headers_in_opp_box = fields.Decimal() interceptions = fields.Decimal() tackles_padj = fields.Decimal() interceptions_padj = fields.Decimal() # self links def get_top_level_links(self, data, many): if many: self_link = "/data/" else: self_link = "/data/{}".format(data['id']) return {'self': self_link} class Meta: type_ = 'data'
class PlayerStatsCalculatedSchema(Schema): id = fields.Integer(dump_only=True) player_id = fields.Integer() player_instatid = fields.Integer() league_id = fields.Integer() # league_id = fields.Integer() # team_id = fields.Integer() # season = fields.Integer() goals = fields.Decimal() assists = fields.Decimal() yellow_cards = fields.Decimal() red_cards = fields.Decimal() total_actions = fields.Decimal() successful_total_actions = fields.Decimal() shots = fields.Decimal() successful_shots = fields.Decimal() passes = fields.Decimal() successful_passes = fields.Decimal() key_passes = fields.Decimal() successful_key_passes = fields.Decimal() crosses = fields.Decimal() successful_crosses = fields.Decimal() challenges = fields.Decimal() successful_challenges = fields.Decimal() air_challenges = fields.Decimal() successful_air_challenges = fields.Decimal() dribbles = fields.Decimal() successful_dribbles = fields.Decimal() tackles = fields.Decimal() successful_tackles = fields.Decimal() lost_balls = fields.Decimal() received_balls = fields.Decimal() fouls = fields.Decimal() player_fouls = fields.Decimal() # self links def get_top_level_links(self, data, many): if many: self_link = "/data/" else: self_link = "/data/{}".format(data['id']) return {'self': self_link} class Meta: type_ = 'data'