Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post Season #136

Open
mrg1999 opened this issue Jan 9, 2016 · 26 comments
Open

Post Season #136

mrg1999 opened this issue Jan 9, 2016 · 26 comments

Comments

@mrg1999
Copy link

mrg1999 commented Jan 9, 2016

Are stats available for the post season (game day, game time)?
I've tried:
q = nfldb.Query(db)
q.game(season_year=2015, season_type='Postseason', week = 1)
for g in q.as_games():
print g

I've also tried no week and week = 18 with the season_type set to 'Regular' and 'Postseason'

@BurntSushi
Copy link
Owner

Update nfldb, e.g., pip install --upgrade nfldb and re-run nfldb-update.

@mrg1999
Copy link
Author

mrg1999 commented Jan 9, 2016

Perfect, Thanks

@pla1
Copy link

pla1 commented Jan 10, 2016

Thanks!

@mrg1999
Copy link
Author

mrg1999 commented Jan 10, 2016

Is this something I should be doing on a regular basis?

@BurntSushi
Copy link
Owner

@mrg1999 At the very least, when the season transitions to the postseason, then you should. If you want to get bug fixes, then you should do it on a regular basis.

@tarlen5
Copy link

tarlen5 commented Feb 5, 2016

Hello, even after running pip install --upgrade nfldb and pip install --upgrade nflgame and nfldb-update, I still only get the first week of postseason games (and oddly the super bowl game scheduled). I've attached a screenshot of the output I get from an example query:
screen shot 2016-02-05 at 8 24 50 am

Did the data format of the games in postseason weeks after 1 change by the NFL? Is anyone else seeing this problem.

@ochawkeye
Copy link
Contributor

So weird that this is popping up so frequently...
image

I'm at a loss for why those items that appear in the schedule aren't showing up for you.

@tarlen5
Copy link

tarlen5 commented Feb 5, 2016

I'm on a mac and it looks like you're running windows (and I think the system was originally developed for linux) so maybe that's a clue to the problem?

@ochawkeye
Copy link
Contributor

You might be on to something there...
screenshot from 2016-02-05 18 19 46
screenshot from 2016-02-05 18 35 08

@Remedine
Copy link

Hello, I recently grabbed a copy of the database and noticed the same problem. I'm running windows. I did a straight sql query:
postseason_query

@jcapron
Copy link

jcapron commented Apr 9, 2016

I'm in the same situation as @Remedine, I ran pip install --upgrade nfldb and nfldb-update.
I only have those 5 Postseason games.

@danielcroona
Copy link

Me too, I installed everything this weekend on a server with Ubuntu 12.04.

I ran I ran pip install --upgrade nfldb, pip install --upgrade nflgame and nfldb-update and I still have only 5 postseason games in the DB.

Then I tried to run pip install --upgrade nfldb, pip install --upgrade nflgame and nfldb-update --update-schedules with no change.

2015_postseason

@hpadmanabhan
Copy link

I ran into the same problem on a Linux box and updating nfldb as outlined above by @BurntSushi did not resolve the issue.
The problem seems to be with nflgame not updating schedule.json with the schedules for those game which results in the gamecenter json data for those games not being downloaded when nfldb-update is run. Unclear why this is so.

I was able to however resolve this issue by manually rebuilding the 2015 postseason schedule by running:
<python 2 home lib>/site-packages/nflgame/update_sched.py --rebuild --year 2015 --phase POST

then running nfldb-update again once the schedule.json file was update by the above.

This resolution was also highlighted by @ochawkeye as a possible solution under this issue reported for nflgame.

@tstewart15
Copy link

@hpadmanabhan This worked! Thanks!

hpadmanabhan added a commit to hpadmanabhan/nfldb-Issue-136-Fix that referenced this issue Jun 21, 2016
…N file when nfldb-update is called with --update-schedules to pick up schedule changes instead of simply just refreshing the database from the existing file as it then requires a separate manual call to nflgame.update_sched to pick up the schedule changes in the interim when running nfldb-update after a gap period.
@hpadmanabhan
Copy link

