wsba-hockey 1.1.9__py3-none-any.whl → 1.2.0__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.
Files changed (144) hide show
  1. wsba_hockey/tools/scraping.py +146 -170
  2. wsba_hockey/tools/utils/__init__.py +0 -1
  3. wsba_hockey/tools/utils/shared.py +14 -389
  4. wsba_hockey/tools/xg_model.py +6 -1
  5. wsba_hockey/wsba_main.py +45 -10
  6. {wsba_hockey-1.1.9.dist-info → wsba_hockey-1.2.0.dist-info}/METADATA +16 -15
  7. wsba_hockey-1.2.0.dist-info/RECORD +15 -0
  8. wsba_hockey/api/api/index.py +0 -162
  9. wsba_hockey/data_pipelines.py +0 -247
  10. wsba_hockey/evidence/weakside-breakout/node_modules/duckdb/vendor.py +0 -146
  11. wsba_hockey/evidence/weakside-breakout/node_modules/flatted/python/flatted.py +0 -149
  12. wsba_hockey/evidence/weakside-breakout/node_modules/flatted/python/test.py +0 -63
  13. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/gyp_main.py +0 -45
  14. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py +0 -367
  15. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py +0 -206
  16. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py +0 -1270
  17. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py +0 -1547
  18. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py +0 -59
  19. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py +0 -153
  20. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py +0 -271
  21. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py +0 -574
  22. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/__init__.py +0 -690
  23. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/common.py +0 -661
  24. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/common_test.py +0 -78
  25. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py +0 -165
  26. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py +0 -109
  27. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py +0 -55
  28. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py +0 -0
  29. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py +0 -808
  30. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py +0 -1173
  31. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py +0 -1321
  32. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py +0 -120
  33. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py +0 -103
  34. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py +0 -464
  35. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py +0 -89
  36. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py +0 -58
  37. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +0 -2714
  38. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py +0 -3981
  39. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py +0 -44
  40. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +0 -2936
  41. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py +0 -55
  42. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py +0 -1394
  43. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py +0 -25
  44. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/input.py +0 -3130
  45. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/input_test.py +0 -98
  46. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py +0 -771
  47. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +0 -1271
  48. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py +0 -174
  49. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py +0 -61
  50. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py +0 -374
  51. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +0 -1939
  52. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py +0 -302
  53. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +0 -3197
  54. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py +0 -65
  55. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/test_gyp.py +0 -261
  56. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/tools/graphviz.py +0 -102
  57. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/tools/pretty_gyp.py +0 -156
  58. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/tools/pretty_sln.py +0 -181
  59. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/tools/pretty_vcproj.py +0 -339
  60. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/test/fixtures/test-charmap.py +0 -31
  61. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/update-gyp.py +0 -64
  62. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/gyp_main.py +0 -45
  63. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py +0 -367
  64. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py +0 -206
  65. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py +0 -1270
  66. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py +0 -1547
  67. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py +0 -59
  68. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py +0 -153
  69. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py +0 -271
  70. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py +0 -574
  71. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/__init__.py +0 -666
  72. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/common.py +0 -654
  73. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/common_test.py +0 -78
  74. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py +0 -165
  75. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py +0 -109
  76. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py +0 -55
  77. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py +0 -0
  78. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py +0 -808
  79. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py +0 -1173
  80. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py +0 -1321
  81. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py +0 -120
  82. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py +0 -103
  83. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py +0 -464
  84. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py +0 -89
  85. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py +0 -58
  86. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +0 -2518
  87. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py +0 -3978
  88. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py +0 -44
  89. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +0 -2936
  90. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py +0 -55
  91. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py +0 -1394
  92. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py +0 -25
  93. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/input.py +0 -3137
  94. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/input_test.py +0 -98
  95. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py +0 -771
  96. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +0 -1271
  97. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py +0 -174
  98. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py +0 -61
  99. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py +0 -374
  100. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +0 -1939
  101. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py +0 -302
  102. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +0 -3197
  103. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py +0 -65
  104. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/setup.py +0 -42
  105. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/test_gyp.py +0 -260
  106. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/tools/graphviz.py +0 -102
  107. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/tools/pretty_gyp.py +0 -156
  108. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/tools/pretty_sln.py +0 -181
  109. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/tools/pretty_vcproj.py +0 -339
  110. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/test/fixtures/test-charmap.py +0 -31
  111. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/update-gyp.py +0 -46
  112. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/duos/app.py +0 -210
  113. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/duos/calc.py +0 -163
  114. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/game_stats/app.py +0 -401
  115. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/game_stats/name_fix.py +0 -47
  116. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/goalie/app.py +0 -101
  117. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/goalie/plot.py +0 -71
  118. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/goalie/rink_plot.py +0 -245
  119. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/heatmaps/app.py +0 -108
  120. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/heatmaps/plot.py +0 -95
  121. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/heatmaps/rink_plot.py +0 -245
  122. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/line-combos/app.py +0 -245
  123. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/line-combos/plot.py +0 -275
  124. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/line-combos/rink_plot.py +0 -245
  125. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/matchups/app.py +0 -145
  126. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/matchups/plot.py +0 -79
  127. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/matchups/rink_plot.py +0 -245
  128. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/pbp/app.py +0 -406
  129. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/pbp/plot.py +0 -79
  130. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/pbp/rink_plot.py +0 -245
  131. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/skater/app.py +0 -110
  132. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/skater/plot.py +0 -59
  133. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/skater/rink_plot.py +0 -245
  134. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/team_heatmaps/app.py +0 -103
  135. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/team_heatmaps/plot.py +0 -95
  136. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/team_heatmaps/rink_plot.py +0 -245
  137. wsba_hockey/flask/app.py +0 -77
  138. wsba_hockey/tools/utils/config.py +0 -14
  139. wsba_hockey/tools/utils/save_pages.py +0 -133
  140. wsba_hockey/workspace.py +0 -28
  141. wsba_hockey-1.1.9.dist-info/RECORD +0 -148
  142. {wsba_hockey-1.1.9.dist-info → wsba_hockey-1.2.0.dist-info}/WHEEL +0 -0
  143. {wsba_hockey-1.1.9.dist-info → wsba_hockey-1.2.0.dist-info}/licenses/LICENSE +0 -0
  144. {wsba_hockey-1.1.9.dist-info → wsba_hockey-1.2.0.dist-info}/top_level.txt +0 -0
