nfelodcm 0.1.7__py3-none-any.whl → 0.1.8__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.
nfelodcm/__init__.py CHANGED
@@ -1,3 +1,5 @@
1
1
  from .nfelodcm.nfelodcm import get_df
2
2
  from .nfelodcm.nfelodcm import load
3
- from .nfelodcm.nfelodcm import get_map
3
+ from .nfelodcm.nfelodcm import get_map
4
+ from .nfelodcm.nfelodcm import get_season_state
5
+ from .nfelodcm.tests import test_all_maps
@@ -1,11 +1,11 @@
1
1
  from .assignments import (
2
- game_id_repl, penalty_formatting, desc_based_plays
2
+ fastr_team_id_repl, penalty_formatting, desc_based_plays
3
3
  )
4
4
 
5
5
  ## a dictionary that holds assignments and the columns they add ##
6
6
  assignments = {
7
- 'game_id_repl' : {
8
- 'func' : game_id_repl,
7
+ 'fastr_team_id_repl' : {
8
+ 'func' : fastr_team_id_repl,
9
9
  'new_columns' : []
10
10
  },
11
11
  'penalty_formatting' : {
@@ -1,3 +1,3 @@
1
- from .fastr_team_repl import game_id_repl
1
+ from .fastr_team_repl import team_id_repl as fastr_team_id_repl
2
2
  from .penalty_formatting import penalty_formatting
3
3
  from .desc_based_plays import desc_based_plays
@@ -8,25 +8,27 @@ repl = {
8
8
  'LA' : 'LAR',
9
9
  }
10
10
 
11
- def game_id_repl(df):
11
+ def team_id_repl(df):
12
12
  """
13
- Replaces fastr game_ids with a legacy game id.
13
+ Replaces fastr team ids with a legacy nfelo ids.
14
14
  """
15
- df['away_team'] = df['away_team'].replace(repl)
16
- df['home_team'] = df['home_team'].replace(repl)
17
- ## add extra checks to make comparable with pbp ##
15
+ ## if a col with team names exists, replace it ##
18
16
  for col in [
17
+ 'home_team', 'away_team', 'team_abbr',
19
18
  'posteam', 'defteam', 'penalty_team',
20
19
  'side_of_field', 'timeout_team', 'td_team',
21
- 'return_team'
20
+ 'return_team', 'possession_team',
21
+ 'recent_team', 'opponent_team'
22
22
  ]:
23
23
  if col in df.columns:
24
24
  df[col] = df[col].replace(repl)
25
- ## id col ##
26
- df['game_id'] = (
27
- df['season'].astype('str') + '_' +
28
- df['week'].astype('str').str.zfill(2) + '_' +
29
- df['away_team'] + '_' +
30
- df['home_team']
31
- )
25
+ ## if game if is also in the DF, replace it
26
+ if 'game_id' in df.columns:
27
+ ## id col ##
28
+ df['game_id'] = (
29
+ df['season'].astype('str') + '_' +
30
+ df['week'].astype('str').str.zfill(2) + '_' +
31
+ df['away_team'] + '_' +
32
+ df['home_team']
33
+ )
32
34
  return df
@@ -49,6 +49,12 @@ class DCMTable():
49
49
  """
50
50
  Handles loading of the table based on freshness status.
51
51
  """
52
+ ## add a check to always make sure there is a local file in the DB.
53
+ ## If a CSV is deleted or a write fails, timestamps, and therefore
54
+ ## freshness, may incorrectly assume we have a current file to read
55
+ if not self.localIO.loadable():
56
+ ## if the csv does not exist, flag the update flag ##
57
+ self.freshness.needs_update=True
52
58
  if self.freshness.freshness_check_time is not None:
53
59
  ## if freshness was checked, update the time in the config ##
54
60
  self.tableMap.config['freshness']['last_freshness_check'] = self.freshness.freshness_check_time
@@ -159,6 +159,8 @@ class Freshness():
159
159
  ## handle response ##
160
160
  if r.status_code != 200:
161
161
  print('WARN: Request to github commits failed.')
162
+ print(' Returned {0}'.format(r.status_code))
163
+ print(' Msg: {0}'.format(r.content))
162
164
  return
163
165
  r = r.json()
164
166
  if len(r) == 0:
@@ -1,4 +1,5 @@
1
1
  import pandas as pd
2
+ import os
2
3
  import numpy
3
4
  import json
4
5
 
@@ -28,10 +29,46 @@ class LocalIO():
28
29
  self.columns.append(col[0])
29
30
  self.dtypes[col[0]] = col[1]
30
31
 
32
+ def local_exists(self):
33
+ """
34
+ Checks to make sure their is a local CSV at the filepath
35
+ """
36
+ return os.path.exists(self.data_location)
37
+
38
+ def cols_pass(self):
39
+ """
40
+ Checks the local file for columns and matches to
41
+ cols int eh config
42
+ """
43
+ ## parse config cols ##
44
+ config_cols = list(self.config['map'].keys())
45
+ ## parse local cols ##
46
+ local_cols = []
47
+ if self.local_exists():
48
+ ## if local file exists, load the first line ##
49
+ local_cols = pd.read_csv(self.data_location, nrows=1).columns.tolist()
50
+ ## make comparison ##
51
+ for col in config_cols:
52
+ if col not in local_cols:
53
+ return False
54
+ ## if all passed, return true ##
55
+ return True
56
+
57
+
58
+ def loadable(self):
59
+ """
60
+ Runs multiple checks to make sure the file can be read
61
+ by the config
62
+ """
63
+ return self.local_exists() and self.cols_pass()
64
+
31
65
  def read(self):
32
66
  """
33
67
  Read the data from local CSV
34
68
  """
69
+ ## check that path exists first ##
70
+ if not self.loadable():
71
+ raise Exception('IO ERROR: Attempting read a local CSV that does not exist')
35
72
  self.df = pd.read_csv(
36
73
  self.data_location,
37
74
  usecols=self.columns,
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "filmmargins",
3
+ "description": "Margins derived from PFF grades",
4
+ "last_local_update": "2024-07-07T23:35:11.485380",
5
+ "download_url": "https://raw.githubusercontent.com/greerreNFL/filmmargin/main/film_margins.csv",
6
+ "compression": null,
7
+ "engine": "c",
8
+ "freshness": {
9
+ "type": "gh_commit",
10
+ "gh_api_endpoint": "https://api.github.com/repos/greerreNFL/filmmargin/commits?path=film_margins.csv",
11
+ "gh_release_tag": null,
12
+ "sla_seconds": 900,
13
+ "last_freshness_check": "2024-07-10T17:15:32.031946+00:00"
14
+ },
15
+ "iter": {
16
+ "type": null,
17
+ "start": null
18
+ },
19
+ "assignments": [],
20
+ "map": {
21
+ "Unnamed: 0": "int32",
22
+ "game_id": "object",
23
+ "season": "int32",
24
+ "week": "int32",
25
+ "team": "object",
26
+ "opponent": "object",
27
+ "pf": "int32",
28
+ "pa": "int32",
29
+ "margin": "int32",
30
+ "film_margin": "float32",
31
+ "film_margin_predictive": "float32",
32
+ "film_margin_old_model": "float32"
33
+ }
34
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "games",
3
3
  "description": "nflgamedata games",
4
- "last_local_update": "2023-12-31T04:51:21.399721",
4
+ "last_local_update": "2024-07-07T23:13:58.469798",
5
5
  "download_url": "https://raw.githubusercontent.com/nflverse/nfldata/master/data/games.csv",
6
6
  "compression": null,
7
7
  "engine": "c",
@@ -10,14 +10,14 @@
10
10
  "gh_api_endpoint": "https://api.github.com/repos/nflverse/nfldata/commits",
11
11
  "gh_release_tag": null,
12
12
  "sla_seconds": 500,
13
- "last_freshness_check": "2023-12-31T05:27:06.725310+00:00"
13
+ "last_freshness_check": "2024-07-10T17:15:31.355055+00:00"
14
14
  },
15
15
  "iter": {
16
16
  "type": null,
17
17
  "start": null
18
18
  },
19
19
  "assignments": [
20
- "game_id_repl"
20
+ "fastr_team_id_repl"
21
21
  ],
22
22
  "map": {
23
23
  "game_id": "object",
@@ -1,70 +1,40 @@
1
1
  {
2
2
  "name": "logos",
3
- "description": "nflgamedata logos",
4
- "last_local_update": null,
5
- "download_url": "https://github.com/nflverse/nflfastR-data/raw/master/teams_colors_logos.csv",
3
+ "description": "nflfastr logos",
4
+ "last_local_update": "2024-07-07T23:35:10.755659",
5
+ "download_url": "https://raw.githubusercontent.com/nflverse/nflverse-pbp/master/teams_colors_logos.csv",
6
6
  "compression": null,
7
7
  "engine": "c",
8
8
  "freshness": {
9
9
  "type": "gh_commit",
10
- "gh_api_endpoint": "https://api.github.com/repos/nflverse/nfldata/commits",
10
+ "gh_api_endpoint": "https://api.github.com/repos/nflverse/nflverse-pbp/commits?path=teams_colors_logos.csv",
11
11
  "gh_release_tag": null,
12
12
  "sla_seconds": 900,
13
- "last_freshness_check": null
13
+ "last_freshness_check": "2024-07-10T17:15:31.722504+00:00"
14
14
  },
15
15
  "iter": {
16
16
  "type": null,
17
17
  "start": null
18
18
  },
19
19
  "assignments": [
20
- "game_id_repl"
20
+ "fastr_team_id_repl"
21
21
  ],
22
22
  "map": {
23
- "game_id": "object",
24
- "season": "int32",
25
- "game_type": "object",
26
- "week": "int32",
27
- "gameday": "object",
28
- "weekday": "object",
29
- "gametime": "object",
30
- "away_team": "object",
31
- "away_score": "float32",
32
- "home_team": "object",
33
- "home_score": "float32",
34
- "location": "object",
35
- "result": "float32",
36
- "total": "float32",
37
- "overtime": "float32",
38
- "old_game_id": "float32",
39
- "gsis": "float32",
40
- "nfl_detail_id": "object",
41
- "pfr": "object",
42
- "pff": "float32",
43
- "espn": "int32",
44
- "ftn": "float32",
45
- "away_rest": "int32",
46
- "home_rest": "int32",
47
- "away_moneyline": "float32",
48
- "home_moneyline": "float32",
49
- "spread_line": "float32",
50
- "away_spread_odds": "float32",
51
- "home_spread_odds": "float32",
52
- "total_line": "float32",
53
- "under_odds": "float32",
54
- "over_odds": "float32",
55
- "div_game": "int32",
56
- "roof": "object",
57
- "surface": "object",
58
- "temp": "float32",
59
- "wind": "float32",
60
- "away_qb_id": "object",
61
- "home_qb_id": "object",
62
- "away_qb_name": "object",
63
- "home_qb_name": "object",
64
- "away_coach": "object",
65
- "home_coach": "object",
66
- "referee": "object",
67
- "stadium_id": "object",
68
- "stadium": "object"
23
+ "team_abbr": "object",
24
+ "team_name": "object",
25
+ "team_id": "int32",
26
+ "team_nick": "object",
27
+ "team_conf": "object",
28
+ "team_division": "object",
29
+ "team_color": "object",
30
+ "team_color2": "object",
31
+ "team_color3": "object",
32
+ "team_color4": "object",
33
+ "team_logo_wikipedia": "object",
34
+ "team_logo_espn": "object",
35
+ "team_wordmark": "object",
36
+ "team_conference_logo": "object",
37
+ "team_league_logo": "object",
38
+ "team_logo_squared": "object"
69
39
  }
70
40
  }
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "market_data",
3
+ "description": "Spread and totals from various sources",
4
+ "last_local_update": "2024-07-08T03:34:47.332681",
5
+ "download_url": "https://raw.githubusercontent.com/greerreNFL/nfelomarket_data/main/Data/lines.csv",
6
+ "compression": null,
7
+ "engine": "c",
8
+ "freshness": {
9
+ "type": "gh_commit",
10
+ "gh_api_endpoint": "https://api.github.com/repos/greerreNFL/nfelomarket_data/commits?path=Data/lines.csv",
11
+ "gh_release_tag": null,
12
+ "sla_seconds": 900,
13
+ "last_freshness_check": "2024-07-10T17:16:07.623265+00:00"
14
+ },
15
+ "iter": {
16
+ "type": null,
17
+ "start": null
18
+ },
19
+ "assignments": [],
20
+ "map": {
21
+ "Unnamed: 0": "int32",
22
+ "game_id": "object",
23
+ "season": "int32",
24
+ "week": "int32",
25
+ "home_team": "object",
26
+ "away_team": "object",
27
+ "home_spread_open": "float32",
28
+ "home_spread_open_price": "float32",
29
+ "away_spread_open_price": "float32",
30
+ "home_spread_open_source": "object",
31
+ "home_spread_open_timestamp": "object",
32
+ "home_spread_last": "float32",
33
+ "home_spread_last_price": "float32",
34
+ "away_spread_last_price": "float32",
35
+ "home_spread_last_source": "object",
36
+ "home_spread_last_timestamp": "object",
37
+ "home_spread_tickets_pct": "float32",
38
+ "home_spread_money_pct": "float32",
39
+ "home_spread_pcts_source": "object",
40
+ "home_spread_pct_timestamp": "object",
41
+ "home_ml_open": "float32",
42
+ "away_ml_open": "float32",
43
+ "ml_open_source": "object",
44
+ "ml_open_timestamp": "object",
45
+ "home_ml_last": "float32",
46
+ "away_ml_last": "float32",
47
+ "ml_last_source": "object",
48
+ "ml_last_timestamp": "object",
49
+ "total_line_open": "float32",
50
+ "under_price_open": "float32",
51
+ "over_price_open": "float32",
52
+ "total_line_open_source": "object",
53
+ "total_line_open_timestamp": "object",
54
+ "total_line_last": "float32",
55
+ "under_price_last": "float32",
56
+ "over_price_last": "float32",
57
+ "total_line_last_source": "object",
58
+ "total_line_last_timestamp": "object"
59
+ }
60
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "participants",
3
3
  "description": "nflfastR participants",
4
- "last_local_update": null,
4
+ "last_local_update": "2024-07-10T17:16:25.862176",
5
5
  "download_url": "https://github.com/nflverse/nflverse-data/releases/download/pbp_participation/pbp_participation_{0}.csv",
6
6
  "compression": null,
7
7
  "engine": "c",
@@ -10,14 +10,17 @@
10
10
  "gh_api_endpoint": "https://api.github.com/repos/nflverse/nflverse-data/releases/tags",
11
11
  "gh_release_tag": "pbp_participation",
12
12
  "sla_seconds": 900,
13
- "last_freshness_check": null
13
+ "last_freshness_check": "2024-07-10T17:16:08.727121+00:00"
14
14
  },
15
15
  "iter": {
16
16
  "type": "season",
17
17
  "start": 2016
18
18
  },
19
- "assignments": [],
19
+ "assignments": [
20
+ "fastr_team_id_repl"
21
+ ],
20
22
  "map": {
23
+ "nflverse_game_id": "object",
21
24
  "old_game_id": "int32",
22
25
  "play_id": "int32",
23
26
  "possession_team": "object",
@@ -35,7 +38,7 @@
35
38
  "time_to_throw": "float32",
36
39
  "was_pressure": "object",
37
40
  "route": "object",
38
- "defense_man_zone_type": "float32",
39
- "defense_coverage_type": "float32"
41
+ "defense_man_zone_type": "object",
42
+ "defense_coverage_type": "object"
40
43
  }
41
44
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pbp",
3
3
  "description": "nflfastR play-by-play",
4
- "last_local_update": "2023-12-28T05:48:27.222659",
4
+ "last_local_update": "2024-07-07T23:37:14.767747",
5
5
  "download_url": "https://github.com/nflverse/nflverse-data/releases/download/pbp/play_by_play_{0}.csv.gz",
6
6
  "compression": "gzip",
7
7
  "engine": "c",
@@ -10,14 +10,16 @@
10
10
  "gh_api_endpoint": "https://api.github.com/repos/nflverse/nflverse-data/releases/tags",
11
11
  "gh_release_tag": "pbp",
12
12
  "sla_seconds": 900,
13
- "last_freshness_check": "2023-12-28T05:46:15.982851+00:00"
13
+ "last_freshness_check": "2024-07-10T17:15:32.328227+00:00"
14
14
  },
15
15
  "iter": {
16
16
  "type": "season",
17
17
  "start": 1999
18
18
  },
19
19
  "assignments": [
20
- "game_id_repl", "penalty_formatting", "desc_based_plays"
20
+ "fastr_team_id_repl",
21
+ "penalty_formatting",
22
+ "desc_based_plays"
21
23
  ],
22
24
  "map": {
23
25
  "play_id": "int32",
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "player_stats",
3
+ "description": "nflfastR player stats",
4
+ "last_local_update": "2024-07-07T23:37:18.361644",
5
+ "download_url": "https://github.com/nflverse/nflverse-data/releases/download/player_stats/player_stats.csv.gz",
6
+ "compression": "gzip",
7
+ "engine": "c",
8
+ "freshness": {
9
+ "type": "gh_release",
10
+ "gh_api_endpoint": "https://api.github.com/repos/nflverse/nflverse-data/releases/tags",
11
+ "gh_release_tag": "player_stats",
12
+ "sla_seconds": 900,
13
+ "last_freshness_check": "2024-07-10T17:16:05.954026+00:00"
14
+ },
15
+ "iter": {
16
+ "type": null,
17
+ "start": null
18
+ },
19
+ "assignments": [
20
+ "fastr_team_id_repl"
21
+ ],
22
+ "map": {
23
+ "player_id": "object",
24
+ "player_name": "object",
25
+ "player_display_name": "object",
26
+ "position": "object",
27
+ "position_group": "object",
28
+ "headshot_url": "object",
29
+ "recent_team": "object",
30
+ "season": "int32",
31
+ "week": "int32",
32
+ "season_type": "object",
33
+ "opponent_team": "object",
34
+ "completions": "int32",
35
+ "attempts": "int32",
36
+ "passing_yards": "int32",
37
+ "passing_tds": "int32",
38
+ "interceptions": "int32",
39
+ "sacks": "int32",
40
+ "sack_yards": "int32",
41
+ "sack_fumbles": "int32",
42
+ "sack_fumbles_lost": "int32",
43
+ "passing_air_yards": "int32",
44
+ "passing_yards_after_catch": "int32",
45
+ "passing_first_downs": "int32",
46
+ "passing_epa": "float32",
47
+ "passing_2pt_conversions": "int32",
48
+ "pacr": "float32",
49
+ "dakota": "float32",
50
+ "carries": "int32",
51
+ "rushing_yards": "int32",
52
+ "rushing_tds": "int32",
53
+ "rushing_fumbles": "int32",
54
+ "rushing_fumbles_lost": "int32",
55
+ "rushing_first_downs": "int32",
56
+ "rushing_epa": "float32",
57
+ "rushing_2pt_conversions": "int32",
58
+ "receptions": "int32",
59
+ "targets": "int32",
60
+ "receiving_yards": "int32",
61
+ "receiving_tds": "int32",
62
+ "receiving_fumbles": "int32",
63
+ "receiving_fumbles_lost": "int32",
64
+ "receiving_air_yards": "int32",
65
+ "receiving_yards_after_catch": "int32",
66
+ "receiving_first_downs": "int32",
67
+ "receiving_epa": "float32",
68
+ "receiving_2pt_conversions": "int32",
69
+ "racr": "float32",
70
+ "target_share": "float32",
71
+ "air_yards_share": "float32",
72
+ "wopr": "float32",
73
+ "special_teams_tds": "int32",
74
+ "fantasy_points": "float32",
75
+ "fantasy_points_ppr": "float32"
76
+ }
77
+ }
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "players",
3
+ "description": "nflfastR player meta data",
4
+ "last_local_update": "2024-07-10T17:16:29.561868",
5
+ "download_url": "https://github.com/nflverse/nflverse-data/releases/download/players/players.csv",
6
+ "compression": null,
7
+ "engine": "c",
8
+ "freshness": {
9
+ "type": "gh_release",
10
+ "gh_api_endpoint": "https://api.github.com/repos/nflverse/nflverse-data/releases/tags",
11
+ "gh_release_tag": "players",
12
+ "sla_seconds": 900,
13
+ "last_freshness_check": "2024-07-10T17:16:27.390522+00:00"
14
+ },
15
+ "iter": {
16
+ "type": null,
17
+ "start": null
18
+ },
19
+ "assignments": [
20
+ "fastr_team_id_repl"
21
+ ],
22
+ "map": {
23
+ "status": "object",
24
+ "display_name": "object",
25
+ "first_name": "object",
26
+ "last_name": "object",
27
+ "esb_id": "object",
28
+ "gsis_id": "object",
29
+ "birth_date": "object",
30
+ "college_name": "object",
31
+ "position_group": "object",
32
+ "position": "object",
33
+ "jersey_number": "float32",
34
+ "height": "float32",
35
+ "weight": "float32",
36
+ "years_of_experience": "float32",
37
+ "team_abbr": "object",
38
+ "team_seq": "float32",
39
+ "current_team_id": "float32",
40
+ "football_name": "object",
41
+ "entry_year": "float32",
42
+ "rookie_year": "float32",
43
+ "draft_club": "object",
44
+ "draft_number": "float32",
45
+ "college_conference": "object",
46
+ "status_description_abbr": "object",
47
+ "status_short_description": "object",
48
+ "gsis_it_id": "float32",
49
+ "short_name": "object",
50
+ "smart_id": "object",
51
+ "headshot": "object",
52
+ "suffix": "object",
53
+ "uniform_number": "object",
54
+ "draft_round": "float32",
55
+ "season": "float32"
56
+ }
57
+ }
@@ -1,70 +1,55 @@
1
1
  {
2
2
  "name": "qbelo",
3
3
  "description": "538/nfelo QB Elo model",
4
- "last_local_update": "2023-12-28T05:45:51.537070",
5
- "download_url": "https://raw.githubusercontent.com/nflverse/nfldata/master/data/games.csv",
4
+ "last_local_update": "2024-07-08T03:34:46.537617",
5
+ "download_url": "https://raw.githubusercontent.com/greerreNFL/nfeloqb/main/qb_elos.csv",
6
6
  "compression": null,
7
7
  "engine": "c",
8
8
  "freshness": {
9
9
  "type": "gh_commit",
10
- "gh_api_endpoint": "https://api.github.com/repos/nflverse/nfldata/commits",
10
+ "gh_api_endpoint": "https://api.github.com/repos/greerreNFL/nfeloqb/commits?path=qb_elos.csv",
11
11
  "gh_release_tag": null,
12
12
  "sla_seconds": 900,
13
- "last_freshness_check": "2023-12-28T05:45:51.100815+00:00"
13
+ "last_freshness_check": "2024-07-10T17:16:07.189582+00:00"
14
14
  },
15
15
  "iter": {
16
16
  "type": null,
17
17
  "start": null
18
18
  },
19
- "assignments": [
20
- "game_id_repl"
21
- ],
19
+ "assignments": [],
22
20
  "map": {
23
- "game_id": "object",
21
+ "date": "object",
24
22
  "season": "int32",
25
- "game_type": "object",
26
- "week": "int32",
27
- "gameday": "object",
28
- "weekday": "object",
29
- "gametime": "object",
30
- "away_team": "object",
31
- "away_score": "float32",
32
- "home_team": "object",
33
- "home_score": "float32",
34
- "location": "object",
35
- "result": "float32",
36
- "total": "float32",
37
- "overtime": "float32",
38
- "old_game_id": "float32",
39
- "gsis": "float32",
40
- "nfl_detail_id": "object",
41
- "pfr": "object",
42
- "pff": "float32",
43
- "espn": "int32",
44
- "ftn": "float32",
45
- "away_rest": "int32",
46
- "home_rest": "int32",
47
- "away_moneyline": "float32",
48
- "home_moneyline": "float32",
49
- "spread_line": "float32",
50
- "away_spread_odds": "float32",
51
- "home_spread_odds": "float32",
52
- "total_line": "float32",
53
- "under_odds": "float32",
54
- "over_odds": "float32",
55
- "div_game": "int32",
56
- "roof": "object",
57
- "surface": "object",
58
- "temp": "float32",
59
- "wind": "float32",
60
- "away_qb_id": "object",
61
- "home_qb_id": "object",
62
- "away_qb_name": "object",
63
- "home_qb_name": "object",
64
- "away_coach": "object",
65
- "home_coach": "object",
66
- "referee": "object",
67
- "stadium_id": "object",
68
- "stadium": "object"
23
+ "neutral": "int32",
24
+ "playoff": "object",
25
+ "team1": "object",
26
+ "team2": "object",
27
+ "elo1_pre": "float32",
28
+ "elo2_pre": "float32",
29
+ "elo_prob1": "float32",
30
+ "elo_prob2": "float32",
31
+ "elo1_post": "float32",
32
+ "elo2_post": "float32",
33
+ "qbelo1_pre": "float32",
34
+ "qbelo2_pre": "float32",
35
+ "qb1": "object",
36
+ "qb2": "object",
37
+ "qb1_value_pre": "float32",
38
+ "qb2_value_pre": "float32",
39
+ "qb1_adj": "float32",
40
+ "qb2_adj": "float32",
41
+ "qbelo_prob1": "float32",
42
+ "qbelo_prob2": "float32",
43
+ "qb1_game_value": "float32",
44
+ "qb2_game_value": "float32",
45
+ "qb1_value_post": "float32",
46
+ "qb2_value_post": "float32",
47
+ "qbelo1_post": "float32",
48
+ "qbelo2_post": "float32",
49
+ "score1": "float32",
50
+ "score2": "float32",
51
+ "quality": "float32",
52
+ "importance": "float32",
53
+ "total_rating": "float32"
69
54
  }
70
55
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "qbr",
3
3
  "description": "nflverse QBR",
4
- "last_local_update": null,
4
+ "last_local_update": "2024-07-07T23:13:57.437639",
5
5
  "download_url": "https://github.com/nflverse/nflverse-data/releases/download/espn_data/qbr_season_level.csv",
6
6
  "compression": null,
7
7
  "engine": "c",
@@ -10,7 +10,7 @@
10
10
  "gh_api_endpoint": "https://api.github.com/repos/nflverse/nflverse-data/releases/tags",
11
11
  "gh_release_tag": "espn_data",
12
12
  "sla_seconds": 900,
13
- "last_freshness_check": null
13
+ "last_freshness_check": "2024-07-10T17:15:30.992561+00:00"
14
14
  },
15
15
  "iter": {
16
16
  "type": null,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rosters",
3
3
  "description": "nflfastR rosters",
4
- "last_local_update": "2023-12-28T05:46:15.090925",
4
+ "last_local_update": "2024-07-08T03:35:10.725351",
5
5
  "download_url": "https://github.com/nflverse/nflverse-data/releases/download/rosters/roster_{0}.csv",
6
6
  "compression": null,
7
7
  "engine": "c",
@@ -10,7 +10,7 @@
10
10
  "gh_api_endpoint": "https://api.github.com/repos/nflverse/nflverse-data/releases/tags",
11
11
  "gh_release_tag": "rosters",
12
12
  "sla_seconds": 900,
13
- "last_freshness_check": "2023-12-28T05:45:52.047895+00:00"
13
+ "last_freshness_check": "2024-07-10T17:16:08.157376+00:00"
14
14
  },
15
15
  "iter": {
16
16
  "type": "season",
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "wepa",
3
+ "description": "nfelo Weighted Expected Points Model",
4
+ "last_local_update": "2024-07-07T23:13:39.454179",
5
+ "download_url": "https://raw.githubusercontent.com/greerreNFL/wepa/main/data/wepa_by_game_pit.csv",
6
+ "compression": null,
7
+ "engine": "c",
8
+ "freshness": {
9
+ "type": "gh_commit",
10
+ "gh_api_endpoint": "https://api.github.com/repos/greerreNFL/wepa/commits?path=data/wepa_by_game_pit.csv",
11
+ "gh_release_tag": null,
12
+ "sla_seconds": 900,
13
+ "last_freshness_check": "2024-07-10T17:16:06.701316+00:00"
14
+ },
15
+ "iter": {
16
+ "type": null,
17
+ "start": null
18
+ },
19
+ "assignments": [],
20
+ "map": {
21
+ "Unnamed: 0": "int32",
22
+ "game_id": "object",
23
+ "team": "object",
24
+ "opponent": "object",
25
+ "season": "int32",
26
+ "game_number": "int32",
27
+ "margin": "float32",
28
+ "margin_against": "float32",
29
+ "epa": "float32",
30
+ "epa_against": "float32",
31
+ "epa_net": "float32",
32
+ "epa_net_opponent": "float32",
33
+ "wepa": "float32",
34
+ "d_wepa": "float32",
35
+ "wepa_net": "float32",
36
+ "wepa_against": "float32",
37
+ "d_wepa_against": "float32",
38
+ "wepa_net_opponent": "float32"
39
+ }
40
+ }
@@ -2,15 +2,15 @@
2
2
  "season_states": {
3
3
  "last_full_week": {
4
4
  "season": 2023,
5
- "week": 16
5
+ "week": 22
6
6
  },
7
7
  "last_partial_week": {
8
8
  "season": 2023,
9
- "week": 17
9
+ "week": 22
10
10
  },
11
11
  "next_week": {
12
- "season": 2023,
13
- "week": 18
12
+ "season": 2024,
13
+ "week": 1
14
14
  }
15
15
  }
16
16
  }
