nfldb icon indicating copy to clipboard operation
nfldb copied to clipboard

Missing postseason games?

Open ghost opened this issue 7 years ago • 6 comments

Could anyone elucidate if they have a similar issue as me?

If I run the following code:

for year in range(2009,2017): db = nfldb.connect() q = nfldb.Query(db) print "games played in ", year, ": ", len(q.game(season_type='Postseason', season_year=year).as_games())

which tells me how many postseason games were played, I get the following:

games played in 2009 : 11 games played in 2010 : 11 games played in 2011 : 11 games played in 2012 : 11 games played in 2013 : 11 games played in 2014 : 11 games played in 2015 : 5 games played in 2016 : 0

If search for regular season games, the numbers all match up.

Can I conclude the DB is missing the postseason? I've update the database with nfldb-update (after fixing the JAX and LAC issue) and the problem persists.

Cheers!

ghost avatar Aug 30 '17 16:08 ghost

For 2015, you are missing the six games in nflgame\schedule.json referenced here: PR#256

For 2016, probably a case where your schedule was not updated while the postseason was in progress.

Maybe the easiest way to fix this is to replace your schedule.json with mine.

ochawkeye avatar Aug 30 '17 17:08 ochawkeye

Thanks for the prompt response. I ended up rebuilding the 2015 and 2016 schedules as mentioned in another post, and it appears to be working well. I'll be sure to look at closed issues before posting next time (this is my first time using Git and I only looked at the open ones).

ghost avatar Aug 30 '17 17:08 ghost

I'll be sure to look at closed issues before posting next time (this is my first time using Git and I only looked at the open ones).

Not your fault. Presumably when issues get "closed" that means the issue has gone away. With the packaged version of some of these files being so dated, though, some of those old issue tend to crop back up on new installations.

ochawkeye avatar Aug 30 '17 17:08 ochawkeye

So I've run nflgame's update-players and it works fine. When I run this though:

db = nfldb.connect() q = nfldb.Query(db) jay = q.player(full_name="Jay Cutler").as_players()[0] print jay

Jay Cutler is listed as being Chicago's QB, when he was recently traded to Miami. Do I need to take some steps for compatibility between running the nflgame update-players and accessing the database?

ghost avatar Aug 30 '17 18:08 ghost

If anyone stumbles on this later, you can solve the above issue by resetting the last_roster_download metadata in the DB as follows. Then when you run nfldb-update, it will pull the correct roster using nflgame. To get the info into the DB, it's not enough to just run update-players on the nflgame side.

psql nfldb -c "SET TIME ZONE 'UTC'; UPDATE meta SET last_roster_download = '2000-01-01 00:00:00+00';"

ghost avatar Aug 30 '17 18:08 ghost

Referencing Jay Cutler in a thread about postseason anything is probably where part of your problem lies. :smirk: But as you mention, an nfldb-update has to happen to update nfldb. By default, the nflgame update will only occur once every twelve hours unless you tell it otherwise. You can do this with --player-interval 0 to force a player update.

import nfldb
db = nfldb.connect()
q = nfldb.Query(db)
jay = q.player(full_name="Jay Cutler").as_players()[0]
print jay
Jay Cutler (MIA, QB)

ochawkeye avatar Aug 30 '17 19:08 ochawkeye