hockey-blast-common-lib 0.1.63__py3-none-any.whl → 0.1.65__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hockey_blast_common_lib/aggregate_all_stats.py +7 -4
- hockey_blast_common_lib/aggregate_goalie_stats.py +301 -107
- hockey_blast_common_lib/aggregate_h2h_stats.py +64 -33
- hockey_blast_common_lib/aggregate_human_stats.py +565 -280
- hockey_blast_common_lib/aggregate_referee_stats.py +286 -135
- hockey_blast_common_lib/aggregate_s2s_stats.py +85 -25
- hockey_blast_common_lib/aggregate_scorekeeper_stats.py +228 -113
- hockey_blast_common_lib/aggregate_skater_stats.py +561 -238
- hockey_blast_common_lib/assign_skater_skill.py +21 -11
- hockey_blast_common_lib/db_connection.py +59 -8
- hockey_blast_common_lib/embedding_utils.py +309 -0
- hockey_blast_common_lib/h2h_models.py +150 -56
- hockey_blast_common_lib/hockey_blast_sample_backup.sql.gz +0 -0
- hockey_blast_common_lib/models.py +305 -150
- hockey_blast_common_lib/options.py +30 -15
- hockey_blast_common_lib/progress_utils.py +21 -13
- hockey_blast_common_lib/skills_in_divisions.py +170 -33
- hockey_blast_common_lib/skills_propagation.py +164 -70
- hockey_blast_common_lib/stats_models.py +489 -245
- hockey_blast_common_lib/stats_utils.py +6 -3
- hockey_blast_common_lib/utils.py +91 -25
- hockey_blast_common_lib/wsgi.py +7 -5
- {hockey_blast_common_lib-0.1.63.dist-info → hockey_blast_common_lib-0.1.65.dist-info}/METADATA +1 -1
- hockey_blast_common_lib-0.1.65.dist-info/RECORD +29 -0
- hockey_blast_common_lib-0.1.63.dist-info/RECORD +0 -28
- {hockey_blast_common_lib-0.1.63.dist-info → hockey_blast_common_lib-0.1.65.dist-info}/WHEEL +0 -0
- {hockey_blast_common_lib-0.1.63.dist-info → hockey_blast_common_lib-0.1.65.dist-info}/top_level.txt +0 -0
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
from hockey_blast_common_lib.models import db
|
|
2
1
|
from sqlalchemy.ext.declarative import declared_attr
|
|
3
2
|
from sqlalchemy.orm import synonym
|
|
4
3
|
|
|
4
|
+
from hockey_blast_common_lib.models import db
|
|
5
|
+
|
|
6
|
+
|
|
5
7
|
class BaseStatsHuman(db.Model):
|
|
6
8
|
__abstract__ = True
|
|
7
9
|
id = db.Column(db.Integer, primary_key=True)
|
|
8
|
-
human_id = db.Column(db.Integer, db.ForeignKey(
|
|
10
|
+
human_id = db.Column(db.Integer, db.ForeignKey("humans.id"), nullable=False)
|
|
9
11
|
games_total = db.Column(db.Integer, default=0)
|
|
10
12
|
games_total_rank = db.Column(db.Integer, default=0)
|
|
11
13
|
games_skater = db.Column(db.Integer, default=0)
|
|
@@ -21,40 +23,86 @@ class BaseStatsHuman(db.Model):
|
|
|
21
23
|
goalies_in_rank = db.Column(db.Integer, default=0)
|
|
22
24
|
referees_in_rank = db.Column(db.Integer, default=0)
|
|
23
25
|
scorekeepers_in_rank = db.Column(db.Integer, default=0)
|
|
24
|
-
first_game_id = db.Column(db.Integer, db.ForeignKey(
|
|
25
|
-
last_game_id = db.Column(db.Integer, db.ForeignKey(
|
|
26
|
-
first_game_id_skater = db.Column(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
first_game_id = db.Column(db.Integer, db.ForeignKey("games.id"), nullable=True)
|
|
27
|
+
last_game_id = db.Column(db.Integer, db.ForeignKey("games.id"), nullable=True)
|
|
28
|
+
first_game_id_skater = db.Column(
|
|
29
|
+
db.Integer, db.ForeignKey("games.id"), nullable=True
|
|
30
|
+
)
|
|
31
|
+
last_game_id_skater = db.Column(
|
|
32
|
+
db.Integer, db.ForeignKey("games.id"), nullable=True
|
|
33
|
+
)
|
|
34
|
+
first_game_id_goalie = db.Column(
|
|
35
|
+
db.Integer, db.ForeignKey("games.id"), nullable=True
|
|
36
|
+
)
|
|
37
|
+
last_game_id_goalie = db.Column(
|
|
38
|
+
db.Integer, db.ForeignKey("games.id"), nullable=True
|
|
39
|
+
)
|
|
40
|
+
first_game_id_referee = db.Column(
|
|
41
|
+
db.Integer, db.ForeignKey("games.id"), nullable=True
|
|
42
|
+
)
|
|
43
|
+
last_game_id_referee = db.Column(
|
|
44
|
+
db.Integer, db.ForeignKey("games.id"), nullable=True
|
|
45
|
+
)
|
|
46
|
+
first_game_id_scorekeeper = db.Column(
|
|
47
|
+
db.Integer, db.ForeignKey("games.id"), nullable=True
|
|
48
|
+
)
|
|
49
|
+
last_game_id_scorekeeper = db.Column(
|
|
50
|
+
db.Integer, db.ForeignKey("games.id"), nullable=True
|
|
51
|
+
)
|
|
34
52
|
|
|
35
53
|
@declared_attr
|
|
36
54
|
def __table_args__(cls):
|
|
37
55
|
return (
|
|
38
|
-
db.UniqueConstraint(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
db.Index(
|
|
56
|
+
db.UniqueConstraint(
|
|
57
|
+
"human_id",
|
|
58
|
+
cls.get_aggregation_column(),
|
|
59
|
+
name=f"_human_{cls.aggregation_type}_stats_uc1",
|
|
60
|
+
),
|
|
61
|
+
db.Index(
|
|
62
|
+
f"idx_{cls.aggregation_type}_games_total1",
|
|
63
|
+
cls.get_aggregation_column(),
|
|
64
|
+
"games_total",
|
|
65
|
+
),
|
|
66
|
+
db.Index(
|
|
67
|
+
f"idx_{cls.aggregation_type}_games_skater1",
|
|
68
|
+
cls.get_aggregation_column(),
|
|
69
|
+
"games_skater",
|
|
70
|
+
),
|
|
71
|
+
db.Index(
|
|
72
|
+
f"idx_{cls.aggregation_type}_games_referee1",
|
|
73
|
+
cls.get_aggregation_column(),
|
|
74
|
+
"games_referee",
|
|
75
|
+
),
|
|
76
|
+
db.Index(
|
|
77
|
+
f"idx_{cls.aggregation_type}_games_scorekeeper1",
|
|
78
|
+
cls.get_aggregation_column(),
|
|
79
|
+
"games_scorekeeper",
|
|
80
|
+
),
|
|
81
|
+
db.Index(
|
|
82
|
+
f"idx_{cls.aggregation_type}_games_goalie1",
|
|
83
|
+
cls.get_aggregation_column(),
|
|
84
|
+
"games_goalie",
|
|
85
|
+
),
|
|
44
86
|
)
|
|
45
87
|
|
|
46
88
|
@classmethod
|
|
47
89
|
def get_aggregation_column(cls):
|
|
48
|
-
raise NotImplementedError(
|
|
90
|
+
raise NotImplementedError(
|
|
91
|
+
"Subclasses should implement this method to return the aggregation column name."
|
|
92
|
+
)
|
|
49
93
|
|
|
50
94
|
|
|
51
95
|
class BaseStatsSkater(db.Model):
|
|
52
96
|
__abstract__ = True
|
|
53
97
|
id = db.Column(db.Integer, primary_key=True)
|
|
54
|
-
human_id = db.Column(db.Integer, db.ForeignKey(
|
|
55
|
-
games_played = db.Column(
|
|
98
|
+
human_id = db.Column(db.Integer, db.ForeignKey("humans.id"), nullable=False)
|
|
99
|
+
games_played = db.Column(
|
|
100
|
+
db.Integer, default=0
|
|
101
|
+
) # DEPRECATED - use games_participated instead
|
|
56
102
|
games_played_rank = db.Column(db.Integer, default=0)
|
|
57
|
-
games_participated = db.Column(
|
|
103
|
+
games_participated = db.Column(
|
|
104
|
+
db.Integer, default=0
|
|
105
|
+
) # Count FINAL, FINAL_SO, FORFEIT, NOEVENTS
|
|
58
106
|
games_participated_rank = db.Column(db.Integer, default=0)
|
|
59
107
|
games_with_stats = db.Column(db.Integer, default=0) # Count only FINAL, FINAL_SO
|
|
60
108
|
games_with_stats_rank = db.Column(db.Integer, default=0)
|
|
@@ -67,7 +115,9 @@ class BaseStatsSkater(db.Model):
|
|
|
67
115
|
penalties = db.Column(db.Integer, default=0)
|
|
68
116
|
penalties_rank = db.Column(db.Integer, default=0)
|
|
69
117
|
gm_penalties = db.Column(db.Integer, default=0) # New field for GM penalties
|
|
70
|
-
gm_penalties_rank = db.Column(
|
|
118
|
+
gm_penalties_rank = db.Column(
|
|
119
|
+
db.Integer, default=0
|
|
120
|
+
) # New field for GM penalties rank
|
|
71
121
|
goals_per_game = db.Column(db.Float, default=0.0)
|
|
72
122
|
goals_per_game_rank = db.Column(db.Integer, default=0)
|
|
73
123
|
points_per_game = db.Column(db.Float, default=0.0)
|
|
@@ -83,34 +133,77 @@ class BaseStatsSkater(db.Model):
|
|
|
83
133
|
current_point_streak_rank = db.Column(db.Integer, default=0)
|
|
84
134
|
current_point_streak_avg_points = db.Column(db.Float, default=0.0)
|
|
85
135
|
current_point_streak_avg_points_rank = db.Column(db.Integer, default=0)
|
|
86
|
-
first_game_id = db.Column(db.Integer, db.ForeignKey(
|
|
87
|
-
last_game_id = db.Column(db.Integer, db.ForeignKey(
|
|
136
|
+
first_game_id = db.Column(db.Integer, db.ForeignKey("games.id"))
|
|
137
|
+
last_game_id = db.Column(db.Integer, db.ForeignKey("games.id"))
|
|
88
138
|
|
|
89
139
|
@declared_attr
|
|
90
140
|
def __table_args__(cls):
|
|
91
141
|
return (
|
|
92
|
-
db.UniqueConstraint(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
db.Index(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
142
|
+
db.UniqueConstraint(
|
|
143
|
+
"human_id",
|
|
144
|
+
cls.get_aggregation_column(),
|
|
145
|
+
name=f"_human_{cls.aggregation_type}_uc_skater1",
|
|
146
|
+
),
|
|
147
|
+
db.Index(
|
|
148
|
+
f"idx_{cls.aggregation_type}_goals_per_game3",
|
|
149
|
+
cls.get_aggregation_column(),
|
|
150
|
+
"goals_per_game",
|
|
151
|
+
),
|
|
152
|
+
db.Index(
|
|
153
|
+
f"idx_{cls.aggregation_type}_points_per_game3",
|
|
154
|
+
cls.get_aggregation_column(),
|
|
155
|
+
"points_per_game",
|
|
156
|
+
),
|
|
157
|
+
db.Index(
|
|
158
|
+
f"idx_{cls.aggregation_type}_assists_per_game3",
|
|
159
|
+
cls.get_aggregation_column(),
|
|
160
|
+
"assists_per_game",
|
|
161
|
+
),
|
|
162
|
+
db.Index(
|
|
163
|
+
f"idx_{cls.aggregation_type}_penalties_per_game3",
|
|
164
|
+
cls.get_aggregation_column(),
|
|
165
|
+
"penalties_per_game",
|
|
166
|
+
),
|
|
167
|
+
db.Index(
|
|
168
|
+
f"idx_{cls.aggregation_type}_gm_penalties_per_game3",
|
|
169
|
+
cls.get_aggregation_column(),
|
|
170
|
+
"gm_penalties_per_game",
|
|
171
|
+
),
|
|
172
|
+
db.Index(
|
|
173
|
+
f"idx_{cls.aggregation_type}_current_point_streak3",
|
|
174
|
+
cls.get_aggregation_column(),
|
|
175
|
+
"current_point_streak",
|
|
176
|
+
),
|
|
177
|
+
db.Index(
|
|
178
|
+
f"idx_{cls.aggregation_type}_current_point_streak_avg_points3",
|
|
179
|
+
cls.get_aggregation_column(),
|
|
180
|
+
"current_point_streak_avg_points",
|
|
181
|
+
),
|
|
182
|
+
db.Index(
|
|
183
|
+
f"idx_{cls.aggregation_type}_games_played3",
|
|
184
|
+
cls.get_aggregation_column(),
|
|
185
|
+
"games_played",
|
|
186
|
+
),
|
|
101
187
|
)
|
|
102
188
|
|
|
103
189
|
@classmethod
|
|
104
190
|
def get_aggregation_column(cls):
|
|
105
|
-
raise NotImplementedError(
|
|
191
|
+
raise NotImplementedError(
|
|
192
|
+
"Subclasses should implement this method to return the aggregation column name."
|
|
193
|
+
)
|
|
194
|
+
|
|
106
195
|
|
|
107
196
|
class BaseStatsGoalie(db.Model):
|
|
108
197
|
__abstract__ = True
|
|
109
198
|
id = db.Column(db.Integer, primary_key=True)
|
|
110
|
-
human_id = db.Column(db.Integer, db.ForeignKey(
|
|
111
|
-
games_played = db.Column(
|
|
199
|
+
human_id = db.Column(db.Integer, db.ForeignKey("humans.id"), nullable=False)
|
|
200
|
+
games_played = db.Column(
|
|
201
|
+
db.Integer, default=0
|
|
202
|
+
) # DEPRECATED - use games_participated instead
|
|
112
203
|
games_played_rank = db.Column(db.Integer, default=0)
|
|
113
|
-
games_participated = db.Column(
|
|
204
|
+
games_participated = db.Column(
|
|
205
|
+
db.Integer, default=0
|
|
206
|
+
) # Count FINAL, FINAL_SO, FORFEIT, NOEVENTS
|
|
114
207
|
games_participated_rank = db.Column(db.Integer, default=0)
|
|
115
208
|
games_with_stats = db.Column(db.Integer, default=0) # Count only FINAL, FINAL_SO
|
|
116
209
|
games_with_stats_rank = db.Column(db.Integer, default=0)
|
|
@@ -123,33 +216,66 @@ class BaseStatsGoalie(db.Model):
|
|
|
123
216
|
save_percentage = db.Column(db.Float, default=0.0)
|
|
124
217
|
save_percentage_rank = db.Column(db.Integer, default=0)
|
|
125
218
|
total_in_rank = db.Column(db.Integer, default=0)
|
|
126
|
-
first_game_id = db.Column(db.Integer, db.ForeignKey(
|
|
127
|
-
last_game_id = db.Column(db.Integer, db.ForeignKey(
|
|
219
|
+
first_game_id = db.Column(db.Integer, db.ForeignKey("games.id"))
|
|
220
|
+
last_game_id = db.Column(db.Integer, db.ForeignKey("games.id"))
|
|
128
221
|
|
|
129
222
|
@declared_attr
|
|
130
223
|
def __table_args__(cls):
|
|
131
224
|
return (
|
|
132
|
-
db.UniqueConstraint(
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
db.Index(
|
|
225
|
+
db.UniqueConstraint(
|
|
226
|
+
"human_id",
|
|
227
|
+
cls.get_aggregation_column(),
|
|
228
|
+
name=f"_human_{cls.aggregation_type}_uc_goalie1",
|
|
229
|
+
),
|
|
230
|
+
db.Index(
|
|
231
|
+
f"idx_{cls.aggregation_type}_goals_allowed_per_game1",
|
|
232
|
+
cls.get_aggregation_column(),
|
|
233
|
+
"goals_allowed_per_game",
|
|
234
|
+
),
|
|
235
|
+
db.Index(
|
|
236
|
+
f"idx_{cls.aggregation_type}_save_percentage1",
|
|
237
|
+
cls.get_aggregation_column(),
|
|
238
|
+
"save_percentage",
|
|
239
|
+
),
|
|
240
|
+
db.Index(
|
|
241
|
+
f"idx_{cls.aggregation_type}_shots_faced1",
|
|
242
|
+
cls.get_aggregation_column(),
|
|
243
|
+
"shots_faced",
|
|
244
|
+
),
|
|
245
|
+
db.Index(
|
|
246
|
+
f"idx_{cls.aggregation_type}_games_played_goalie1",
|
|
247
|
+
cls.get_aggregation_column(),
|
|
248
|
+
"games_played",
|
|
249
|
+
),
|
|
250
|
+
db.Index(
|
|
251
|
+
f"idx_{cls.aggregation_type}_goals_allowed1",
|
|
252
|
+
cls.get_aggregation_column(),
|
|
253
|
+
"goals_allowed",
|
|
254
|
+
),
|
|
138
255
|
)
|
|
139
256
|
|
|
140
257
|
@classmethod
|
|
141
258
|
def get_aggregation_column(cls):
|
|
142
|
-
raise NotImplementedError(
|
|
259
|
+
raise NotImplementedError(
|
|
260
|
+
"Subclasses should implement this method to return the aggregation column name."
|
|
261
|
+
)
|
|
262
|
+
|
|
143
263
|
|
|
144
264
|
class BaseStatsReferee(db.Model):
|
|
145
265
|
__abstract__ = True
|
|
146
266
|
id = db.Column(db.Integer, primary_key=True)
|
|
147
|
-
human_id = db.Column(db.Integer, db.ForeignKey(
|
|
148
|
-
games_reffed = db.Column(
|
|
267
|
+
human_id = db.Column(db.Integer, db.ForeignKey("humans.id"), nullable=False)
|
|
268
|
+
games_reffed = db.Column(
|
|
269
|
+
db.Integer, default=0
|
|
270
|
+
) # DEPRECATED - use games_participated instead
|
|
149
271
|
games_reffed_rank = db.Column(db.Integer, default=0)
|
|
150
|
-
games_participated = db.Column(
|
|
272
|
+
games_participated = db.Column(
|
|
273
|
+
db.Integer, default=0
|
|
274
|
+
) # Count FINAL, FINAL_SO, FORFEIT, NOEVENTS
|
|
151
275
|
games_participated_rank = db.Column(db.Integer, default=0)
|
|
152
|
-
games_with_stats = db.Column(
|
|
276
|
+
games_with_stats = db.Column(
|
|
277
|
+
db.Integer, default=0
|
|
278
|
+
) # Count only FINAL, FINAL_SO (for per-game averages)
|
|
153
279
|
games_with_stats_rank = db.Column(db.Integer, default=0)
|
|
154
280
|
penalties_given = db.Column(db.Integer, default=0)
|
|
155
281
|
penalties_given_rank = db.Column(db.Integer, default=0)
|
|
@@ -160,33 +286,66 @@ class BaseStatsReferee(db.Model):
|
|
|
160
286
|
gm_per_game = db.Column(db.Float, default=0.0)
|
|
161
287
|
gm_per_game_rank = db.Column(db.Integer, default=0)
|
|
162
288
|
total_in_rank = db.Column(db.Integer, default=0)
|
|
163
|
-
first_game_id = db.Column(db.Integer, db.ForeignKey(
|
|
164
|
-
last_game_id = db.Column(db.Integer, db.ForeignKey(
|
|
289
|
+
first_game_id = db.Column(db.Integer, db.ForeignKey("games.id"))
|
|
290
|
+
last_game_id = db.Column(db.Integer, db.ForeignKey("games.id"))
|
|
165
291
|
|
|
166
292
|
@declared_attr
|
|
167
293
|
def __table_args__(cls):
|
|
168
294
|
return (
|
|
169
|
-
db.UniqueConstraint(
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
db.Index(
|
|
295
|
+
db.UniqueConstraint(
|
|
296
|
+
"human_id",
|
|
297
|
+
cls.get_aggregation_column(),
|
|
298
|
+
name=f"_human_{cls.aggregation_type}_uc_referee1",
|
|
299
|
+
),
|
|
300
|
+
db.Index(
|
|
301
|
+
f"idx_{cls.aggregation_type}_games_reffed1",
|
|
302
|
+
cls.get_aggregation_column(),
|
|
303
|
+
"games_reffed",
|
|
304
|
+
),
|
|
305
|
+
db.Index(
|
|
306
|
+
f"idx_{cls.aggregation_type}_penalties_given1",
|
|
307
|
+
cls.get_aggregation_column(),
|
|
308
|
+
"penalties_given",
|
|
309
|
+
),
|
|
310
|
+
db.Index(
|
|
311
|
+
f"idx_{cls.aggregation_type}_penalties_per_game1",
|
|
312
|
+
cls.get_aggregation_column(),
|
|
313
|
+
"penalties_per_game",
|
|
314
|
+
),
|
|
315
|
+
db.Index(
|
|
316
|
+
f"idx_{cls.aggregation_type}_gm_given1",
|
|
317
|
+
cls.get_aggregation_column(),
|
|
318
|
+
"gm_given",
|
|
319
|
+
),
|
|
320
|
+
db.Index(
|
|
321
|
+
f"idx_{cls.aggregation_type}_gm_per_game1",
|
|
322
|
+
cls.get_aggregation_column(),
|
|
323
|
+
"gm_per_game",
|
|
324
|
+
),
|
|
175
325
|
)
|
|
176
326
|
|
|
177
327
|
@classmethod
|
|
178
328
|
def get_aggregation_column(cls):
|
|
179
|
-
raise NotImplementedError(
|
|
329
|
+
raise NotImplementedError(
|
|
330
|
+
"Subclasses should implement this method to return the aggregation column name."
|
|
331
|
+
)
|
|
332
|
+
|
|
180
333
|
|
|
181
334
|
class BaseStatsScorekeeper(db.Model):
|
|
182
335
|
__abstract__ = True
|
|
183
336
|
id = db.Column(db.Integer, primary_key=True)
|
|
184
|
-
human_id = db.Column(db.Integer, db.ForeignKey(
|
|
185
|
-
games_recorded = db.Column(
|
|
337
|
+
human_id = db.Column(db.Integer, db.ForeignKey("humans.id"), nullable=False)
|
|
338
|
+
games_recorded = db.Column(
|
|
339
|
+
db.Integer, default=0
|
|
340
|
+
) # DEPRECATED - use games_participated instead
|
|
186
341
|
games_recorded_rank = db.Column(db.Integer, default=0)
|
|
187
|
-
games_participated = db.Column(
|
|
342
|
+
games_participated = db.Column(
|
|
343
|
+
db.Integer, default=0
|
|
344
|
+
) # Count FINAL, FINAL_SO, FORFEIT, NOEVENTS
|
|
188
345
|
games_participated_rank = db.Column(db.Integer, default=0)
|
|
189
|
-
games_with_stats = db.Column(
|
|
346
|
+
games_with_stats = db.Column(
|
|
347
|
+
db.Integer, default=0
|
|
348
|
+
) # Count only FINAL, FINAL_SO (for per-game averages)
|
|
190
349
|
games_with_stats_rank = db.Column(db.Integer, default=0)
|
|
191
350
|
sog_given = db.Column(db.Integer, default=0)
|
|
192
351
|
sog_given_rank = db.Column(db.Integer, default=0)
|
|
@@ -210,471 +369,556 @@ class BaseStatsScorekeeper(db.Model):
|
|
|
210
369
|
quality_score_rank = db.Column(db.Integer, default=0)
|
|
211
370
|
|
|
212
371
|
total_in_rank = db.Column(db.Integer, default=0)
|
|
213
|
-
first_game_id = db.Column(db.Integer, db.ForeignKey(
|
|
214
|
-
last_game_id = db.Column(db.Integer, db.ForeignKey(
|
|
372
|
+
first_game_id = db.Column(db.Integer, db.ForeignKey("games.id"))
|
|
373
|
+
last_game_id = db.Column(db.Integer, db.ForeignKey("games.id"))
|
|
215
374
|
|
|
216
375
|
@declared_attr
|
|
217
376
|
def __table_args__(cls):
|
|
218
377
|
return (
|
|
219
|
-
db.UniqueConstraint(
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
db.Index(
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
db.Index(
|
|
378
|
+
db.UniqueConstraint(
|
|
379
|
+
"human_id",
|
|
380
|
+
cls.get_aggregation_column(),
|
|
381
|
+
name=f"_human_{cls.aggregation_type}_uc_scorekeeper1",
|
|
382
|
+
),
|
|
383
|
+
db.Index(
|
|
384
|
+
f"idx_{cls.aggregation_type}_games_recorded1",
|
|
385
|
+
cls.get_aggregation_column(),
|
|
386
|
+
"games_recorded",
|
|
387
|
+
),
|
|
388
|
+
db.Index(
|
|
389
|
+
f"idx_{cls.aggregation_type}_sog_given1",
|
|
390
|
+
cls.get_aggregation_column(),
|
|
391
|
+
"sog_given",
|
|
392
|
+
),
|
|
393
|
+
db.Index(
|
|
394
|
+
f"idx_{cls.aggregation_type}_sog_per_game1",
|
|
395
|
+
cls.get_aggregation_column(),
|
|
396
|
+
"sog_per_game",
|
|
397
|
+
),
|
|
398
|
+
db.Index(
|
|
399
|
+
f"idx_{cls.aggregation_type}_total_saves_recorded1",
|
|
400
|
+
cls.get_aggregation_column(),
|
|
401
|
+
"total_saves_recorded",
|
|
402
|
+
),
|
|
403
|
+
db.Index(
|
|
404
|
+
f"idx_{cls.aggregation_type}_avg_saves_per_game1",
|
|
405
|
+
cls.get_aggregation_column(),
|
|
406
|
+
"avg_saves_per_game",
|
|
407
|
+
),
|
|
408
|
+
db.Index(
|
|
409
|
+
f"idx_{cls.aggregation_type}_avg_max_saves_per_5sec1",
|
|
410
|
+
cls.get_aggregation_column(),
|
|
411
|
+
"avg_max_saves_per_5sec",
|
|
412
|
+
),
|
|
413
|
+
db.Index(
|
|
414
|
+
f"idx_{cls.aggregation_type}_avg_max_saves_per_20sec1",
|
|
415
|
+
cls.get_aggregation_column(),
|
|
416
|
+
"avg_max_saves_per_20sec",
|
|
417
|
+
),
|
|
418
|
+
db.Index(
|
|
419
|
+
f"idx_{cls.aggregation_type}_peak_max_saves_per_5sec1",
|
|
420
|
+
cls.get_aggregation_column(),
|
|
421
|
+
"peak_max_saves_per_5sec",
|
|
422
|
+
),
|
|
423
|
+
db.Index(
|
|
424
|
+
f"idx_{cls.aggregation_type}_peak_max_saves_per_20sec1",
|
|
425
|
+
cls.get_aggregation_column(),
|
|
426
|
+
"peak_max_saves_per_20sec",
|
|
427
|
+
),
|
|
428
|
+
db.Index(
|
|
429
|
+
f"idx_{cls.aggregation_type}_quality_score1",
|
|
430
|
+
cls.get_aggregation_column(),
|
|
431
|
+
"quality_score",
|
|
432
|
+
),
|
|
230
433
|
)
|
|
231
434
|
|
|
232
435
|
@classmethod
|
|
233
436
|
def get_aggregation_column(cls):
|
|
234
|
-
raise NotImplementedError(
|
|
437
|
+
raise NotImplementedError(
|
|
438
|
+
"Subclasses should implement this method to return the aggregation column name."
|
|
439
|
+
)
|
|
440
|
+
|
|
235
441
|
|
|
236
442
|
class OrgStatsHuman(BaseStatsHuman):
|
|
237
|
-
__tablename__ =
|
|
238
|
-
org_id = db.Column(db.Integer, db.ForeignKey(
|
|
239
|
-
aggregation_id = synonym(
|
|
443
|
+
__tablename__ = "org_stats_human"
|
|
444
|
+
org_id = db.Column(db.Integer, db.ForeignKey("organizations.id"), nullable=False)
|
|
445
|
+
aggregation_id = synonym("org_id")
|
|
240
446
|
|
|
241
447
|
@declared_attr
|
|
242
448
|
def aggregation_type(cls):
|
|
243
|
-
return
|
|
449
|
+
return "org"
|
|
244
450
|
|
|
245
451
|
@classmethod
|
|
246
452
|
def get_aggregation_column(cls):
|
|
247
|
-
return
|
|
453
|
+
return "org_id"
|
|
454
|
+
|
|
248
455
|
|
|
249
456
|
class DivisionStatsHuman(BaseStatsHuman):
|
|
250
|
-
__tablename__ =
|
|
251
|
-
division_id = db.Column(db.Integer, db.ForeignKey(
|
|
252
|
-
aggregation_id = synonym(
|
|
457
|
+
__tablename__ = "division_stats_human"
|
|
458
|
+
division_id = db.Column(db.Integer, db.ForeignKey("divisions.id"), nullable=False)
|
|
459
|
+
aggregation_id = synonym("division_id")
|
|
253
460
|
|
|
254
461
|
@declared_attr
|
|
255
462
|
def aggregation_type(cls):
|
|
256
|
-
return
|
|
463
|
+
return "division"
|
|
257
464
|
|
|
258
465
|
@classmethod
|
|
259
466
|
def get_aggregation_column(cls):
|
|
260
|
-
return
|
|
467
|
+
return "division_id"
|
|
468
|
+
|
|
261
469
|
|
|
262
470
|
class LevelStatsHuman(BaseStatsHuman):
|
|
263
|
-
__tablename__ =
|
|
264
|
-
level_id = db.Column(db.Integer, db.ForeignKey(
|
|
265
|
-
aggregation_id = synonym(
|
|
471
|
+
__tablename__ = "level_stats_human"
|
|
472
|
+
level_id = db.Column(db.Integer, db.ForeignKey("levels.id"), nullable=False)
|
|
473
|
+
aggregation_id = synonym("level_id")
|
|
266
474
|
|
|
267
475
|
@declared_attr
|
|
268
476
|
def aggregation_type(cls):
|
|
269
|
-
return
|
|
477
|
+
return "level"
|
|
270
478
|
|
|
271
479
|
@classmethod
|
|
272
480
|
def get_aggregation_column(cls):
|
|
273
|
-
return
|
|
481
|
+
return "level_id"
|
|
482
|
+
|
|
274
483
|
|
|
275
484
|
class OrgStatsSkater(BaseStatsSkater):
|
|
276
|
-
__tablename__ =
|
|
277
|
-
org_id = db.Column(db.Integer, db.ForeignKey(
|
|
278
|
-
aggregation_id = synonym(
|
|
485
|
+
__tablename__ = "org_stats_skater"
|
|
486
|
+
org_id = db.Column(db.Integer, db.ForeignKey("organizations.id"), nullable=False)
|
|
487
|
+
aggregation_id = synonym("org_id")
|
|
279
488
|
|
|
280
489
|
@declared_attr
|
|
281
490
|
def aggregation_type(cls):
|
|
282
|
-
return
|
|
491
|
+
return "org"
|
|
283
492
|
|
|
284
493
|
@classmethod
|
|
285
494
|
def get_aggregation_column(cls):
|
|
286
|
-
return
|
|
495
|
+
return "org_id"
|
|
496
|
+
|
|
287
497
|
|
|
288
498
|
class DivisionStatsSkater(BaseStatsSkater):
|
|
289
|
-
__tablename__ =
|
|
290
|
-
division_id = db.Column(db.Integer, db.ForeignKey(
|
|
291
|
-
aggregation_id = synonym(
|
|
499
|
+
__tablename__ = "division_stats_skater"
|
|
500
|
+
division_id = db.Column(db.Integer, db.ForeignKey("divisions.id"), nullable=False)
|
|
501
|
+
aggregation_id = synonym("division_id")
|
|
292
502
|
|
|
293
503
|
@declared_attr
|
|
294
504
|
def aggregation_type(cls):
|
|
295
|
-
return
|
|
505
|
+
return "division"
|
|
296
506
|
|
|
297
507
|
@classmethod
|
|
298
508
|
def get_aggregation_column(cls):
|
|
299
|
-
return
|
|
509
|
+
return "division_id"
|
|
510
|
+
|
|
300
511
|
|
|
301
512
|
class LevelStatsSkater(BaseStatsSkater):
|
|
302
|
-
__tablename__ =
|
|
303
|
-
level_id = db.Column(db.Integer, db.ForeignKey(
|
|
304
|
-
aggregation_id = synonym(
|
|
513
|
+
__tablename__ = "level_stats_skater"
|
|
514
|
+
level_id = db.Column(db.Integer, db.ForeignKey("levels.id"), nullable=False)
|
|
515
|
+
aggregation_id = synonym("level_id")
|
|
305
516
|
|
|
306
517
|
@declared_attr
|
|
307
518
|
def aggregation_type(cls):
|
|
308
|
-
return
|
|
519
|
+
return "level"
|
|
309
520
|
|
|
310
521
|
@classmethod
|
|
311
522
|
def get_aggregation_column(cls):
|
|
312
|
-
return
|
|
523
|
+
return "level_id"
|
|
313
524
|
|
|
314
525
|
|
|
315
526
|
class OrgStatsGoalie(BaseStatsGoalie):
|
|
316
|
-
__tablename__ =
|
|
317
|
-
org_id = db.Column(db.Integer, db.ForeignKey(
|
|
318
|
-
aggregation_id = synonym(
|
|
527
|
+
__tablename__ = "org_stats_goalie"
|
|
528
|
+
org_id = db.Column(db.Integer, db.ForeignKey("organizations.id"), nullable=False)
|
|
529
|
+
aggregation_id = synonym("org_id")
|
|
319
530
|
|
|
320
531
|
@declared_attr
|
|
321
532
|
def aggregation_type(cls):
|
|
322
|
-
return
|
|
533
|
+
return "org"
|
|
323
534
|
|
|
324
535
|
@classmethod
|
|
325
536
|
def get_aggregation_column(cls):
|
|
326
|
-
return
|
|
537
|
+
return "org_id"
|
|
538
|
+
|
|
327
539
|
|
|
328
540
|
class DivisionStatsGoalie(BaseStatsGoalie):
|
|
329
|
-
__tablename__ =
|
|
330
|
-
division_id = db.Column(db.Integer, db.ForeignKey(
|
|
331
|
-
aggregation_id = synonym(
|
|
541
|
+
__tablename__ = "division_stats_goalie"
|
|
542
|
+
division_id = db.Column(db.Integer, db.ForeignKey("divisions.id"), nullable=False)
|
|
543
|
+
aggregation_id = synonym("division_id")
|
|
332
544
|
|
|
333
545
|
@declared_attr
|
|
334
546
|
def aggregation_type(cls):
|
|
335
|
-
return
|
|
547
|
+
return "division"
|
|
336
548
|
|
|
337
549
|
@classmethod
|
|
338
550
|
def get_aggregation_column(cls):
|
|
339
|
-
return
|
|
551
|
+
return "division_id"
|
|
552
|
+
|
|
340
553
|
|
|
341
554
|
class LevelStatsGoalie(BaseStatsGoalie):
|
|
342
|
-
__tablename__ =
|
|
343
|
-
level_id = db.Column(db.Integer, db.ForeignKey(
|
|
344
|
-
aggregation_id = synonym(
|
|
555
|
+
__tablename__ = "level_stats_goalie"
|
|
556
|
+
level_id = db.Column(db.Integer, db.ForeignKey("levels.id"), nullable=False)
|
|
557
|
+
aggregation_id = synonym("level_id")
|
|
345
558
|
|
|
346
559
|
@declared_attr
|
|
347
560
|
def aggregation_type(cls):
|
|
348
|
-
return
|
|
561
|
+
return "level"
|
|
349
562
|
|
|
350
563
|
@classmethod
|
|
351
564
|
def get_aggregation_column(cls):
|
|
352
|
-
return
|
|
565
|
+
return "level_id"
|
|
353
566
|
|
|
354
567
|
|
|
355
568
|
class OrgStatsReferee(BaseStatsReferee):
|
|
356
|
-
__tablename__ =
|
|
357
|
-
org_id = db.Column(db.Integer, db.ForeignKey(
|
|
358
|
-
aggregation_id = synonym(
|
|
569
|
+
__tablename__ = "org_stats_referee"
|
|
570
|
+
org_id = db.Column(db.Integer, db.ForeignKey("organizations.id"), nullable=False)
|
|
571
|
+
aggregation_id = synonym("org_id")
|
|
359
572
|
|
|
360
573
|
@declared_attr
|
|
361
574
|
def aggregation_type(cls):
|
|
362
|
-
return
|
|
575
|
+
return "org"
|
|
363
576
|
|
|
364
577
|
@classmethod
|
|
365
578
|
def get_aggregation_column(cls):
|
|
366
|
-
return
|
|
579
|
+
return "org_id"
|
|
580
|
+
|
|
367
581
|
|
|
368
582
|
class DivisionStatsReferee(BaseStatsReferee):
|
|
369
|
-
__tablename__ =
|
|
370
|
-
division_id = db.Column(db.Integer, db.ForeignKey(
|
|
371
|
-
aggregation_id = synonym(
|
|
583
|
+
__tablename__ = "division_stats_referee"
|
|
584
|
+
division_id = db.Column(db.Integer, db.ForeignKey("divisions.id"), nullable=False)
|
|
585
|
+
aggregation_id = synonym("division_id")
|
|
372
586
|
|
|
373
587
|
@declared_attr
|
|
374
588
|
def aggregation_type(cls):
|
|
375
|
-
return
|
|
589
|
+
return "division"
|
|
376
590
|
|
|
377
591
|
@classmethod
|
|
378
592
|
def get_aggregation_column(cls):
|
|
379
|
-
return
|
|
593
|
+
return "division_id"
|
|
594
|
+
|
|
380
595
|
|
|
381
596
|
class LevelStatsReferee(BaseStatsReferee):
|
|
382
|
-
__tablename__ =
|
|
383
|
-
level_id = db.Column(db.Integer, db.ForeignKey(
|
|
384
|
-
aggregation_id = synonym(
|
|
597
|
+
__tablename__ = "level_stats_referee"
|
|
598
|
+
level_id = db.Column(db.Integer, db.ForeignKey("levels.id"), nullable=False)
|
|
599
|
+
aggregation_id = synonym("level_id")
|
|
385
600
|
|
|
386
601
|
@declared_attr
|
|
387
602
|
def aggregation_type(cls):
|
|
388
|
-
return
|
|
603
|
+
return "level"
|
|
389
604
|
|
|
390
605
|
@classmethod
|
|
391
606
|
def get_aggregation_column(cls):
|
|
392
|
-
return
|
|
607
|
+
return "level_id"
|
|
393
608
|
|
|
394
609
|
|
|
395
610
|
class OrgStatsScorekeeper(BaseStatsScorekeeper):
|
|
396
|
-
__tablename__ =
|
|
397
|
-
org_id = db.Column(db.Integer, db.ForeignKey(
|
|
398
|
-
aggregation_id = synonym(
|
|
611
|
+
__tablename__ = "org_stats_scorekeeper"
|
|
612
|
+
org_id = db.Column(db.Integer, db.ForeignKey("organizations.id"), nullable=False)
|
|
613
|
+
aggregation_id = synonym("org_id")
|
|
399
614
|
|
|
400
615
|
@declared_attr
|
|
401
616
|
def aggregation_type(cls):
|
|
402
|
-
return
|
|
617
|
+
return "org"
|
|
403
618
|
|
|
404
619
|
@classmethod
|
|
405
620
|
def get_aggregation_column(cls):
|
|
406
|
-
return
|
|
621
|
+
return "org_id"
|
|
407
622
|
|
|
408
623
|
|
|
409
624
|
class OrgStatsDailyHuman(BaseStatsHuman):
|
|
410
|
-
__tablename__ =
|
|
411
|
-
org_id = db.Column(db.Integer, db.ForeignKey(
|
|
412
|
-
aggregation_id = synonym(
|
|
625
|
+
__tablename__ = "org_stats_daily_human"
|
|
626
|
+
org_id = db.Column(db.Integer, db.ForeignKey("organizations.id"), nullable=False)
|
|
627
|
+
aggregation_id = synonym("org_id")
|
|
413
628
|
|
|
414
629
|
@classmethod
|
|
415
630
|
def get_aggregation_column(cls):
|
|
416
|
-
return
|
|
417
|
-
|
|
631
|
+
return "org_id"
|
|
632
|
+
|
|
418
633
|
@declared_attr
|
|
419
634
|
def aggregation_type(cls):
|
|
420
|
-
return
|
|
635
|
+
return "org_daily"
|
|
636
|
+
|
|
421
637
|
|
|
422
638
|
class OrgStatsWeeklyHuman(BaseStatsHuman):
|
|
423
|
-
__tablename__ =
|
|
424
|
-
org_id = db.Column(db.Integer, db.ForeignKey(
|
|
425
|
-
aggregation_id = synonym(
|
|
639
|
+
__tablename__ = "org_stats_weekly_human"
|
|
640
|
+
org_id = db.Column(db.Integer, db.ForeignKey("organizations.id"), nullable=False)
|
|
641
|
+
aggregation_id = synonym("org_id")
|
|
426
642
|
|
|
427
643
|
@classmethod
|
|
428
644
|
def get_aggregation_column(cls):
|
|
429
|
-
return
|
|
645
|
+
return "org_id"
|
|
430
646
|
|
|
431
647
|
@declared_attr
|
|
432
648
|
def aggregation_type(cls):
|
|
433
|
-
return
|
|
649
|
+
return "org_weekly"
|
|
650
|
+
|
|
434
651
|
|
|
435
652
|
class DivisionStatsDailyHuman(BaseStatsHuman):
|
|
436
|
-
__tablename__ =
|
|
437
|
-
division_id = db.Column(db.Integer, db.ForeignKey(
|
|
438
|
-
aggregation_id = synonym(
|
|
653
|
+
__tablename__ = "division_stats_daily_human"
|
|
654
|
+
division_id = db.Column(db.Integer, db.ForeignKey("divisions.id"), nullable=False)
|
|
655
|
+
aggregation_id = synonym("division_id")
|
|
439
656
|
|
|
440
657
|
@classmethod
|
|
441
658
|
def get_aggregation_column(cls):
|
|
442
|
-
return
|
|
659
|
+
return "division_id"
|
|
443
660
|
|
|
444
661
|
@declared_attr
|
|
445
662
|
def aggregation_type(cls):
|
|
446
|
-
return
|
|
663
|
+
return "division_daily"
|
|
664
|
+
|
|
447
665
|
|
|
448
666
|
class DivisionStatsWeeklyHuman(BaseStatsHuman):
|
|
449
|
-
__tablename__ =
|
|
450
|
-
division_id = db.Column(db.Integer, db.ForeignKey(
|
|
451
|
-
aggregation_id = synonym(
|
|
667
|
+
__tablename__ = "division_stats_weekly_human"
|
|
668
|
+
division_id = db.Column(db.Integer, db.ForeignKey("divisions.id"), nullable=False)
|
|
669
|
+
aggregation_id = synonym("division_id")
|
|
452
670
|
|
|
453
671
|
@classmethod
|
|
454
672
|
def get_aggregation_column(cls):
|
|
455
|
-
return
|
|
673
|
+
return "division_id"
|
|
456
674
|
|
|
457
675
|
@declared_attr
|
|
458
676
|
def aggregation_type(cls):
|
|
459
|
-
return
|
|
677
|
+
return "division_weekly"
|
|
678
|
+
|
|
460
679
|
|
|
461
680
|
class OrgStatsDailySkater(BaseStatsSkater):
|
|
462
|
-
__tablename__ =
|
|
463
|
-
org_id = db.Column(db.Integer, db.ForeignKey(
|
|
464
|
-
aggregation_id = synonym(
|
|
681
|
+
__tablename__ = "org_stats_daily_skater"
|
|
682
|
+
org_id = db.Column(db.Integer, db.ForeignKey("organizations.id"), nullable=False)
|
|
683
|
+
aggregation_id = synonym("org_id")
|
|
465
684
|
|
|
466
685
|
@declared_attr
|
|
467
686
|
def aggregation_type(cls):
|
|
468
|
-
return
|
|
687
|
+
return "org_daily"
|
|
469
688
|
|
|
470
689
|
@classmethod
|
|
471
690
|
def get_aggregation_column(cls):
|
|
472
|
-
return
|
|
691
|
+
return "org_id"
|
|
692
|
+
|
|
473
693
|
|
|
474
694
|
class OrgStatsWeeklySkater(BaseStatsSkater):
|
|
475
|
-
__tablename__ =
|
|
476
|
-
org_id = db.Column(db.Integer, db.ForeignKey(
|
|
477
|
-
aggregation_id = synonym(
|
|
695
|
+
__tablename__ = "org_stats_weekly_skater"
|
|
696
|
+
org_id = db.Column(db.Integer, db.ForeignKey("organizations.id"), nullable=False)
|
|
697
|
+
aggregation_id = synonym("org_id")
|
|
478
698
|
|
|
479
699
|
@declared_attr
|
|
480
700
|
def aggregation_type(cls):
|
|
481
|
-
return
|
|
701
|
+
return "org_weekly"
|
|
482
702
|
|
|
483
703
|
@classmethod
|
|
484
704
|
def get_aggregation_column(cls):
|
|
485
|
-
return
|
|
705
|
+
return "org_id"
|
|
706
|
+
|
|
486
707
|
|
|
487
708
|
class DivisionStatsDailySkater(BaseStatsSkater):
|
|
488
|
-
__tablename__ =
|
|
489
|
-
division_id = db.Column(db.Integer, db.ForeignKey(
|
|
490
|
-
aggregation_id = synonym(
|
|
709
|
+
__tablename__ = "division_stats_daily_skater"
|
|
710
|
+
division_id = db.Column(db.Integer, db.ForeignKey("divisions.id"), nullable=False)
|
|
711
|
+
aggregation_id = synonym("division_id")
|
|
491
712
|
|
|
492
713
|
@declared_attr
|
|
493
714
|
def aggregation_type(cls):
|
|
494
|
-
return
|
|
715
|
+
return "division_daily"
|
|
495
716
|
|
|
496
717
|
@classmethod
|
|
497
718
|
def get_aggregation_column(cls):
|
|
498
|
-
return
|
|
719
|
+
return "division_id"
|
|
720
|
+
|
|
499
721
|
|
|
500
722
|
class DivisionStatsWeeklySkater(BaseStatsSkater):
|
|
501
|
-
__tablename__ =
|
|
502
|
-
division_id = db.Column(db.Integer, db.ForeignKey(
|
|
503
|
-
aggregation_id = synonym(
|
|
723
|
+
__tablename__ = "division_stats_weekly_skater"
|
|
724
|
+
division_id = db.Column(db.Integer, db.ForeignKey("divisions.id"), nullable=False)
|
|
725
|
+
aggregation_id = synonym("division_id")
|
|
504
726
|
|
|
505
727
|
@declared_attr
|
|
506
728
|
def aggregation_type(cls):
|
|
507
|
-
return
|
|
729
|
+
return "division_weekly"
|
|
508
730
|
|
|
509
731
|
@classmethod
|
|
510
732
|
def get_aggregation_column(cls):
|
|
511
|
-
return
|
|
733
|
+
return "division_id"
|
|
734
|
+
|
|
512
735
|
|
|
513
736
|
class OrgStatsDailyGoalie(BaseStatsGoalie):
|
|
514
|
-
__tablename__ =
|
|
515
|
-
org_id = db.Column(db.Integer, db.ForeignKey(
|
|
516
|
-
aggregation_id = synonym(
|
|
737
|
+
__tablename__ = "org_stats_daily_goalie"
|
|
738
|
+
org_id = db.Column(db.Integer, db.ForeignKey("organizations.id"), nullable=False)
|
|
739
|
+
aggregation_id = synonym("org_id")
|
|
517
740
|
|
|
518
741
|
@declared_attr
|
|
519
742
|
def aggregation_type(cls):
|
|
520
|
-
return
|
|
743
|
+
return "org_daily"
|
|
521
744
|
|
|
522
745
|
@classmethod
|
|
523
746
|
def get_aggregation_column(cls):
|
|
524
|
-
return
|
|
747
|
+
return "org_id"
|
|
748
|
+
|
|
525
749
|
|
|
526
750
|
class OrgStatsWeeklyGoalie(BaseStatsGoalie):
|
|
527
|
-
__tablename__ =
|
|
528
|
-
org_id = db.Column(db.Integer, db.ForeignKey(
|
|
529
|
-
aggregation_id = synonym(
|
|
751
|
+
__tablename__ = "org_stats_weekly_goalie"
|
|
752
|
+
org_id = db.Column(db.Integer, db.ForeignKey("organizations.id"), nullable=False)
|
|
753
|
+
aggregation_id = synonym("org_id")
|
|
530
754
|
|
|
531
755
|
@declared_attr
|
|
532
756
|
def aggregation_type(cls):
|
|
533
|
-
return
|
|
757
|
+
return "org_weekly"
|
|
534
758
|
|
|
535
759
|
@classmethod
|
|
536
760
|
def get_aggregation_column(cls):
|
|
537
|
-
return
|
|
761
|
+
return "org_id"
|
|
762
|
+
|
|
538
763
|
|
|
539
764
|
class DivisionStatsDailyGoalie(BaseStatsGoalie):
|
|
540
|
-
__tablename__ =
|
|
541
|
-
division_id = db.Column(db.Integer, db.ForeignKey(
|
|
542
|
-
aggregation_id = synonym(
|
|
765
|
+
__tablename__ = "division_stats_daily_goalie"
|
|
766
|
+
division_id = db.Column(db.Integer, db.ForeignKey("divisions.id"), nullable=False)
|
|
767
|
+
aggregation_id = synonym("division_id")
|
|
543
768
|
|
|
544
769
|
@declared_attr
|
|
545
770
|
def aggregation_type(cls):
|
|
546
|
-
return
|
|
771
|
+
return "division_daily"
|
|
547
772
|
|
|
548
773
|
@classmethod
|
|
549
774
|
def get_aggregation_column(cls):
|
|
550
|
-
return
|
|
775
|
+
return "division_id"
|
|
776
|
+
|
|
551
777
|
|
|
552
778
|
class DivisionStatsWeeklyGoalie(BaseStatsGoalie):
|
|
553
|
-
__tablename__ =
|
|
554
|
-
division_id = db.Column(db.Integer, db.ForeignKey(
|
|
555
|
-
aggregation_id = synonym(
|
|
779
|
+
__tablename__ = "division_stats_weekly_goalie"
|
|
780
|
+
division_id = db.Column(db.Integer, db.ForeignKey("divisions.id"), nullable=False)
|
|
781
|
+
aggregation_id = synonym("division_id")
|
|
556
782
|
|
|
557
783
|
@declared_attr
|
|
558
784
|
def aggregation_type(cls):
|
|
559
|
-
return
|
|
785
|
+
return "division_weekly"
|
|
560
786
|
|
|
561
787
|
@classmethod
|
|
562
788
|
def get_aggregation_column(cls):
|
|
563
|
-
return
|
|
789
|
+
return "division_id"
|
|
790
|
+
|
|
564
791
|
|
|
565
792
|
class OrgStatsDailyReferee(BaseStatsReferee):
|
|
566
|
-
__tablename__ =
|
|
567
|
-
org_id = db.Column(db.Integer, db.ForeignKey(
|
|
568
|
-
aggregation_id = synonym(
|
|
793
|
+
__tablename__ = "org_stats_daily_referee"
|
|
794
|
+
org_id = db.Column(db.Integer, db.ForeignKey("organizations.id"), nullable=False)
|
|
795
|
+
aggregation_id = synonym("org_id")
|
|
569
796
|
|
|
570
797
|
@declared_attr
|
|
571
798
|
def aggregation_type(cls):
|
|
572
|
-
return
|
|
799
|
+
return "org_daily"
|
|
573
800
|
|
|
574
801
|
@classmethod
|
|
575
802
|
def get_aggregation_column(cls):
|
|
576
|
-
return
|
|
803
|
+
return "org_id"
|
|
804
|
+
|
|
577
805
|
|
|
578
806
|
class OrgStatsWeeklyReferee(BaseStatsReferee):
|
|
579
|
-
__tablename__ =
|
|
580
|
-
org_id = db.Column(db.Integer, db.ForeignKey(
|
|
581
|
-
aggregation_id = synonym(
|
|
807
|
+
__tablename__ = "org_stats_weekly_referee"
|
|
808
|
+
org_id = db.Column(db.Integer, db.ForeignKey("organizations.id"), nullable=False)
|
|
809
|
+
aggregation_id = synonym("org_id")
|
|
582
810
|
|
|
583
811
|
@declared_attr
|
|
584
812
|
def aggregation_type(cls):
|
|
585
|
-
return
|
|
813
|
+
return "org_weekly"
|
|
586
814
|
|
|
587
815
|
@classmethod
|
|
588
816
|
def get_aggregation_column(cls):
|
|
589
|
-
return
|
|
817
|
+
return "org_id"
|
|
818
|
+
|
|
590
819
|
|
|
591
820
|
class DivisionStatsDailyReferee(BaseStatsReferee):
|
|
592
|
-
__tablename__ =
|
|
593
|
-
division_id = db.Column(db.Integer, db.ForeignKey(
|
|
594
|
-
aggregation_id = synonym(
|
|
821
|
+
__tablename__ = "division_stats_daily_referee"
|
|
822
|
+
division_id = db.Column(db.Integer, db.ForeignKey("divisions.id"), nullable=False)
|
|
823
|
+
aggregation_id = synonym("division_id")
|
|
595
824
|
|
|
596
825
|
@declared_attr
|
|
597
826
|
def aggregation_type(cls):
|
|
598
|
-
return
|
|
827
|
+
return "division_daily"
|
|
599
828
|
|
|
600
829
|
@classmethod
|
|
601
830
|
def get_aggregation_column(cls):
|
|
602
|
-
return
|
|
831
|
+
return "division_id"
|
|
832
|
+
|
|
603
833
|
|
|
604
834
|
class DivisionStatsWeeklyReferee(BaseStatsReferee):
|
|
605
|
-
__tablename__ =
|
|
606
|
-
division_id = db.Column(db.Integer, db.ForeignKey(
|
|
607
|
-
aggregation_id = synonym(
|
|
835
|
+
__tablename__ = "division_stats_weekly_referee"
|
|
836
|
+
division_id = db.Column(db.Integer, db.ForeignKey("divisions.id"), nullable=False)
|
|
837
|
+
aggregation_id = synonym("division_id")
|
|
608
838
|
|
|
609
839
|
@declared_attr
|
|
610
840
|
def aggregation_type(cls):
|
|
611
|
-
return
|
|
841
|
+
return "division_weekly"
|
|
612
842
|
|
|
613
843
|
@classmethod
|
|
614
844
|
def get_aggregation_column(cls):
|
|
615
|
-
return
|
|
845
|
+
return "division_id"
|
|
846
|
+
|
|
616
847
|
|
|
617
848
|
class OrgStatsDailyScorekeeper(BaseStatsScorekeeper):
|
|
618
|
-
__tablename__ =
|
|
619
|
-
org_id = db.Column(db.Integer, db.ForeignKey(
|
|
620
|
-
aggregation_id = synonym(
|
|
849
|
+
__tablename__ = "org_stats_daily_scorekeeper"
|
|
850
|
+
org_id = db.Column(db.Integer, db.ForeignKey("organizations.id"), nullable=False)
|
|
851
|
+
aggregation_id = synonym("org_id")
|
|
621
852
|
|
|
622
853
|
@declared_attr
|
|
623
854
|
def aggregation_type(cls):
|
|
624
|
-
return
|
|
855
|
+
return "org_daily"
|
|
625
856
|
|
|
626
857
|
@classmethod
|
|
627
858
|
def get_aggregation_column(cls):
|
|
628
|
-
return
|
|
859
|
+
return "org_id"
|
|
860
|
+
|
|
629
861
|
|
|
630
862
|
class OrgStatsWeeklyScorekeeper(BaseStatsScorekeeper):
|
|
631
|
-
__tablename__ =
|
|
632
|
-
org_id = db.Column(db.Integer, db.ForeignKey(
|
|
633
|
-
aggregation_id = synonym(
|
|
863
|
+
__tablename__ = "org_stats_weekly_scorekeeper"
|
|
864
|
+
org_id = db.Column(db.Integer, db.ForeignKey("organizations.id"), nullable=False)
|
|
865
|
+
aggregation_id = synonym("org_id")
|
|
634
866
|
|
|
635
867
|
@declared_attr
|
|
636
868
|
def aggregation_type(cls):
|
|
637
|
-
return
|
|
869
|
+
return "org_weekly"
|
|
638
870
|
|
|
639
871
|
@classmethod
|
|
640
872
|
def get_aggregation_column(cls):
|
|
641
|
-
return
|
|
642
|
-
|
|
873
|
+
return "org_id"
|
|
643
874
|
|
|
644
875
|
|
|
645
876
|
class LevelsGraphEdge(db.Model):
|
|
646
|
-
__tablename__ =
|
|
877
|
+
__tablename__ = "levels_graph_edges"
|
|
647
878
|
id = db.Column(db.Integer, primary_key=True)
|
|
648
|
-
from_level_id = db.Column(db.Integer, db.ForeignKey(
|
|
649
|
-
to_level_id = db.Column(db.Integer, db.ForeignKey(
|
|
879
|
+
from_level_id = db.Column(db.Integer, db.ForeignKey("levels.id"), nullable=False)
|
|
880
|
+
to_level_id = db.Column(db.Integer, db.ForeignKey("levels.id"), nullable=False)
|
|
650
881
|
n_connections = db.Column(db.Integer, nullable=False)
|
|
651
882
|
ppg_ratio = db.Column(db.Float, nullable=False)
|
|
652
|
-
n_games = db.Column(
|
|
883
|
+
n_games = db.Column(
|
|
884
|
+
db.Integer, nullable=False
|
|
885
|
+
) # New field to store the number of games
|
|
653
886
|
|
|
654
887
|
__table_args__ = (
|
|
655
|
-
db.UniqueConstraint(
|
|
888
|
+
db.UniqueConstraint("from_level_id", "to_level_id", name="_from_to_level_uc"),
|
|
656
889
|
)
|
|
657
890
|
|
|
891
|
+
|
|
658
892
|
class SkillPropagationCorrelation(db.Model):
|
|
659
|
-
__tablename__ =
|
|
893
|
+
__tablename__ = "skill_propagation_correlation"
|
|
660
894
|
id = db.Column(db.Integer, primary_key=True)
|
|
661
895
|
skill_value_from = db.Column(db.Float, nullable=False)
|
|
662
896
|
skill_value_to = db.Column(db.Float, nullable=False)
|
|
663
897
|
ppg_ratio = db.Column(db.Float, nullable=False)
|
|
664
898
|
|
|
665
899
|
__table_args__ = (
|
|
666
|
-
db.UniqueConstraint(
|
|
900
|
+
db.UniqueConstraint(
|
|
901
|
+
"skill_value_from",
|
|
902
|
+
"skill_value_to",
|
|
903
|
+
"ppg_ratio",
|
|
904
|
+
name="_skill_value_ppg_ratio_uc",
|
|
905
|
+
),
|
|
667
906
|
)
|
|
668
907
|
|
|
908
|
+
|
|
669
909
|
# How PPG changes with INCREASING SKILL VALUES
|
|
670
910
|
class SkillValuePPGRatio(db.Model):
|
|
671
|
-
__tablename__ =
|
|
911
|
+
__tablename__ = "skill_value_ppg_ratios"
|
|
672
912
|
id = db.Column(db.Integer, primary_key=True)
|
|
673
913
|
from_skill_value = db.Column(db.Float, nullable=False)
|
|
674
914
|
to_skill_value = db.Column(db.Float, nullable=False)
|
|
675
915
|
ppg_ratio = db.Column(db.Float, nullable=False)
|
|
676
|
-
n_games = db.Column(
|
|
916
|
+
n_games = db.Column(
|
|
917
|
+
db.Integer, nullable=False
|
|
918
|
+
) # New field to store the sum of games
|
|
677
919
|
|
|
678
920
|
__table_args__ = (
|
|
679
|
-
db.UniqueConstraint(
|
|
921
|
+
db.UniqueConstraint(
|
|
922
|
+
"from_skill_value", "to_skill_value", name="_from_to_skill_value_uc"
|
|
923
|
+
),
|
|
680
924
|
)
|