hockey-blast-common-lib 0.1.57__tar.gz → 0.1.59__tar.gz

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.
Files changed (34) hide show
  1. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/PKG-INFO +1 -1
  2. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib/aggregate_scorekeeper_stats.py +28 -19
  3. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib/hockey_blast_sample_backup.sql.gz +0 -0
  4. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib.egg-info/PKG-INFO +1 -1
  5. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/setup.py +1 -1
  6. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/MANIFEST.in +0 -0
  7. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/README.md +0 -0
  8. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib/__init__.py +0 -0
  9. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib/aggregate_all_stats.py +0 -0
  10. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib/aggregate_goalie_stats.py +0 -0
  11. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib/aggregate_h2h_stats.py +0 -0
  12. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib/aggregate_human_stats.py +0 -0
  13. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib/aggregate_referee_stats.py +0 -0
  14. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib/aggregate_s2s_stats.py +0 -0
  15. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib/aggregate_skater_stats.py +0 -0
  16. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib/assign_skater_skill.py +0 -0
  17. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib/db_connection.py +0 -0
  18. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib/dump_sample_db.sh +0 -0
  19. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib/h2h_models.py +0 -0
  20. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib/models.py +0 -0
  21. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib/options.py +0 -0
  22. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib/progress_utils.py +0 -0
  23. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib/restore_sample_db.sh +0 -0
  24. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib/skills_in_divisions.py +0 -0
  25. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib/skills_propagation.py +0 -0
  26. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib/stats_models.py +0 -0
  27. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib/stats_utils.py +0 -0
  28. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib/utils.py +0 -0
  29. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib/wsgi.py +0 -0
  30. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib.egg-info/SOURCES.txt +0 -0
  31. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib.egg-info/dependency_links.txt +0 -0
  32. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib.egg-info/requires.txt +0 -0
  33. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/hockey_blast_common_lib.egg-info/top_level.txt +0 -0
  34. {hockey_blast_common_lib-0.1.57 → hockey_blast_common_lib-0.1.59}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hockey-blast-common-lib
3
- Version: 0.1.57
3
+ Version: 0.1.59
4
4
  Summary: Common library for shared functionality and DB models
5
5
  Author: Pavel Kletskov
6
6
  Author-email: kletskov@gmail.com