@@ -1,401 +0,0 @@
1
- import pandas as pd
2
- import numpy as np
3
- from urllib.parse import *
4
- from shiny import *
5
- from shinywidgets import output_widget, render_widget
6
- from name_fix import *
7
-
8
- app_ui = ui.page_fluid(
9
- ui.tags.link(
10
- rel='stylesheet',
11
- href='https://fonts.googleapis.com/css2?family=Bebas+Neue&display=swap'
12
- ),
13
- ui.tags.style(
14
- """
15
- body {
16
- background-color: #09090b;
17
- color: white;
18
- font-family: 'Bebas Neue', sans-serif;
19
- }
20
-
21
- .custom-input input.form-control,
22
- .custom-input .selectize-control,
23
- .custom-input .selectize-input {
24
- background-color: #09090b !important; /* black background */
25
- color: white !important; /* white font color */
26
- border-radius: 4px;
27
- border: 1px solid #444;
28
- }
29
-
30
- .custom-input .selectize-dropdown,
31
- .custom-input .selectize-dropdown-content {
32
- background-color: #09090b !important;
33
- color: white !important;
34
- }
35
-
36
- .custom-input .selectize-control.multi .item {
37
- background-color: #09090b !important;
38
- color: white !important;
39
- border-radius: 4px;
40
- padding: 2px 6px;
41
- margin: 2px 4px 2px 0;
42
- }
43
-
44
- label.control-label {
45
- color: white !important;
46
- }
47
-
48
- .selectize-control.multi {
49
- width: 300px !important;
50
- }
51
-
52
- .form-row {
53
- display: flex;
54
- gap: 12px;
55
- flex-wrap: wrap;
56
- justify-content: center;
57
- }
58
-
59
- .submit-button {
60
- display: flex;
61
- justify-content: center;
62
- }
63
-
64
- .hide {
65
- display: none;
66
- }
67
-
68
- .table thead tr {
69
- --bs-table-bg: #09090b;
70
- --bs-table-color-state: white;
71
- }
72
-
73
- .table thead tr th {
74
- white-space: nowrap;
75
- text-align: center;
76
- color: white;
77
- background-color: #09090b;
78
- }
79
-
80
- .table tbody tr {
81
- --bs-table-bg: #09090b;
82
- --bs-table-color-state: white;
83
- }
84
-
85
- .table tbody tr td {
86
- white-space: nowrap;
87
- text-align: center;
88
- overflow: hidden;
89
- text-overflow: ellipsis;
90
- color: white;
91
- background-color: #09090b;
92
- }
93
-
94
- .table thead th {
95
- text-align: center !important;
96
- }
97
- """
98
- ),
99
- ui.tags.h2(ui.output_text('game_header'), style="text-align: center;"),
100
- ui.tags.h4('Team Stats'),
101
- ui.output_data_frame("team_stats"),
102
- ui.tags.h4('Scoring Summary'),
103
- ui.output_data_frame("scoring_summary"),
104
- ui.output_ui("table_filters"),
105
- ui.row(
106
- ui.column(6, ui.tags.h4(ui.output_text('away_header'))),
107
- ui.column(6, ui.tags.h4(ui.output_text('home_header')))
108
- ),
109
- ui.row(
110
- ui.column(6, ui.output_data_frame("away_stats")),
111
- ui.column(6, ui.output_data_frame("home_stats"))
112
- ),
113
- ui.row(
114
- ui.column(6, ui.tags.h4(ui.output_text('away_goalie_header'))),
115
- ui.column(6, ui.tags.h4(ui.output_text('home_goalie_header')))
116
- ),
117
- ui.row(
118
- ui.column(6, ui.output_data_frame("away_goalie")),
119
- ui.column(6, ui.output_data_frame("home_goalie"))
120
- )
121
- )
122
-
123
- def server(input, output, session):
124
- query = reactive.Value(None)
125
- game_info = reactive.Value(None)
126
-
127
- def get_schedule():
128
- games = pd.read_csv('https://weakside-breakout.s3.us-east-2.amazonaws.com/info/schedule.csv')
129
-
130
- return games.loc[games['gameState'].isin(['OFF','FINAL'])]
131
-
132
- @reactive.Effect
133
- def query_params():
134
- #Retreive query parameters
135
- search = session.input[".clientdata_url_search"]()
136
- q = parse_qs(urlparse(search).query)
137
-
138
- print(q)
139
-
140
- defaults = {
141
- 'game_id':['2024020001'],
142
- 'title':['true']
143
- }
144
-
145
- for key in defaults.keys():
146
- if key not in q.keys():
147
- q.update({key:defaults[key]})
148
-
149
- query.set(q)
150
-
151
- def active_params():
152
- return query.get() or {}
153
-
154
- @reactive.Effect
155
- def get_game_info():
156
- #Load params
157
- query = active_params()
158
-
159
- #Load game data
160
- game = get_schedule()
161
- game = game.loc[game['id'].astype(str).str.replace('.0','')==query['game_id'][0]]
162
-
163
- game_info.set({
164
- 'game_id':game['id'].iloc[0],
165
- 'season':game['season'].iloc[0],
166
- 'title':game['game_title'].iloc[0],
167
- 'date':game['date'].iloc[0],
168
- 'away_team_abbr':game['away_team_abbr'].iloc[0],
169
- 'home_team_abbr':game['home_team_abbr'].iloc[0],
170
- 'away_logo':game['awayTeam.darkLogo'].iloc[0],
171
- 'home_logo':game['homeTeam.darkLogo'].iloc[0],
172
- 'away_score':game['awayTeam.score'].iloc[0],
173
- 'home_score':game['homeTeam.score'].iloc[0],
174
- })
175
- print(game_info.get())
176
-
177
- game_df = reactive.Value(None)
178
- @reactive.Effect
179
- def active_game():
180
- #Determine which season to load based on the input game_id
181
- info = game_info.get()
182
- season = info['season']
183
- #Load appropriate dataframe
184
- df = pd.read_parquet(f'https://weakside-breakout.s3.us-east-2.amazonaws.com/game_log/wsba_nhl_{season}_game_log.parquet')
185
- goalie_df = pd.read_parquet(f'https://weakside-breakout.s3.us-east-2.amazonaws.com/game_log/goalie/wsba_nhl_{season}_game_log_goalie.parquet')
186
- pbp = pd.read_parquet(f'https://weakside-breakout.s3.us-east-2.amazonaws.com/pbp/{season}.parquet')
187
-
188
- game_df.set([df.loc[(df['Game']==info['game_id'])], pbp.loc[(pbp['game_id']==info['game_id'])&(pbp['event_type']=='goal')], goalie_df.loc[(goalie_df['Game']==info['game_id'])]])
189
-
190
- @output
191
- @render.ui
192
- def table_filters():
193
- all_strengths = ['4v5','5v4','5v5','Other','All']
194
- return ui.panel_well(
195
- ui.tags.div(
196
- {"class": "form-row custom-input"},
197
- ui.input_selectize('stat_type','Type',['Individual','On-Ice']),
198
- ui.input_selectize('strength_state','Strength',all_strengths,selected='5v5'),
199
- )
200
- )
201
-
202
- @output
203
- @render.data_frame
204
- def team_stats():
205
- df = game_df.get()[0]
206
- info = game_info.get()
207
-
208
- df = df.loc[df['Strength']=='All'].groupby('Team').agg(
209
- Fenwick=('Fi','sum'),
210
- xG=('xGi','sum'),
211
- Hits=('HF','sum'),
212
- Give=('Give','sum'),
213
- Take=('Take','sum'),
214
- PIM=('PIM','sum')
215
- ).reset_index()
216
-
217
- score = pd.DataFrame([[info['away_team_abbr'],
218
- info['away_score']],
219
- [info['home_team_abbr'],
220
- info['home_score']]],columns=['Team','Goals'])
221
-
222
- df = pd.merge(df,score,how='left')
223
- df = df[['Team','Goals','Fenwick','xG','Hits','Give','Take','PIM']]
224
-
225
- df['xG'] = df['xG'].round(2)
226
-
227
- print(df)
228
-
229
- return render.DataTable(df,height='fit-content')
230
-
231
- @output
232
- @render.data_frame
233
- def scoring_summary():
234
- pbp = game_df.get()[1]
235
-
236
- pbp = pbp[['event_num','period','seconds_elapsed','strength_state','description','away_score','home_score','xG']].rename(columns={
237
- 'event_num':'#',
238
- 'seconds_elapsed':'Seconds',
239
- 'strength_state':'Strength State',
240
- 'away_score':'Away Score',
241
- 'home_score':'Home Score'
242
- })
243
-
244
- pbp['xG'] = (pbp['xG']*100).round(4)
245
-
246
- return render.DataTable(pbp, height='fit-content')
247
-
248
- @output
249
- @render.text
250
- def game_header():
251
- return game_info.get()['title'] if active_params()['title'][0] == 'true' else None
252
-
253
- @output
254
- @render.text
255
- def away_header():
256
- team = game_info.get()['away_team_abbr']
257
-
258
- return f'{team} Stats'
259
-
260
- @output
261
- @render.text
262
- def home_header():
263
- team = game_info.get()['home_team_abbr']
264
-
265
- return f'{team} Stats'
266
-
267
- @output
268
- @render.text
269
- def away_goalie_header():
270
- team = game_info.get()['away_team_abbr']
271
-
272
- return f'{team} Goalie Stats'
273
-
274
- @output
275
- @render.text
276
- def home_goalie_header():
277
- team = game_info.get()['home_team_abbr']
278
-
279
- return f'{team} Goalie Stats'
280
-
281
- @output
282
- @render.data_frame
283
- def away_stats():
284
- df = game_df.get()[0]
285
- info = game_info.get()
286
-
287
- if input.stat_type() == 'Individual':
288
- cols = [
289
- 'Player','ID','Position','Handedness','TOI','Gi','A1','A2','P1','P','Give','Take','HF','HA',
290
- 'Fi','xGi'
291
- ]
292
- else:
293
- cols = [
294
- 'Player','ID','Position','Handedness','TOI','GF','GA','FF','FA','xGF','xGA','GF%','FF%','xGF%'
295
- ]
296
-
297
- df = df.loc[(df['Team']==info['away_team_abbr'])&(df['Strength']==input.strength_state()),cols]
298
-
299
- for col in ['TOI','xGi','xGF','xGA','GF%','FF%','xGF%']:
300
- try:
301
- if '%' in col:
302
- df[col] = (df[col]*100).round(2).astype(str) + '%'
303
- else:
304
- df[col] = df[col].round(2)
305
- except:
306
- continue
307
-
308
- df = fix_names(df)
309
-
310
- return render.DataTable(df.rename(columns={
311
- 'Gi':'G',
312
- 'Fi':'iFF',
313
- 'xGi':'ixG'
314
- }).drop(columns=['ID']).rename(columns={'Position':'POS','Handedness':'Hand'}))
315
-
316
- @output
317
- @render.data_frame
318
- def home_stats():
319
- df = game_df.get()[0]
320
- info = game_info.get()
321
-
322
- if input.stat_type() == 'Individual':
323
- cols = [
324
- 'Player','ID','TOI','Position','Handedness','Gi','A1','A2','P1','P','Give','Take','HF','HA',
325
- 'Fi','xGi'
326
- ]
327
- else:
328
- cols = [
329
- 'Player','ID','TOI','Position','Handedness','GF','GA','FF','FA','xGF','xGA','GF%','FF%','xGF%'
330
- ]
331
-
332
- df = df.loc[(df['Team']==info['home_team_abbr'])&(df['Strength']==input.strength_state()),cols]
333
-
334
- for col in ['TOI','xGi','xGF','xGA','GF%','FF%','xGF%']:
335
- try:
336
- if '%' in col:
337
- df[col] = (df[col]*100).round(2).astype(str) + '%'
338
- else:
339
- df[col] = df[col].round(2)
340
- except:
341
- continue
342
-
343
- df = fix_names(df)
344
-
345
- return render.DataTable(df.rename(columns={
346
- 'Gi':'G',
347
- 'Fi':'iFF',
348
- 'xGi':'ixG'
349
- }).drop(columns=['ID']).rename(columns={'Position':'POS','Handedness':'Hand'}))
350
-
351
- @output
352
- @render.data_frame
353
- def away_goalie():
354
- df = game_df.get()[2]
355
- info = game_info.get()
356
-
357
- cols = [
358
- 'Goalie','ID','TOI','Position','Handedness','GA','FA','xGA','GSAx'
359
- ]
360
-
361
- df = df.loc[(df['Team']==info['away_team_abbr'])&(df['Strength']==input.strength_state()),cols]
362
-
363
- for col in ['TOI','xGA','GSAx']:
364
- try:
365
- if '%' in col:
366
- df[col] = (df[col]*100).round(2).astype(str) + '%'
367
- else:
368
- df[col] = df[col].round(2)
369
- except:
370
- continue
371
-
372
- df = fix_names(df,'Goalie')
373
-
374
- return render.DataTable(df.drop(columns=['ID']).rename(columns={'Position':'POS','Handedness':'Hand'}))
375
-
376
- @output
377
- @render.data_frame
378
- def home_goalie():
379
- df = game_df.get()[2]
380
- info = game_info.get()
381
-
382
- cols = [
383
- 'Goalie','ID','TOI','Position','Handedness','GA','FA','xGA','GSAx'
384
- ]
385
-
386
- df = df.loc[(df['Team']==info['home_team_abbr'])&(df['Strength']==input.strength_state()),cols]
387
-
388
- for col in ['TOI','xGA','GSAx']:
389
- try:
390
- if '%' in col:
391
- df[col] = (df[col]*100).round(2).astype(str) + '%'
392
- else:
393
- df[col] = df[col].round(2)
394
- except:
395
- continue
396
-
397
- df = fix_names(df,'Goalie')
398
-
399
- return render.DataTable(df.drop(columns=['ID']).rename(columns={'Position':'POS','Handedness':'Hand'}))
400
-
401
- app = App(app_ui, server)
@@ -1,47 +0,0 @@
1
- import requests as rs
2
- import pandas as pd
3
- import numpy as np
4
-
5
- def scrape_info(player_ids):
6
- #Given player id, return player information
7
- infos = []
8
- for player_id in player_ids:
9
- player_id = int(player_id)
10
- api = f'https://api-web.nhle.com/v1/player/{player_id}/landing'
11
-
12
- data = pd.json_normalize(rs.get(api).json())
13
-
14
- #Add name column
15
- data['fullName'] = (data['firstName.default'] + " " + data['lastName.default']).str.upper()
16
-
17
- #Append
18
- infos.append(data)
19
-
20
- df = pd.concat(infos)
21
- #Return: player data
22
- return df
23
-
24
- def fix_names(stats,name='Player'):
25
- missing = stats.loc[stats[name]=='0']
26
- stats = stats.loc[stats[name]!='0']
27
-
28
- if not missing.empty:
29
- data = scrape_info(missing['ID'])[['fullName','playerId','position','shootsCatches']].rename(columns={
30
- 'playerId':'ID',
31
- 'fullName':'Player',
32
- 'position':'Position',
33
- 'headshot':'Headshot',
34
- 'heightInInches':'Height (in)',
35
- 'weightInPounds':'Weight (lbs)',
36
- 'birthDate':'Birthday',
37
- 'birthCountry':'Nationality',
38
- 'shootsCatches':'Handedness'})
39
-
40
- missing = missing.drop(columns=[name,'Position','Handedness'])
41
- miss = pd.merge(missing,data,how='left',on=['ID'])
42
-
43
- df = pd.concat([stats,miss]).sort_values([name,'ID'])
44
-
45
- return df
46
- else:
47
- return stats
@@ -1,101 +0,0 @@
1
- import pandas as pd
2
- import plot as wsba_plt
3
- import numpy as np
4
- from urllib.parse import *
5
- from shiny import *
6
- from shinywidgets import output_widget, render_widget
7
-
8
- app_ui = ui.page_fluid(
9
- ui.tags.style(
10
- "body {background:#09090b"
11
- "}"
12
- ),
13
- output_widget("plot_goalie"),
14
- )
15
-
16
- def server(input, output, session):
17
- @output()
18
- @render_widget
19
- def plot_goalie():
20
- #Retreive query parameters
21
- search = session.input[".clientdata_url_search"]()
22
- query = parse_qs(urlparse(search).query)
23
-
24
- print(query)
25
- #If no input data is provided automatically provide a select goalie and plot all 5v5 fenwick shots
26
- defaults = {
27
- 'goalie':['8471679'],
28
- 'season':['20142015'],
29
- 'team':['MTL'],
30
- 'strength_state':['5v5'],
31
- 'season_type':['2']
32
- }
33
-
34
- for key in defaults.keys():
35
- if key not in query.keys():
36
- query.update({key:defaults[key]})
37
-
38
- #Iterate through query and parse params with multiple selections
39
- for param in query.keys():
40
- q_string = query[param][0]
41
- query[param] = q_string.split(',')
42
-
43
- print(query)
44
- #Determine which season to load based on the input
45
- season = query['season'][0]
46
- #Load appropriate dataframe
47
- df = pd.read_parquet(f'https://weakside-breakout.s3.us-east-2.amazonaws.com/pbp/{season}.parquet')
48
-
49
- #Prepare dataframe for plotting based on URL parameters
50
- df = df.loc[(df['season'].astype(str).isin(query['season']))&(df['season_type'].astype(str).isin(query['season_type']))].replace({np.nan: None})
51
- #Return empty rink if no data exists else continue
52
- if df.empty:
53
- return wsba_plt.wsba_rink(setting='offense',vertical=True)
54
- else:
55
- rink = wsba_plt.wsba_rink(setting='offense',vertical=True)
56
-
57
- try:
58
- plot = wsba_plt.heatmap(df,goalie=query['goalie'][0],team=query['team'][0],events=['missed-shot','shot-on-goal','goal'],strengths=query['strength_state'])
59
-
60
- for trace in plot.data:
61
- rink.add_trace(trace)
62
-
63
- player = query['goalie'][0]
64
- season = int(season[0:4])
65
- team = query['team'][0]
66
- strengths = 'All Situations' if len(query['strength_state']) == 4 else query['strength_state']
67
- span = 'Regular Season' if query['season_type'][0]=='2' else 'Playoffs'
68
-
69
- return rink.update_layout(
70
- title=dict(
71
- text=f'{player} GSAx at {strengths}; {season}-{season+1}, {span}, {team}',
72
- x=0.5, y=0.96,
73
- xanchor='center',
74
- yanchor='top',
75
- font=dict(color='white')
76
- ),
77
- ).add_annotation(
78
- text='Lower GSAx',
79
- xref="paper",
80
- yref="paper",
81
- xanchor='right',
82
- yanchor='top',
83
- font=dict(color='white'),
84
- x=0.3,
85
- y=0.04,
86
- showarrow=False
87
- ).add_annotation(
88
- text='Higher GSAx',
89
- xref="paper",
90
- yref="paper",
91
- xanchor='right',
92
- yanchor='top',
93
- font=dict(color='white'),
94
- x=0.76,
95
- y=0.04,
96
- showarrow=False
97
- )
98
- except:
99
- return wsba_plt.wsba_rink(setting='offense',vertical=True)
100
-
101
- app = App(app_ui, server)
@@ -1,71 +0,0 @@
1
- import pandas as pd
2
- import numpy as np
3
- import plotly.graph_objects as go
4
- import matplotlib.pyplot as plt
5
- import rink_plot
6
- from scipy.interpolate import griddata
7
- from scipy.ndimage import gaussian_filter
8
-
9
- def wsba_rink(setting='full', vertical=False):
10
- return rink_plot.rink(setting=setting, vertical=vertical)
11
-
12
- def heatmap(df,goalie,team,events,strengths):
13
- df['event_team_abbr_2'] = np.where(df['home_team_abbr']==df['event_team_abbr'],df['away_team_abbr'],df['home_team_abbr'])
14
- df['strength_state_2'] = df['strength_state'].str[::-1]
15
-
16
- df = df.loc[(df['event_type'].isin(events))&(df['x_adj'].notna())&(df['y_adj'].notna())]
17
- df['x'] = np.where(df['x_adj']<0,-df['y_adj'],df['y_adj'])
18
- df['y'] = abs(df['x_adj'])
19
- df['event_distance'] = abs(df['event_distance'].fillna(0))
20
- df = df.loc[(df['event_distance']<=89)&(df['y']<=89)&(df['empty_net']==0)]
21
-
22
- y_min = 0
23
- y_max = 100
24
-
25
- df['G'] = (df['event_type']=='goal').astype(int)
26
- df['strength_state_2'] = np.where(df['strength_state_2'].isin(['5v5','5v4','4v5']),df['strength_state_2'],'Other')
27
-
28
- if strengths != 'all':
29
- df = df.loc[((df['strength_state_2'].isin(strengths)))]
30
-
31
- [x,y] = np.round(np.meshgrid(np.linspace(-42.5,42.5,85),np.linspace(y_min,y_max,(y_max-y_min))))
32
- xgoals = griddata((df['x'],df['y']),df['xG']-df['G'],(x,y),method='cubic',fill_value=0)
33
- xgoals_smooth = gaussian_filter(xgoals,sigma=3)
34
-
35
- player_shots = df.loc[(df['event_goalie_id'].astype(str).str.contains(goalie))&(df['event_team_abbr_2']==team)]
36
- [x,y] = np.round(np.meshgrid(np.linspace(-42.5,42.5,85),np.linspace(y_min,y_max,(y_max-y_min))))
37
- xgoals_player = griddata((player_shots['x'],player_shots['y']),player_shots['xG']-player_shots['G'],(x,y),method='cubic',fill_value=0)
38
-
39
- difference = (gaussian_filter(xgoals_player,sigma = 3)) - xgoals_smooth
40
- data_min= difference.min()
41
- data_max= difference.max()
42
-
43
- if abs(data_min) > data_max:
44
- data_max = data_min * -1
45
- elif data_max > abs(data_min):
46
- data_min = data_max * -1
47
-
48
- fig = go.Figure(
49
- data = go.Contour( x=np.linspace(-42.5,42,5,85),
50
- y=np.linspace(y_min,y_max,(y_max-y_min)),
51
- z=xgoals_smooth,
52
- colorscale=[[0.0,'red'],[0.5,'#09090b'],[1.0,'blue']],
53
- connectgaps=True,
54
- contours=dict(
55
- type='levels',
56
- start = data_min,
57
- end = data_max,
58
- size=(data_max-data_min)/11
59
- ),
60
- colorbar=dict(
61
- len = 0.7,
62
- orientation='h',
63
- showticklabels=False,
64
- thickness=15,
65
- yref='paper',
66
- yanchor='top',
67
- y=0
68
- ))
69
- )
70
-
71
- return fig