@@ -58,7 +58,7 @@ def get_season_state(state_type='last_full_week'):
58
58
  '''
59
59
  ## open global variables json ##
60
60
  global_variables = None
61
- with open('{0}/global_variables.json'.format(pathlib.Path(__file__).parent.resolve()), 'r') as fp:
61
+ with open('{0}/Utilities/global_variables.json'.format(pathlib.Path(__file__).parent.resolve()), 'r') as fp:
62
62
  ## load config ##
63
63
  global_variables = json.load(fp)
64
64
  ## check input ##
@@ -67,4 +67,4 @@ def get_season_state(state_type='last_full_week'):
67
67
  state_type, '\n '.join(list(global_variables['season_states'].keys()))
68
68
  ))
69
69
  ## if state valid, return ##
70
- return global_variables[state_type]['season'], global_variables[state_type]['week']
70
+ return global_variables['season_states'][state_type]['season'], global_variables['season_states'][state_type]['week']
@@ -0,0 +1,38 @@
1
+ import pandas as pd
2
+ import pathlib
3
+ import time
4
+
5
+ from .nfelodcm import get_df
6
+
7
+ def test_all_maps():
8
+ '''
9
+ Attempts to load all maps
10
+ '''
11
+ print('Testing all available maps')
12
+ map_loc = '{0}/Maps'.format(
13
+ pathlib.Path(__file__).parent.resolve()
14
+ )
15
+ maps = []
16
+ for f in pathlib.Path(map_loc).iterdir():
17
+ if f.is_file() and f.suffix == ".json":
18
+ maps.append(f.stem)
19
+ print(' Found {0} maps'.format(len(maps)))
20
+ if len(maps) > 0:
21
+ for table_map in maps:
22
+ print(' Loading {0}'.format(table_map))
23
+ ## first load ##
24
+ l1_start = time.time()
25
+ get_df(table_map)
26
+ l1_end = time.time()
27
+ print(' 1st load completed in {0} seconds'.format(round(
28
+ l1_end-l1_start,3
29
+ )))
30
+ ## second load
31
+ l2_start = time.time()
32
+ get_df(table_map)
33
+ l2_end = time.time()
34
+ print(' 2st load completed in {0} seconds'.format(round(
35
+ l2_end-l2_start,3
36
+ )))
37
+
38
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nfelodcm
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: Python package for loading and caching CSVs hosted on github into pandas dataframes
5
5
  Author-email: Robert Greer <nfl@robbygreer.com>
6
6
  Maintainer-email: Robert Greer <nfl@robbygreer.com>
@@ -0,0 +1,38 @@
1
+ nfelodcm/__init__.py,sha256=dml7yO-TOqHDH1jc393m20hatOBfEC4LFDPF80ddTg0,202
2
+ nfelodcm/nfelodcm/nfelodcm.py,sha256=UBNSNENeYGJFAAYnhGdlfsMKfCZW4Ofh7LLSiA0f7z8,2189
3
+ nfelodcm/nfelodcm/tests.py,sha256=Fp077LGBajP9g2Tpg5G6mDatustNceMUVtCgh_uM53I,1082
4
+ nfelodcm/nfelodcm/Engine/DCMTable.py,sha256=ZHHDNmhpdJ2JTc-y3iYe4jjXcViOjRNw_zdF4-UB2jE,3024
5
+ nfelodcm/nfelodcm/Engine/__init__.py,sha256=vEEWcIBE4KLHoBCT1s2AIeSZxMfv1bcAqUNAJzSMSMo,31
6
+ nfelodcm/nfelodcm/Engine/Assignments/__init__.py,sha256=IPKxTBbO3b0xaO922zkwif0FFd8Xqe3ZvCIFjhYg1oE,80
7
+ nfelodcm/nfelodcm/Engine/Assignments/assignment.py,sha256=4qY95cSuivxEyjOIerfza_25sj-0ELjbjf5awXqm2pY,1209
8
+ nfelodcm/nfelodcm/Engine/Assignments/assignments/__init__.py,sha256=Rvz5gV9yxxQFd0wE6qek6xM2lejrIEneHVdhKac1eyU,161
9
+ nfelodcm/nfelodcm/Engine/Assignments/assignments/desc_based_plays.py,sha256=LAXOlE-IW8A49rRagxcAGRao_4c2RdC7AK6_iV3M2Vc,1810
10
+ nfelodcm/nfelodcm/Engine/Assignments/assignments/fastr_team_repl.py,sha256=TJGcnY_8yEBwnBxXJ5m9eQ5YWfnqN2UAhaVBLeGJ8sw,976
11
+ nfelodcm/nfelodcm/Engine/Assignments/assignments/penalty_formatting.py,sha256=Ia3x_Z8EnzI4Bz_6LEfY0ICWvdmyzJsckrOUXGYgfRY,517
12
+ nfelodcm/nfelodcm/Engine/Primatives/DataPull.py,sha256=x1SUfCpxbXr923o52ExLMJItVKujSfcBeJDrDkFop70,2909
13
+ nfelodcm/nfelodcm/Engine/Primatives/Freshness.py,sha256=VyRZmW6LI3jd43aWLo7OTnX3ZgGkwu85hn4r3_3ChZo,9803
14
+ nfelodcm/nfelodcm/Engine/Primatives/LocalIO.py,sha256=LRKpP0t30t_ZUfIi3ASULkB4aKVV4cINZbp1wbrayac,2701
15
+ nfelodcm/nfelodcm/Engine/Primatives/TableMap.py,sha256=M_T2TTxbT2B1Mv9hY3Ocli_AkoPirNUJDZ8n1HQPlgM,2636
16
+ nfelodcm/nfelodcm/Engine/Primatives/__init__.py,sha256=JUHF_8_1vqbp7M5rJfDwzqkgi6UuLTPp_lxCw7t1uwc,124
17
+ nfelodcm/nfelodcm/Maps/filmmargins.json,sha256=LDjMglK3cFEqGepHjRTE4b4VPyrm2IYN_2uqGnSvuzg,945
18
+ nfelodcm/nfelodcm/Maps/games.json,sha256=g8ze7uY-TnE04i9JJvkEHZ6lgzYy7gg2BHIK4uQTP0U,1835
19
+ nfelodcm/nfelodcm/Maps/logos.json,sha256=ftUHOFtgwQIbpOFcUU2Zcqw_kZyJoALHbhCuYvIrtsg,1133
20
+ nfelodcm/nfelodcm/Maps/market_data.json,sha256=3tvrlF1VlXsIj6CO70EewCyUuqRhJ75UyvnKTDvJrrY,1994
21
+ nfelodcm/nfelodcm/Maps/participants.json,sha256=2tUeihDe-mQ8KqT9lFYFd8cREvO9xTjdMYBte3ghXD0,1325
22
+ nfelodcm/nfelodcm/Maps/pbp.json,sha256=G6ymmGx-omDDFBh_H1HA1ZhSS9CbjPlZPM0Pj5vM3A0,10439
23
+ nfelodcm/nfelodcm/Maps/player_stats.json,sha256=Mdc8ADI1STjXHrOQuH9_X_XT0vImVE_FLhVbBTD7axA,2308
24
+ nfelodcm/nfelodcm/Maps/players.json,sha256=sqhPluayAiIpEzFPxyBvV51xbbj_xuTaWXIlUIlfHiw,1610
25
+ nfelodcm/nfelodcm/Maps/qbelo.json,sha256=U3_4Tr5iMWDKYq1Z8EdaNnRTxVmS4HsTtjJbCyCZwLk,1508
26
+ nfelodcm/nfelodcm/Maps/qbr.json,sha256=VtQugxb8owcKkrulVmoxZiFH175advnM-NpyGKc_OT0,1207
27
+ nfelodcm/nfelodcm/Maps/rosters.json,sha256=9tAvjDW7C2vImUFjP-BbgGpz7IZGlaizqjqMyalVtg0,1435
28
+ nfelodcm/nfelodcm/Maps/wepa.json,sha256=w2fmCODJcGY_RUEv0UeqVO-ugpb8si9Nm1VLwrMAQA0,1130
29
+ nfelodcm/nfelodcm/Utilities/__init__.py,sha256=KZPooahoLm1wPGw_mfOUI92FHLSvFNpMJmaRu6SCHq8,269
30
+ nfelodcm/nfelodcm/Utilities/checks.py,sha256=oUIqRFywLBYpN2e5iCR7ReLGrQNVgJxbNe458rgupCU,4179
31
+ nfelodcm/nfelodcm/Utilities/extract_map.py,sha256=DVITMr0mlP6p2V1ZdaIcbEavs-FZ28-EZ885maiS_KU,969
32
+ nfelodcm/nfelodcm/Utilities/global_variables.json,sha256=VtKM5XRfpJYAaVYRoLO1Dc5loKzccdf6Z1Q7ai9-W00,298
33
+ nfelodcm/nfelodcm/Utilities/retrieve_season_state.py,sha256=ZrBaMWmo2DA9OZqZ6MBWmrY9Llkc5OUfxmDk7EB1tRU,579
34
+ nfelodcm/nfelodcm/Utilities/set_season_state.py,sha256=Y5fvop3EZfWcx2F85MtSNEGnwjofWyEMg4_HLTenAUA,3737
35
+ nfelodcm-0.1.8.dist-info/METADATA,sha256=yHMP3aUugLpzL6PRHwLq65kBO3K6IQUwm15MqjBY510,4409
36
+ nfelodcm-0.1.8.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
37
+ nfelodcm-0.1.8.dist-info/top_level.txt,sha256=SlNA7_yZSwWvZIl9Md6brBH_C7nAYnATe4CrvuUXOGo,9
38
+ nfelodcm-0.1.8.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (70.1.1)
2
+ Generator: setuptools (70.3.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,32 +0,0 @@
1
- nfelodcm/__init__.py,sha256=T4OUcbJYVwMLzKSrm7CRT84jeqlvQeVWhfV2RCKlYM0,112
2
- nfelodcm/nfelodcm/nfelodcm.py,sha256=97BA_U3RikyzxS5Mbewrgb4HYYTa1YQ4S47l5wN_tA0,2145
3
- nfelodcm/nfelodcm/Engine/DCMTable.py,sha256=9_x82HKPWOwkIqQF4qZvUCLg8n6IUQfrtLlaU4bPIxM,2646
4
- nfelodcm/nfelodcm/Engine/__init__.py,sha256=vEEWcIBE4KLHoBCT1s2AIeSZxMfv1bcAqUNAJzSMSMo,31
5
- nfelodcm/nfelodcm/Engine/Assignments/__init__.py,sha256=IPKxTBbO3b0xaO922zkwif0FFd8Xqe3ZvCIFjhYg1oE,80
6
- nfelodcm/nfelodcm/Engine/Assignments/assignment.py,sha256=Mol-Sc5buLfJ-h9ItzeUxXxPAzvj0rvQbUJhl3_lgL4,1191
7
- nfelodcm/nfelodcm/Engine/Assignments/assignments/__init__.py,sha256=9dMIp6FZu3ZrvTHomWqkzF77em8P9hxKhuXl-lIyRQ4,139
8
- nfelodcm/nfelodcm/Engine/Assignments/assignments/desc_based_plays.py,sha256=LAXOlE-IW8A49rRagxcAGRao_4c2RdC7AK6_iV3M2Vc,1810
9
- nfelodcm/nfelodcm/Engine/Assignments/assignments/fastr_team_repl.py,sha256=YD3ci5BsuEelFEuyRyUbAqSuAiBeIFsMuhTvXbvg6Ik,865
10
- nfelodcm/nfelodcm/Engine/Assignments/assignments/penalty_formatting.py,sha256=Ia3x_Z8EnzI4Bz_6LEfY0ICWvdmyzJsckrOUXGYgfRY,517
11
- nfelodcm/nfelodcm/Engine/Primatives/DataPull.py,sha256=x1SUfCpxbXr923o52ExLMJItVKujSfcBeJDrDkFop70,2909
12
- nfelodcm/nfelodcm/Engine/Primatives/Freshness.py,sha256=5dGPoFCeCBdhvr5g_Ey-xAK742F596uQfwBEfDouj7U,9679
13
- nfelodcm/nfelodcm/Engine/Primatives/LocalIO.py,sha256=aVdPiz-gkyrJLPOHBg87PiNWZAI6EZGfyJVej9Z2uk0,1527
14
- nfelodcm/nfelodcm/Engine/Primatives/TableMap.py,sha256=M_T2TTxbT2B1Mv9hY3Ocli_AkoPirNUJDZ8n1HQPlgM,2636
15
- nfelodcm/nfelodcm/Engine/Primatives/__init__.py,sha256=JUHF_8_1vqbp7M5rJfDwzqkgi6UuLTPp_lxCw7t1uwc,124
16
- nfelodcm/nfelodcm/Maps/games.json,sha256=TPEsWetmMBhmSWkCkSfgWqv1R1X9FkNIdDnWs_nqzGw,1829
17
- nfelodcm/nfelodcm/Maps/logos.json,sha256=7RLhXIp9bvp6EwALrwccCiY1_iNizYVV7M2XEwDRb5E,1776
18
- nfelodcm/nfelodcm/Maps/participants.json,sha256=Q0eeE0qbp91pIwjlH9WM7wI8n2gbwgywm-vRAkw1ofA,1211
19
- nfelodcm/nfelodcm/Maps/pbp.json,sha256=tU_Zhwju3iD7bju_4DnCJuUxXofkI-9jIe-zDQgylLU,10425
20
- nfelodcm/nfelodcm/Maps/qbelo.json,sha256=owSpd3hlC58HLCAeeTAhpIzhx9lA6EuvPfTlETklOpU,1832
21
- nfelodcm/nfelodcm/Maps/qbr.json,sha256=8zewIU0ted9FNFkjwyM308sR_pGvoB0PzZDeZhQUKXg,1153
22
- nfelodcm/nfelodcm/Maps/rosters.json,sha256=RvinVFIOSuBGeDwp3XqhKFeaWH8-A_nQRUO4KEM7JZ8,1435
23
- nfelodcm/nfelodcm/Utilities/__init__.py,sha256=KZPooahoLm1wPGw_mfOUI92FHLSvFNpMJmaRu6SCHq8,269
24
- nfelodcm/nfelodcm/Utilities/checks.py,sha256=oUIqRFywLBYpN2e5iCR7ReLGrQNVgJxbNe458rgupCU,4179
25
- nfelodcm/nfelodcm/Utilities/extract_map.py,sha256=DVITMr0mlP6p2V1ZdaIcbEavs-FZ28-EZ885maiS_KU,969
26
- nfelodcm/nfelodcm/Utilities/global_variables.json,sha256=FrKTTJ3VJRTV8RdQmjpXZzIPLLC594SpiMBR6xYs7Nw,299
27
- nfelodcm/nfelodcm/Utilities/retrieve_season_state.py,sha256=ZrBaMWmo2DA9OZqZ6MBWmrY9Llkc5OUfxmDk7EB1tRU,579
28
- nfelodcm/nfelodcm/Utilities/set_season_state.py,sha256=Y5fvop3EZfWcx2F85MtSNEGnwjofWyEMg4_HLTenAUA,3737
29
- nfelodcm-0.1.7.dist-info/METADATA,sha256=i33HF_CTQxLPayZsoNav3yyeHWywSuKmQHioMSBgIus,4409
30
- nfelodcm-0.1.7.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
31
- nfelodcm-0.1.7.dist-info/top_level.txt,sha256=SlNA7_yZSwWvZIl9Md6brBH_C7nAYnATe4CrvuUXOGo,9
32
- nfelodcm-0.1.7.dist-info/RECORD,,