After reviewing the code further the issue as I see it is that nfldb-update relies on nflgame schedule JSON being up-to-date to load all updates.
Keeping the nflgame JSON up-to-date however with the current code requires that nfldb-update be run continually in sync with season phases so schedule updates are picked up in a timely manner when the season transitions from regular to post as the schedule sources for the two are different and the switch in source is currently manual.

The issue of having to wait for @BurntSushi to switch the source when transitioning from regular to post season and vice versa is an issue in the nflgame code that needs to be addressed separately.

The additional issue with nfldb is that if you don't get the code updates right away and run nfldb-update you end up with this issue where you only get the updates for whatever schedule updates got pushed in schedule.json (playoff week 1) with the patch and whatever the current week happens to be (playoff week 5).
To get the missing interim data you have to separately run a nflgame schedule update as outlined by me above.
To resolve this on the nfldb side I have uploaded a patch whereby running nfldb-update --update-schedules will now implicitly rebuild the nflgame schedule.json file adding in the schedule for all the games in the interim and running nfldb-update again right after will load all the schedule and game data to the database.
Once @BurntSushi reviews, accepts and publishes it this issue should be resolved.

@jimmylowell
Copy link

Just chiming in to mention this is still an issue. I updated nflgame, nfldb, ran "nfldb-update --update-schedules ", but still had to run "<python 2 home lib>/site-packages/nflgame/update_sched.py --rebuild --year 2016 --phase POST" to get last weeks games in. No biggie, thanks for fix here!!

@danielcroona
Copy link

If nothing else works you can simply edit the file /nflgame/live.py and change the variable:
_CUR_SCHEDULE to "https://www.nfl.com/liveupdate/scorestrip/postseason/ss.xml"

i.e.

_CUR_SCHEDULE = "https://www.nfl.com/liveupdate/scorestrip/postseason/ss.xml"

@mrg1999
Copy link
Author

mrg1999 commented Jan 14, 2017

I wasn't getting any of postweek 1 scores so I rebuilt the schedule file with

/site-packages/nflgame/update_sched.py --rebuild --year 2016 --phase POST
Question: will I need to run this every week during the post season?
Thanks!

@ochawkeye
Copy link
Contributor

ochawkeye commented Jan 14, 2017 via email

@mrg1999
Copy link
Author

mrg1999 commented Jan 14, 2017

Looks like I'm updating nfldb only.
Is that the nflgame-update-players file in the scripts folder?

@ochawkeye
Copy link
Contributor

nfldb-update automatically refreshes the current week's schedule of games from nflgame.

Not knowing when you ran which commands I'd just be guessing. If you ran nfldb-update after the NFL flipped the calendar to week 2, that might have missed week 1 games, not sure.

I will say this: if you are successfully able to currently see Wildcard results I'm confident that 1) nflgame.live._CUR_SCHEDULE is set to properly pull playoff schedule and 2) your setup should run no problem today for the Divisional round.

An easy way to check if your nflgame schedule has today's games:

import nflgame
for game in nflgame.live._games_in_week(2016, 2, 'POST'):
    print game
{u'week': 2, u'meridiem': u'PM', u'gamekey': u'57161', u'season_type': u'POST', u'away': u'SEA', u'year': 2016, u'month': 1, u'eid': u'2017011400', u'time': u'4:35', u'home': u'ATL', u'wday': u'Sat', u'day': 14}
{u'week': 2, u'meridiem': u'PM', u'gamekey': u'57162', u'season_type': u'POST', u'away': u'HOU', u'year': 2016, u'month': 1, u'eid': u'2017011401', u'time': u'8:15', u'home': u'NE', u'wday': u'Sat', u'day': 14}
{u'week': 2, u'meridiem': u'AM', u'gamekey': u'57163', u'season_type': u'POST', u'away': u'PIT', u'year': 2016, u'month': 1, u'eid': u'2017011500', u'time': u'8:20', u'home': u'KC', u'wday': u'Sun', u'day': 15}
{u'week': 2, u'meridiem': u'PM', u'gamekey': u'57164', u'season_type': u'POST', u'away': u'GB', u'year': 2016, u'month': 1, u'eid': u'2017011501', u'time': u'4:40', u'home': u'DAL', u'wday': u'Sun', u'day': 15}

