stattleship / stattleship-r

Stattleship R Wrapper
https://api.stattleship.com/
MIT License
48 stars 14 forks source link

NBA player game logs no longer returned as desired #33

Open pssguy opened 8 years ago

pssguy commented 8 years ago

This code has been working smoothly, providing 2015/6 regular season data

ss_get_result(token=,sport="basketball", league="nba", ep="game_logs", query=list(player_id="nba-stephen-curry"), version=1, verbose=TRUE, walk=TRUE)

but now returns

    [1] "Making initial API request"
    [[1]]
    [[1]]$game_logs
    list()

If I try something like

ss_get_result(token, sport = "basketball", league = "nba", ep = "game_logs",
          query = list(season_id="nba-2015-2016",player_id="nba-stephen-curry"), version = 1, walk = FALSE, page = NA,
          verbose = TRUE)

I just get the 7 championship games. I have tried entering a since value into the query list but that does not help either

Is it possible to access a players results for specified period - or indeed whole career gamelogs

I am using version 0.0.5

Btibert3 commented 8 years ago

The defaults change as new seasons and intervals come into play. You are getting the 7 championship games because that is the current interval, which you can read more about here. If you want regular season, try adding interval_type='regularseason' to the list. For example, to get his regular season game logs

x <- ss_get_result(token, 
                   sport = "basketball", 
                   league = "nba", 
                   ep = "game_logs",
                   query = list(season_id="nba-2015-2016",
                                player_id="nba-stephen-curry",
                                interval_type = 'regularseason'), 
                   version = 1, 
                   walk = TRUE, 
                   page = NA,
                   verbose = TRUE)

In your example above, you set the walk flag to FALSE. I often do this when I am testing queries, but if you wanted to get all of the data that will come across multiple pages, be sure to set it to TRUE

pssguy commented 8 years ago

@Btibert3 Thanks very muchfor code and link.

Just to clarify, the since parameter is only effective within a season_id and there is no way of obtaining all a player game_logs at one fell swoop and then filtering them subsequently by season and/or interval_type?

Btibert3 commented 8 years ago

To the best of my knowledge, not at the moment, but in the short run it's easy enough to loop through the intervals to grab what you need.

On Thu, Jun 23, 2016 at 3:35 PM, Andrew Clark notifications@github.com wrote:

@Btibert3 https://github.com/Btibert3 Thanks very muchfor code and link.

Just to clarify, the since parameter is only effective within a season_id and there is no way of obtaining all a player game_logs at one fell swoop and then filtering them subsequently by season and/or interval_type?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/stattleship/stattleship-r/issues/33#issuecomment-228159884, or mute the thread https://github.com/notifications/unsubscribe/AAMaT4PNWLupwo5tZ8msygAQZwLR3-wpks5qOt_kgaJpZM4I9FV6 .

pssguy commented 8 years ago

Sure no technical problem but for an interactive web experience one wants the quickest return of data possible

dthyresson commented 8 years ago

Hi @Btibert3 and @pssguy - have reset the default interval for NBA to the regularseason.

Thanks for the reminder!

dthyresson commented 8 years ago

@pssguy I think an enhancement of maybe and interval_type=all might be handy -- but, would also want: preseason, all-star/probowl, games as well? I guess so.

I'll add this as an enhancement to the API filter.

pssguy commented 8 years ago

@dthyresson Thanks very much. As long as I can get data.frame with an interval_type column then can process as required

sangamc commented 7 years ago

I am unable to get preseason stats using the same method described above. Are they available?

dthyresson commented 7 years ago

Hi, @sangamc.

We're in the process of migrating to a new dataset for both NBA and NHL so right now we don't have the preseason stats for those sports.

Plan is to do NHL first (as their season begins before NBA) and in time for regular season start.

We'll backfill all preseason stats.

Will update here when NBA is up and running for 2016-7 (could be next weekend).

sangamc commented 7 years ago

Thanks for the update! I've been testing my scripts with past data and 2015-16 season is more than enough for now.