-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
114 lines (97 loc) · 3.34 KB
/
models.py
File metadata and controls
114 lines (97 loc) · 3.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
from sqlalchemy import (
JSON,
BigInteger,
Boolean,
Column,
DateTime,
Float,
ForeignKey,
Integer,
String,
)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
Base = declarative_base()
class IncidentEvent(Base):
__tablename__ = "incident_event"
id = Column(BigInteger, primary_key=True, autoincrement=False)
match_id = Column(Integer)
event_id = Column(Integer)
minute = Column(Integer)
second = Column(Integer)
team_id = Column(Integer)
player_id = Column(Integer)
x = Column(Float)
y = Column(Float)
expanded_minute = Column(Integer)
period_value = Column(Integer)
period_display_name = Column(String)
type_value = Column(Integer)
type_display_name = Column(String)
outcome_type_value = Column(Integer)
outcome_type_display_name = Column(String)
qualifiers = Column(JSON)
satisfied_events_types = Column(JSON)
is_touch = Column(Boolean)
end_x = Column(Float)
end_y = Column(Float)
goal_mouth_x = Column(Float)
goal_mouth_y = Column(Float)
related_event_id = Column(Integer)
related_player_id = Column(Integer)
card_type_value = Column(Integer)
card_type_display_name = Column(String)
is_goal = Column(Boolean, default=False)
is_shot = Column(Boolean, default=False)
class Tournament(Base):
__tablename__ = "tournaments"
id = Column(Integer, primary_key=True)
name = Column(String)
season_name = Column(String)
region_name = Column(String)
region_id = Column(Integer)
matches = relationship("Match", back_populates="tournament")
class Team(Base):
__tablename__ = "teams"
id = Column(Integer, primary_key=True)
name = Column(String)
country_code = Column(String)
country_name = Column(String)
class Match(Base):
__tablename__ = "matches"
id = Column(Integer, primary_key=True)
stage_id = Column(Integer)
tournament_id = Column(Integer, ForeignKey("tournaments.id"))
home_team_id = Column(Integer, ForeignKey("teams.id"))
away_team_id = Column(Integer, ForeignKey("teams.id"))
start_time = Column(DateTime)
status = Column(Integer)
home_score = Column(Integer)
away_score = Column(Integer)
period = Column(Integer)
home_team = relationship("Team", foreign_keys=[home_team_id])
away_team = relationship("Team", foreign_keys=[away_team_id])
tournament = relationship("Tournament", back_populates="matches")
incidents = relationship("Incident", back_populates="match")
class Incident(Base):
__tablename__ = "incidents"
id = Column(Integer, primary_key=True, autoincrement=True)
match_id = Column(Integer, ForeignKey("matches.id"))
minute = Column(Integer)
type = Column(Integer)
sub_type = Column(Integer)
player_name = Column(String)
participating_player_name = Column(String)
field = Column(Integer)
period = Column(Integer)
match = relationship("Match", back_populates="incidents")
class Bet(Base):
__tablename__ = "bets"
id = Column(Integer, primary_key=True, autoincrement=True)
match_id = Column(Integer, ForeignKey("matches.id"))
bet_name = Column(String)
odds_decimal = Column(Float)
odds_fractional = Column(String)
provider_id = Column(Integer)
click_out_url = Column(String)
match = relationship("Match")