Or with nfldb after running nfldb-update

import nfldb
db  = nfldb.connect()
q = nfldb.Query(db)
q.game(season_year=2016, season_type='Postseason')
for game in q.as_games():
    print game
Postseason 2016 week 1 on 01/07 at 03:35PM, OAK (14) at HOU (27)
Postseason 2016 week 1 on 01/07 at 07:15PM, DET (6) at SEA (26)
Postseason 2016 week 1 on 01/08 at 12:05PM, MIA (12) at PIT (30)
Postseason 2016 week 1 on 01/08 at 03:40PM, NYG (13) at GB (38)
Postseason 2016 week 2 on 01/14 at 03:35PM, SEA (0) at ATL (0)
Postseason 2016 week 2 on 01/14 at 07:15PM, HOU (0) at NE (0)
Postseason 2016 week 2 on 01/15 at 07:20PM, PIT (0) at KC (0)
Postseason 2016 week 2 on 01/15 at 03:40PM, GB (0) at DAL (0)

@mrg1999
Copy link
Author

mrg1999 commented Jan 14, 2017

After
/site-packages/nflgame/update_sched.py --rebuild --year 2016 --phase POST
and
nfldb-update
I ran your script above and got the correct result.
My program currently runs a pip install --upgrade nfldb script at the beginning of the season, at the start of the regular season and at the beginning of the post season
I'm going to incorporate pip install --upgrade nflgame into that schedule.
Yes/No ?

@ochawkeye
Copy link
Contributor

ochawkeye commented Jan 14, 2017

That works only if the versions of nfldb & nflgame that live on PyPI are kept up to date. Since nflgame and nfldb haven't been updated there since September it wouldn't do much to help you with this issue.

@kennysushi
Copy link

Manually updating nflgame & nfldb fixed this issue for me.

Related issue I didn't see elsewhere: Can Query handle aggregating regular season & postseason results?

For example:

q = nfldb.Query(db)
q.game(season_year= season, season_type= 'Postseason')
q.game(season_year= season, week = [17], season_type = 'Regular')

for i in q.as_games():
print i

... does not return anything. Whereas each separate q.game(season_type = '') query does. Any suggestions on how to aggregate other than running separately and combining manually?

@ochawkeye
Copy link
Contributor

ochawkeye commented Jan 20, 2017

Editing this down to one comment so I don't look like a crazy(-ier) person when I look back on this post a year from now.

When you tell nfldb q.game(season_year= season, season_type= 'Postseason') you're telling it to throw out anything that isn't a Postseason game from the season in question. Your next command q.game(season_year= season, week = [17], season_type = 'Regular') says, "ok, now with what remains, give me just the games that occurred in week 17 of the regular season". There aren't any games that meet that criteria.

Your query of grabbing only the last 3 weeks of the regular season and first 2 weeks of the postseason presents an interesting challenge and one that isn't directly referenced in the wiki

A way to combine these separate queries is by joining the conjunctive queries disjunctively with the QueryOR function and .orelse (are you threatening me?)

import nfldb
db = nfldb.connect()

end_of_reg = nfldb.Query(db)
end_of_reg.game(season_year=2016, season_type='Regular', week=[15, 16, 17])

beg_of_post = nfldb.Query(db)
beg_of_post.game(season_year=2016, season_type='Postseason', week=[1, 2])  

last_five_games = nfldb.QueryOR(db)
last_five_games.orelse(end_of_reg)
last_five_games.orelse(beg_of_post)

print len(last_five_games.as_games())
56

Sorry for the stream of self-replies and if I sound like a total ass it's because I'm using words that have never come out of my own mouth before and are more or less vocabulary out of @BurntSushi wiki entry and rearranged to express the opposite concept.

@kennysushi
Copy link

Not at all! Thank you for the lengthy explanation. I saw "andalso" in the documentation but missed "orelse". Good find!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests