hockey-blast-common-lib 0.1.9__py3-none-any.whl → 0.1.11__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_goalie_stats.py +4 -5
- hockey_blast_common_lib/aggregate_human_stats.py +4 -5
- hockey_blast_common_lib/aggregate_referee_stats.py +4 -4
- hockey_blast_common_lib/aggregate_skater_stats.py +5 -5
- hockey_blast_common_lib/utils.py +25 -1
- hockey_blast_common_lib/wsgi.py +10 -5
- {hockey_blast_common_lib-0.1.9.dist-info → hockey_blast_common_lib-0.1.11.dist-info}/METADATA +1 -1
- hockey_blast_common_lib-0.1.11.dist-info/RECORD +15 -0
- hockey_blast_common_lib/db_utils.py +0 -26
- hockey_blast_common_lib-0.1.9.dist-info/RECORD +0 -16
- {hockey_blast_common_lib-0.1.9.dist-info → hockey_blast_common_lib-0.1.11.dist-info}/WHEEL +0 -0
- {hockey_blast_common_lib-0.1.9.dist-info → hockey_blast_common_lib-0.1.11.dist-info}/top_level.txt +0 -0
@@ -5,13 +5,12 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
5
5
|
|
6
6
|
from datetime import datetime, timedelta
|
7
7
|
import sqlalchemy
|
8
|
-
from options import not_human_names
|
9
8
|
from hockey_blast_common_lib.models import Game, GameRoster
|
10
|
-
from stats_models import OrgStatsGoalie, DivisionStatsGoalie, OrgStatsWeeklyGoalie, OrgStatsDailyGoalie, DivisionStatsWeeklyGoalie, DivisionStatsDailyGoalie
|
11
|
-
from db_connection import create_session
|
9
|
+
from hockey_blast_common_lib.stats_models import OrgStatsGoalie, DivisionStatsGoalie, OrgStatsWeeklyGoalie, OrgStatsDailyGoalie, DivisionStatsWeeklyGoalie, DivisionStatsDailyGoalie
|
10
|
+
from hockey_blast_common_lib.db_connection import create_session
|
12
11
|
from sqlalchemy.sql import func, case
|
13
|
-
from options import parse_args, MIN_GAMES_FOR_ORG_STATS, MIN_GAMES_FOR_DIVISION_STATS
|
14
|
-
from utils import get_org_id_from_alias, get_human_ids_by_names, get_division_ids_for_last_season_in_all_leagues, get_all_division_ids_for_org
|
12
|
+
from hockey_blast_common_lib.options import not_human_names, parse_args, MIN_GAMES_FOR_ORG_STATS, MIN_GAMES_FOR_DIVISION_STATS
|
13
|
+
from hockey_blast_common_lib.utils import get_org_id_from_alias, get_human_ids_by_names, get_division_ids_for_last_season_in_all_leagues, get_all_division_ids_for_org
|
15
14
|
|
16
15
|
def aggregate_goalie_stats(session, aggregation_type, aggregation_id, names_to_filter_out, aggregation_window=None):
|
17
16
|
human_ids_to_filter = get_human_ids_by_names(session, names_to_filter_out)
|
@@ -7,12 +7,11 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
7
7
|
from datetime import datetime, timedelta
|
8
8
|
import sqlalchemy
|
9
9
|
from hockey_blast_common_lib.models import Game, GameRoster
|
10
|
-
from stats_models import OrgStatsHuman, DivisionStatsHuman, OrgStatsDailyHuman, OrgStatsWeeklyHuman, DivisionStatsDailyHuman, DivisionStatsWeeklyHuman
|
11
|
-
from db_connection import create_session
|
10
|
+
from hockey_blast_common_lib.stats_models import OrgStatsHuman, DivisionStatsHuman, OrgStatsDailyHuman, OrgStatsWeeklyHuman, DivisionStatsDailyHuman, DivisionStatsWeeklyHuman
|
11
|
+
from hockey_blast_common_lib.db_connection import create_session
|
12
12
|
from sqlalchemy.sql import func, case
|
13
|
-
from options import parse_args, MIN_GAMES_FOR_ORG_STATS, MIN_GAMES_FOR_DIVISION_STATS, not_human_names
|
14
|
-
from utils import get_org_id_from_alias, get_human_ids_by_names, get_division_ids_for_last_season_in_all_leagues
|
15
|
-
from db_utils import get_fake_human_for_stats
|
13
|
+
from hockey_blast_common_lib.options import parse_args, MIN_GAMES_FOR_ORG_STATS, MIN_GAMES_FOR_DIVISION_STATS, not_human_names
|
14
|
+
from hockey_blast_common_lib.utils import get_fake_human_for_stats, get_org_id_from_alias, get_human_ids_by_names, get_division_ids_for_last_season_in_all_leagues
|
16
15
|
|
17
16
|
def aggregate_human_stats(session, aggregation_type, aggregation_id, names_to_filter_out, human_id_filter=None, aggregation_window=None):
|
18
17
|
human_ids_to_filter = get_human_ids_by_names(session, names_to_filter_out)
|
@@ -7,11 +7,11 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
7
7
|
from datetime import datetime, timedelta
|
8
8
|
import sqlalchemy
|
9
9
|
from hockey_blast_common_lib.models import Game, Penalty
|
10
|
-
from stats_models import OrgStatsReferee, DivisionStatsReferee,OrgStatsWeeklyReferee, OrgStatsDailyReferee, DivisionStatsWeeklyReferee, DivisionStatsDailyReferee
|
11
|
-
from db_connection import create_session
|
10
|
+
from hockey_blast_common_lib.stats_models import OrgStatsReferee, DivisionStatsReferee,OrgStatsWeeklyReferee, OrgStatsDailyReferee, DivisionStatsWeeklyReferee, DivisionStatsDailyReferee
|
11
|
+
from hockey_blast_common_lib.db_connection import create_session
|
12
12
|
from sqlalchemy.sql import func, case
|
13
|
-
from options import parse_args, MIN_GAMES_FOR_ORG_STATS, MIN_GAMES_FOR_DIVISION_STATS, not_human_names
|
14
|
-
from utils import get_org_id_from_alias, get_human_ids_by_names, get_division_ids_for_last_season_in_all_leagues
|
13
|
+
from hockey_blast_common_lib.options import parse_args, MIN_GAMES_FOR_ORG_STATS, MIN_GAMES_FOR_DIVISION_STATS, not_human_names
|
14
|
+
from hockey_blast_common_lib.utils import get_org_id_from_alias, get_human_ids_by_names, get_division_ids_for_last_season_in_all_leagues
|
15
15
|
|
16
16
|
def aggregate_referee_stats(session, aggregation_type, aggregation_id, names_to_filter_out, aggregation_window=None):
|
17
17
|
human_ids_to_filter = get_human_ids_by_names(session, names_to_filter_out)
|
@@ -8,12 +8,12 @@ import sqlalchemy
|
|
8
8
|
from options import not_human_names
|
9
9
|
|
10
10
|
from hockey_blast_common_lib.models import Game, Goal, Penalty, GameRoster
|
11
|
-
from stats_models import OrgStatsSkater, DivisionStatsSkater, OrgStatsWeeklySkater, OrgStatsDailySkater, DivisionStatsWeeklySkater, DivisionStatsDailySkater
|
12
|
-
from db_connection import create_session
|
11
|
+
from hockey_blast_common_lib.stats_models import OrgStatsSkater, DivisionStatsSkater, OrgStatsWeeklySkater, OrgStatsDailySkater, DivisionStatsWeeklySkater, DivisionStatsDailySkater
|
12
|
+
from hockey_blast_common_lib.db_connection import create_session
|
13
13
|
from sqlalchemy.sql import func, case
|
14
|
-
from options import parse_args, MIN_GAMES_FOR_ORG_STATS, MIN_GAMES_FOR_DIVISION_STATS
|
15
|
-
from utils import get_org_id_from_alias, get_human_ids_by_names, get_division_ids_for_last_season_in_all_leagues
|
16
|
-
from sqlalchemy import func, case, and_
|
14
|
+
from hockey_blast_common_lib.options import parse_args, MIN_GAMES_FOR_ORG_STATS, MIN_GAMES_FOR_DIVISION_STATS
|
15
|
+
from hockey_blast_common_lib.utils import get_org_id_from_alias, get_human_ids_by_names, get_division_ids_for_last_season_in_all_leagues
|
16
|
+
from hockey_blast_common_lib.sqlalchemy import func, case, and_
|
17
17
|
|
18
18
|
def aggregate_skater_stats(session, aggregation_type, aggregation_id, names_to_filter_out, filter_human_id=None, aggregation_window=None):
|
19
19
|
human_ids_to_filter = get_human_ids_by_names(session, names_to_filter_out)
|
hockey_blast_common_lib/utils.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
import sys
|
2
2
|
import os
|
3
|
-
from datetime import datetime, timedelta
|
4
3
|
|
4
|
+
# Add the package directory to the Python path
|
5
|
+
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
5
6
|
|
6
7
|
from hockey_blast_common_lib.models import Organization, Human, Division
|
7
8
|
from sqlalchemy.sql import func
|
@@ -63,3 +64,26 @@ def get_division_ids_for_last_season_in_all_leagues(session, org_id):
|
|
63
64
|
def get_all_division_ids_for_org(session, org_id):
|
64
65
|
division_ids_for_org = session.query(Division.id).filter_by(org_id=org_id).all()
|
65
66
|
return [division_id.id for division_id in division_ids_for_org]
|
67
|
+
|
68
|
+
def get_fake_human_for_stats(session):
|
69
|
+
first_name = "Fake"
|
70
|
+
middle_name = "Stats"
|
71
|
+
last_name = "Human"
|
72
|
+
|
73
|
+
# Check if the human already exists
|
74
|
+
existing_human = session.query(Human).filter_by(first_name=first_name, middle_name=middle_name, last_name=last_name).first()
|
75
|
+
if existing_human:
|
76
|
+
return existing_human.id
|
77
|
+
|
78
|
+
# Create a new human
|
79
|
+
human = Human(first_name=first_name, middle_name=middle_name, last_name=last_name)
|
80
|
+
session.add(human)
|
81
|
+
session.commit() # Commit to get the human.id
|
82
|
+
|
83
|
+
return human.id
|
84
|
+
|
85
|
+
# TEST DB CONNECTION, PERMISSIONS...
|
86
|
+
# from hockey_blast_common_lib.db_connection import create_session
|
87
|
+
# session = create_session("hockey-blast-radonly")
|
88
|
+
# human_id = get_fake_human_for_stats(session)
|
89
|
+
# print(f"Human ID: {human_id}")
|
hockey_blast_common_lib/wsgi.py
CHANGED
@@ -1,12 +1,17 @@
|
|
1
|
+
import sys, os
|
2
|
+
|
3
|
+
# Add the package directory to the Python path
|
4
|
+
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
5
|
+
|
1
6
|
from flask_migrate import Migrate
|
2
7
|
from flask import Flask
|
3
|
-
from .models import *
|
4
|
-
from .stats_models import *
|
5
|
-
from .stats_models import db
|
6
|
-
from .db_connection import get_db_params
|
8
|
+
from hockey_blast_common_lib.models import *
|
9
|
+
from hockey_blast_common_lib.stats_models import *
|
10
|
+
from hockey_blast_common_lib.stats_models import db
|
11
|
+
from hockey_blast_common_lib.db_connection import get_db_params
|
7
12
|
|
8
13
|
app = Flask(__name__)
|
9
|
-
db_params = get_db_params("
|
14
|
+
db_params = get_db_params("bosshockey-blast-radonly")
|
10
15
|
db_url = f"postgresql://{db_params['user']}:{db_params['password']}@{db_params['host']}:{db_params['port']}/{db_params['dbname']}"
|
11
16
|
app.config['SQLALCHEMY_DATABASE_URI'] = db_url
|
12
17
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
hockey_blast_common_lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
hockey_blast_common_lib/aggregate_goalie_stats.py,sha256=d2qav46Rg2DNIYRj_Ubj1kpQmoPUJHKiwEWOVU25nD4,8742
|
3
|
+
hockey_blast_common_lib/aggregate_human_stats.py,sha256=88OMhTgQjzc9xIakf6kW9_lZwbSXkpsZy8C0pX-Wlq8,14229
|
4
|
+
hockey_blast_common_lib/aggregate_referee_stats.py,sha256=A0PTyEbPUjqfXxlJCDOVioFaQk9AyjjhiWEuRuu35v0,11036
|
5
|
+
hockey_blast_common_lib/aggregate_skater_stats.py,sha256=F5f-R5NvoTzku7qxWqg4eelw-FUjFkIfU5HMg0_yDxA,15606
|
6
|
+
hockey_blast_common_lib/db_connection.py,sha256=JJcYbBuGlstMfui7UwP5GxPRwzrh4PxtsZDpWsQPnqA,998
|
7
|
+
hockey_blast_common_lib/models.py,sha256=GqQIGpanmFub97BoYCuaqDov2MxM4LMesUTxZ2edpvw,15393
|
8
|
+
hockey_blast_common_lib/options.py,sha256=-LtEX8duw5Pl3CSpjFlLM5FPvrZuTAxTfSlDPa7H6mQ,761
|
9
|
+
hockey_blast_common_lib/stats_models.py,sha256=PI-mL1jmjCHLAvaATxSsjHEn05g9L_reA_YpsITPWjQ,21047
|
10
|
+
hockey_blast_common_lib/utils.py,sha256=OmeLVJSsjoBrE---w9MwXPKD3-UMZ9HB6a4YtsGDj30,3765
|
11
|
+
hockey_blast_common_lib/wsgi.py,sha256=wl1gf3KtaGSnYbCF5Z2xWwRXNSTQp43HoyhCAKJibI4,750
|
12
|
+
hockey_blast_common_lib-0.1.11.dist-info/METADATA,sha256=WP2Xg82QNYcS8KYeGTexxqjpfB71LvYR8Q2_hpA8aUE,318
|
13
|
+
hockey_blast_common_lib-0.1.11.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
14
|
+
hockey_blast_common_lib-0.1.11.dist-info/top_level.txt,sha256=wIR4LIkE40npoA2QlOdfCYlgFeGbsHR8Z6r0h46Vtgc,24
|
15
|
+
hockey_blast_common_lib-0.1.11.dist-info/RECORD,,
|
@@ -1,26 +0,0 @@
|
|
1
|
-
import sys
|
2
|
-
import os
|
3
|
-
|
4
|
-
from hockey_blast_common_lib.models import Human
|
5
|
-
from db_connection import create_session
|
6
|
-
|
7
|
-
def get_fake_human_for_stats(session):
|
8
|
-
first_name = "Fake"
|
9
|
-
middle_name = "Stats"
|
10
|
-
last_name = "Human"
|
11
|
-
|
12
|
-
# Check if the human already exists
|
13
|
-
existing_human = session.query(Human).filter_by(first_name=first_name, middle_name=middle_name, last_name=last_name).first()
|
14
|
-
if existing_human:
|
15
|
-
return existing_human.id
|
16
|
-
|
17
|
-
# Create a new human
|
18
|
-
human = Human(first_name=first_name, middle_name=middle_name, last_name=last_name)
|
19
|
-
session.add(human)
|
20
|
-
session.commit() # Commit to get the human.id
|
21
|
-
|
22
|
-
return human.id
|
23
|
-
|
24
|
-
# session = create_session("hockey-blast-radonly")
|
25
|
-
# human_id = get_fake_human_for_stats(session)
|
26
|
-
# print(f"Human ID: {human_id}")
|
@@ -1,16 +0,0 @@
|
|
1
|
-
hockey_blast_common_lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
hockey_blast_common_lib/aggregate_goalie_stats.py,sha256=-q4dBjROsRljmG4SXDdJjezRHvqyJ5D7xb8-Uj6HWaE,8665
|
3
|
-
hockey_blast_common_lib/aggregate_human_stats.py,sha256=-QpMHWGOYRq3uxr6jUNUnLb8UYSYoHEFrx6zyegrTzI,14153
|
4
|
-
hockey_blast_common_lib/aggregate_referee_stats.py,sha256=-vABfO88hlWwh8lfv6afST861SmqCdayVT8KAXwixG4,10940
|
5
|
-
hockey_blast_common_lib/aggregate_skater_stats.py,sha256=hD8QUFtxpbAuxSzJJecn2ccaYTISEOM83lRdo05e-20,15486
|
6
|
-
hockey_blast_common_lib/db_connection.py,sha256=JJcYbBuGlstMfui7UwP5GxPRwzrh4PxtsZDpWsQPnqA,998
|
7
|
-
hockey_blast_common_lib/db_utils.py,sha256=tN_cT587VqEfgYc7Nt-M-Mm_DwIHDxwPYA2Lmd1b_bw,791
|
8
|
-
hockey_blast_common_lib/models.py,sha256=GqQIGpanmFub97BoYCuaqDov2MxM4LMesUTxZ2edpvw,15393
|
9
|
-
hockey_blast_common_lib/options.py,sha256=-LtEX8duw5Pl3CSpjFlLM5FPvrZuTAxTfSlDPa7H6mQ,761
|
10
|
-
hockey_blast_common_lib/stats_models.py,sha256=PI-mL1jmjCHLAvaATxSsjHEn05g9L_reA_YpsITPWjQ,21047
|
11
|
-
hockey_blast_common_lib/utils.py,sha256=LhHfa-fI1j6_Er0eHlXiCPNQkty2G3CxSYgfFw_Taq8,2899
|
12
|
-
hockey_blast_common_lib/wsgi.py,sha256=Qpux4NpQQnZ2U3gOAsqualn-bv9cLjFaXQtFQinC0j4,513
|
13
|
-
hockey_blast_common_lib-0.1.9.dist-info/METADATA,sha256=t2HdAROSvQcVYwtQBu1UncZx5_JGboGoaBviUIZS9jg,317
|
14
|
-
hockey_blast_common_lib-0.1.9.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
15
|
-
hockey_blast_common_lib-0.1.9.dist-info/top_level.txt,sha256=wIR4LIkE40npoA2QlOdfCYlgFeGbsHR8Z6r0h46Vtgc,24
|
16
|
-
hockey_blast_common_lib-0.1.9.dist-info/RECORD,,
|
File without changes
|
{hockey_blast_common_lib-0.1.9.dist-info → hockey_blast_common_lib-0.1.11.dist-info}/top_level.txt
RENAMED
File without changes
|