@@ -52,13 +52,14 @@ def calculate_quality_score(avg_max_saves_5sec, avg_max_saves_20sec, peak_max_sa
52
52
  return round(score, 2)
53
53
 
54
54
  def aggregate_scorekeeper_stats(session, aggregation_type, aggregation_id, names_to_filter_out, aggregation_window=None):
55
+ # Only process scorekeeper stats for ALL_ORGS_ID - skip individual organizations
56
+ # This prevents redundant processing when upstream logic calls with all organization IDs
57
+ if aggregation_type == 'org' and aggregation_id != ALL_ORGS_ID:
58
+ return # Do nothing for individual organization IDs
59
+
55
60
  human_ids_to_filter = get_human_ids_by_names(session, names_to_filter_out)
56
61
 
57
62
  if aggregation_type == 'org':
58
- # Only process scorekeeper stats for ALL_ORGS_ID - skip individual organizations
59
- if aggregation_id != ALL_ORGS_ID:
60
- return # Skip processing for individual organization IDs
61
-
62
63
  aggregation_name = "All Orgs"
63
64
  filter_condition = sqlalchemy.true() # No filter for organization
64
65
  print(f"Aggregating scorekeeper stats for {aggregation_name} with window {aggregation_window}...")
@@ -162,7 +163,6 @@ def aggregate_scorekeeper_stats(session, aggregation_type, aggregation_id, names
162
163
  assign_ranks(stats_dict, 'quality_score', reverse_rank=True) # Lower is better (less problematic)
163
164
 
164
165
  # Insert aggregated stats into the appropriate table with progress output
165
- total_items = len(stats_dict)
166
166
  batch_size = 1000
167
167
  for i, (key, stat) in enumerate(stats_dict.items(), 1):
168
168
  aggregation_id, human_id = key
@@ -203,20 +203,29 @@ def run_aggregate_scorekeeper_stats():
203
203
  session = create_session("boss")
204
204
  human_id_to_debug = None
205
205
 
206
- # Process ALL_ORGS scorekeeper stats only (cross-organizational)
207
- # Scorekeeper quality should be measured across all organizations they work for
208
- if human_id_to_debug is None:
209
- org_progress = create_progress_tracker(3, f"Processing cross-organizational scorekeeper stats")
210
- aggregate_scorekeeper_stats(session, aggregation_type='org', aggregation_id=ALL_ORGS_ID, names_to_filter_out=not_human_names)
211
- org_progress.update(1)
212
- aggregate_scorekeeper_stats(session, aggregation_type='org', aggregation_id=ALL_ORGS_ID, names_to_filter_out=not_human_names, aggregation_window='Weekly')
213
- org_progress.update(2)
214
- aggregate_scorekeeper_stats(session, aggregation_type='org', aggregation_id=ALL_ORGS_ID, names_to_filter_out=not_human_names, aggregation_window='Daily')
215
- org_progress.update(3)
216
- else:
217
- aggregate_scorekeeper_stats(session, aggregation_type='org', aggregation_id=ALL_ORGS_ID, names_to_filter_out=not_human_names)
218
- aggregate_scorekeeper_stats(session, aggregation_type='org', aggregation_id=ALL_ORGS_ID, names_to_filter_out=not_human_names, aggregation_window='Weekly')
219
- aggregate_scorekeeper_stats(session, aggregation_type='org', aggregation_id=ALL_ORGS_ID, names_to_filter_out=not_human_names, aggregation_window='Daily')
206
+ # Get all org_id present in the Organization table (following goalie stats pattern)
207
+ # Individual org calls will be skipped by early exit, only ALL_ORGS_ID will process
208
+ from hockey_blast_common_lib.models import Organization
209
+ org_ids = session.query(Organization.id).all()
210
+ org_ids = [org_id[0] for org_id in org_ids]
211
+
212
+ # Add ALL_ORGS_ID to the list so it gets processed
213
+ org_ids.append(ALL_ORGS_ID)
214
+
215
+ for org_id in org_ids:
216
+ if human_id_to_debug is None:
217
+ org_name = "All Organizations" if org_id == ALL_ORGS_ID else session.query(Organization.organization_name).filter(Organization.id == org_id).scalar() or f"org_id {org_id}"
218
+ org_progress = create_progress_tracker(3, f"Processing scorekeeper stats for {org_name}")
219
+ aggregate_scorekeeper_stats(session, aggregation_type='org', aggregation_id=org_id, names_to_filter_out=not_human_names)
220
+ org_progress.update(1)
221
+ aggregate_scorekeeper_stats(session, aggregation_type='org', aggregation_id=org_id, names_to_filter_out=not_human_names, aggregation_window='Weekly')
222
+ org_progress.update(2)
223
+ aggregate_scorekeeper_stats(session, aggregation_type='org', aggregation_id=org_id, names_to_filter_out=not_human_names, aggregation_window='Daily')
224
+ org_progress.update(3)
225
+ else:
226
+ aggregate_scorekeeper_stats(session, aggregation_type='org', aggregation_id=org_id, names_to_filter_out=not_human_names)
227
+ aggregate_scorekeeper_stats(session, aggregation_type='org', aggregation_id=org_id, names_to_filter_out=not_human_names, aggregation_window='Weekly')
228
+ aggregate_scorekeeper_stats(session, aggregation_type='org', aggregation_id=org_id, names_to_filter_out=not_human_names, aggregation_window='Daily')
220
229
 
221
230
  if __name__ == "__main__":
222
231
  run_aggregate_scorekeeper_stats()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hockey-blast-common-lib
3
- Version: 0.1.57
3
+ Version: 0.1.59
4
4
  Summary: Common library for shared functionality and DB models
5
5
  Author: Pavel Kletskov
6
6
  Author-email: kletskov@gmail.com
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='hockey-blast-common-lib', # The name of your package
5
- version='0.1.57',
5
+ version='0.1.59',
6
6
  description='Common library for shared functionality and DB models',
7
7
  author='Pavel Kletskov',
8
8
  author_email='kletskov@gmail.com',