-
Notifications
You must be signed in to change notification settings - Fork 263
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
Data before 2009 #82
Comments
Not that I'm aware of.
This is only the schedule.
NFL.com has no API. It has an undocumented JSON feed that goes back to 2009. I'm not aware of any documentation, although this part of
This contains very little structured data. Notably, the plays are encoded as human readable descriptions only. Parsing them to get the granularity of detail expected by
Only if you've installed
Not sure. On my system, $ virtualenv nfl
$ source nfl/bin/activate
$ pip install nfldb
$ nflgame-update-players |
Thanks for the reply and great project. I initially mistakenly installed the project with The NFL.com json feed has a bit more than schedule. It lists scores too. I'll write up something to download and import them. |
You shouldn't have to write anything. I think |
Wish I'd read this earlier. Just got done downloading them all. I'll post the download script and link to tarball of them anyways. The script did skip a few that I had to download manually later. I'm assuming due to server errors so I wouldn't 100% trust it to get them all with out double checking later. https://drive.google.com/file/d/0BwoaqcZEOIvoLXpuY3FCelVKV2M/view?usp=sharing
|
I was able to get the data into the schedule.json file, but I'm having a hard time figuring out how to get it in the postgres db? Where is the code that imports the json file? I created a modified update_sched.py file here https://github.com/andr3w321/nflgame/blob/master/nflgame/update_sched.py with a function to import the folder I linked to above |
Without some help I think I'm going to give up attempting to add a pull request and just create a csv and work directly with sql to get the data in the db. I edited the file https://github.com/andr3w321/nflgame/blob/master/nflgame/update_sched.py to create the new function that successfully adds the schedules for the old games after running
I uploaded my schedule.json file here: https://drive.google.com/file/d/0BwoaqcZEOIvoeXdHRDV0SlJPbWc/view?usp=sharing |
Increase the batch size? The batch size should be increased when doing large bulk loads. It is kept small by default since most updates are small and incremental. Larger batch sizes require more memory.
A foreign key constraint means the teams aren't in the DB. You'll probably need to add a migration in My goodness am I glad we have FK constraints. They've prevented innumerable bugs from ever happening!
Not sure. Can you submit a PR anyway? I might be able to just build on what you've done and finish it. (It might be a little though.) |
Thanks for your help. I wrote some code to look at the team names and mascots. The only city name in question is RAI, which looks like it refers to the Los Angeles Raiders http:https://www.pro-football-reference.com/teams/rai/ The problem with just adding the unknown teams listed above is it will describe the 1983 Baltimore Ravens which were actually the Colts so to get it really done correctly would require adding the below teams.txt table to the db. I submitted a pull request with the update_sched.py --build-old method I added. print_teams_table.py
python print_teams_table.py > teams.txt
|
For a quick migration ignoring years this should work
Don't forget to add the same to https://github.com/BurntSushi/nfldb/blob/master/nfldb/team.py |
Okay I finally got the scores loaded in. It's far from an elegant solution, but it works. Some mascot names will still be incorrect. I added a folder with my scripts here: https://github.com/andr3w321/nflgame/tree/master/build-old-scripts The steps to get all the old game scores in the database are
|
FYI for anyone who does this I would recommend doing on a new database or after you do it renaming nfldb as it kind of breaks |
Hey, I'm working on a project with NFL stats at http:https://statstrac.com/. Just wanted to leave a comment that if you do import old score data and don't want to rename or make a new nfldb, just revert your
and that should do it :) Now you can safely run |
Thanks for the fix. The only problem I found is that whenever I upgrade nfldb
|
If you want data before 2009, you can purchase it from armchairanalysis for $49 - they go back to 2000. It looks like the owner used VBA to parse the HTML pages from the pre-gamecenter JSON days. |
Are there are any scripts already written to get data before 2009? I see that data at http:https://www.nfl.com/ajax/scorestrip?season=2014&seasonType=REG&week=1 goes back to 1970 for regular season. Is there an api doc page for nfl.com somewhere? This only gives gsis_ids, datetimes and scores. I'd be interested in more stats even if they're not complete drive by drive stats.
Update: I see you can match the gsis id with gamebook data here: http:https://www.nflgsis.com/1999/Reg/15/796/Gamebook.xml
In a somewhat unrelated note is it normal for
nflgame-update-players
to requiresudo
? I installed withpip install nfldb --user
and I getI do not have write access to "/usr/local/lib/python2.7/dist-packages/nflgame/players.json".
when I try running it without.The text was updated successfully, but these errors were encountered: