-
Notifications
You must be signed in to change notification settings - Fork 0
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
Get Sepcific Player Stats #12
Comments
I like the idea. We'll need to make sure that we still have a keyword like "player" before the name or else we could run into issues if someone has an odd name like "Habs ". Where do we find the player IDs? Your link requires me to enter an existing ID but doesn't actually give a list of where to find one in the first place. Also, why a hash table? Do you mean just a normal list? Don't see where we can benefit from hash values. |
Whoops, had wrong link. This one has (I think) every player on every team. https://statsapi.web.nhl.com/api/v1/teams?expand=team.roster Having the player keyword is fine. I think we'd be able to get away without it but yes there are chances someone has a name that is shared by another function or a team, etc etc. My thoughts would be to hash player names to the players id. We can then use the ID with the other URL above. Possibly default to regular season and if they say playoffs change the scope? Since there are at least 806 people (26 players * 31 teams), hash offers us a O(1) lookup instead of running through the list O(n) on every player stat request. We need to make sure that we refresh the players table daily because new players get called up/pushed down all the time. Additionally we should hash names with and without periods in their names. Eg. "T.J. Brown" and "TJ Brown" should map to the same person. If you're going to work on this feature make a comment or assign yourself so we don't write conflicting code |
I guess what I was asking was what correspondence exists between a player's name and an arbitrary ID assigned by NHL's API that we could actually use to create the hash function. But now I remember that Python uses built-in dictionaries with internally resolved hash tables, so the heavy lifting (as usual) is already done. I can probably work on this is about a month. If you want to get it up running more soon, it's all yours. |
I was talking about python dicts, sorry for the confusion. Should have specified better in the above comments Edit: In progress |
first revision. Still WIP and will not be moved to prod until further tested locally |
I'm happy with the current output. This feature is still a WIP until we figure out if the general public likes it or hates it etc etc f430736 (handles some edge cases) |
Idea: Using this link to regenerate the player list every day (call ups?) into a hashtable with table with key name and value player ID. https://statsapi.web.nhl.com/api/v1/teams?expand=team.roster
Then, when people ask for a certain players stats we can lookup their ID then call https://statsapi.web.nhl.com/api/v1/people/ID for general information or something along the lines of
https://statsapi.web.nhl.com/api/v1/people/ID?expand=person.stats&stats=yearByYear,careerRegularSeason
(test with ID=8476460 if you'd like).
Also add modifiers for regular season v playoffs. We'll need to sum stats possibly over their career, or just their latest year in the NHL to start.
Also images: https://nhl.bamcontent.com/images/headshots/current/168x168/ID.jpg
https://nhl.bamcontent.com/images/actionshots/ID.jpg
The text was updated successfully, but these errors were encountered: