Giter Site home page Giter Site logo

balldontlie's People

Contributors

gmanthony avatar ynnadkrap avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

balldontlie's Issues

Season average percentage off by 100%

Season average percentages: field goal, three-point, and free throw are 100% less than the actual percentage.

Ex: fg_pct: 0.52 instead of actual percentage 52.0.

Adding isActive or isCurrent flag for players

Trying to figure out what is the active roster can't be done currently without querying for games, grabbing player ids for that team and then querying for that player. Is there a way to add a current flag on the player to make sure they are active?

Example: Most rookies don't have height listed but some have position and vice versa. Therefore, you can't figure out who is truly active on a team.

When I look at the players on the Pistons, Cade Cunningham has the same info as John Salley so I can't find the active roster without further querying.

Adding Sorting to Games Request

I love this API! It would be convenient for the project that I am working on if you were able to grab a paginated list of games in descending or ascending order. I would create a PR myself, but I don't know Ruby ๐Ÿ˜…. I want the option to query for the most recent games first.

Quarter Values

Hi,
would be possible to include the quarter values for each game?
At least for the current season it would be awesome!

Pagination

@ynnadkrap Is there some recommended pagination mechanism to be used? The reason being is that you would throttle if there are more than 60 requests per minute. So when you set the per_page=100 let's say, and you are querying the players, then you could be running close to that 60 requests per minute because of all the data.

In a similar light, when you look at the games and statistics endpoints if you want to use other storage mechanisms, you would want to increase the per_page to a number higher than 100. Would appreciate your guidance here!

Data not matching stats.nba.com

Just noticed a few discrepancies with some stats.
Example I've used is James Harden's season totals. I'm grabbing his stats/per game and adding them all together with a loop to get the season total, but a few of the stats (blocks, steals and rebounds) are off by one or two points.

I'm definitely getting all the games (have the results per page set to a conservative 100), so is there a possibility some game data hasn't been recorded properly?

Here's the link to his 2018-2019 season totals on stats.nba.com [https://stats.nba.com/player/201935/?Season=2018-19&SeasonType=Regular%20Season&PerMode=Totals](James Harden)

and a screenshot of my console output showing total points, rebounds, assists, steals, blocks & turnovers
Screen Shot 2019-04-15 at 11 16 16 am

Login/Home page

In order to create a more serviceable website with user accounts and UI interactions, we need a home page that allows users to login or register.

  • When a user visits www.balldontlie.io, they're presented a home page.
  • The home page has options to
    1. view documentation (the current documentation page should be available at www.balldontlie.io/docs)
    2. login
      • Either present a new page (balldontlie.io/login) or a modal. I don't have a strong preference.
      • Present a form with email and password
      • When a user logs in successfully, the options to login or register are removed, and we display the API token instead
    3. register
      • Either present a new page (balldontlie.io/register) or a modal. I don't have a strong preference.
      • Present a form with email, password, and confirm password.
      • Ideally we require email confirmation.
      • No strong opinion on password requirements.
      • When a user successfully registers, we reload the home page and remove the login and register options and display
        1. the API token if we don't implement email confirmation
        2. some message that says they need to confirm their email to receive their API token

I want to use react on the frontend. Even though it's overkill for this feature, it'll be a good foundation to build on in the event we want to build out more features. Let's use create-react-app with typescript (https://facebook.github.io/create-react-app/docs/adding-typescript) enabled. I don't think we need to use devise for auth โ€” we can hand-roll something super simple (use has_secure_password for user model https://api.rubyonrails.org/classes/ActiveModel/SecurePassword/ClassMethods.html). Since rails is in API mode, we'll need to include sessions and cookies:

class Application < Rails::Application
  config.load_defaults 5.2

  config.api_only = true

  config.middleware.use ActionDispatch::Cookies
  config.middleware.use ActionDispatch::Session::CookieStore
end


class ApplicationController < ActionController::API
  include ActionController::Cookies
  include ActionController::RequestForgeryProtection

  protect_from_forgery with: :exception

  ...

end

Since this will be a single page app, we can make a request to an endpoint on the initial render that checks to see if the user is logged in.

Get Multiple Season Averages in one call

Hi there, big fan of this API and all the work you've put into it. Not sure if I've missed something, but it seems like there are no existing endpoints for calling multiple season averages for one player in one call. I don't mind looping through, but I'd really like to be efficient and limit the amount of calls made in my app.

Thanks again!

Adding games to stats where players played 0 minutes

For players of the current season, there are some games in the stats portion of the API where a player played 0 minutes. This is affecting season averages of the players because these games are being counted as games played, so all per game statistical categories are being deflated.

Example: As of 2/6/2020, Beal is averaging 29.2 ppg, but the season average being retrieved is 26.63 since there are four games added to his stats where he played 0 minutes (ie: didn't play.)

Issue with stats not updating

It seems like when I make a call the stats aren't up to date.

For example, if I call Cedi Osman's stats at

I'm expecting to see 29 games, but I'm only seeing 25.

Similarly, if I call the Cleveland Cavs stats at

I'm expecting to see 29 games, but I'm only seeing 25.

I'm not sure if this is an issue with just the Cavs and their players (that's the only data I'm looking at). Or if it's more widespread.

Structure for getting 2020 games different?

Is the link structure for getting games for this season different than last? I'm able to get last seasons games still with this structure: https://www.balldontlie.io/api/v1/games?seasons[]=2019&team_ids[]=9&per_page=82

But when I switch out the 2019 for 2020 I'm getting an empty array.

Thanks!

Images of players

Will you consider adding images of each player? Doesn't have to be everyone

Years Active

Hi, would it be possible in the Get All Players response get the seasons that a player was active?
e.g. years_active: 1979-1988 or active: 2018-present

As well as maybe a boolean to check if the player is active?
e.g. active: true

Including More info on players

Hi there,
I was wondering if you could include the number of years the players have been in NBA as well as when their careers have started and ended/still active. Thank you for the great API, btw.

Game stats not updated

As of yesterday (2020-01-29) game scored are not being updated. When viewing games for the 29th and today (the 30th), scores are at 0 and the status shows the time of the game despite already being completed/in progress.

[BUG] I get games result of 1990 bu calling an other specific season

Hello,

I just found out that when I call the following URL : https://www.balldontlie.io/api/v1/games?per_page=100&seasons=2018&page=10 in the response I have multiple games from 1990 even if I specified seasons = 2018 in the query parameter.
Here is an example I got from the response :

{
id: 627,
date: "1990-11-02T00:00:00.000Z",
home_team: {
id: 5,
abbreviation: "CHI",
city: "Chicago",
conference: "East",
division: "Central",
full_name: "Chicago Bulls",
name: "Bulls"
},
home_team_score: 116,
period: 4,
postseason: false,
season: 1990,
status: "Final",
time: " ",
visitor_team: {
id: 23,
abbreviation: "PHI",
city: "Philadelphia",
conference: "East",
division: "Atlantic",
full_name: "Philadelphia 76ers",
name: "76ers"
},
visitor_team_score: 124
}

BR,

Xavier

Drafted year / Year active

Would it be possible to add drafted year to player's information? This would help with extracting a particular player's stats for every year he played.

Incorrect Game Score

While I was getting the data for all Lakers games in the 2021-2022 season, it shows the January 17th, 2022 Jazz vs Lakers score as 95-72 with the Jazz beating the Lakers, when in reality the Lakers beat the Jazz 95-101. This score should be fixed in the API's database.

Wrong scores

There are a few instances of wrong scores. A couple that I have found so far for the 2021-2022 season:

Los Angeles Lakers vs Golden State Warriors (03/05/2022)

  • Game id: 474367
  • home_team_score: 66
  • home_team_score should be 124

Atlanta Hawks vs Washington Wizards (04/06/2022)

  • Game id: 474603
  • home_team_score: 74
  • home_team_score should be 118

edit: Some games don't have scores at all
Los Angeles Lakers vs Toronto Raptors (03/14/2022)

  • Game id: 474436

San Antonio Spurs vs Minnesota Timberwolves (also 03/14/2022)

  • Game id: 474429

another edit: It seems games played on 03/14/2022 don't have scores. I've found another:
Utah Jazz vs Milwaukee Bucks

  • Game id: 474431

Search For A Team

Would you please consider adding searching for a game feature? I think we need it for games just like players.

Additional filters

I wish you could filter by current players, or see a list of current players on each team. Right now, you can only get all 3,800+ players or a specific player.

P.S. This API is awesome, but a boy can dream!

date format in specific game api different from others

API Link: https://www.balldontlie.io/#get-a-specific-game

the date format "2018-10-16T00:00:00.000Z" in this api documentation differ from actually get.

curl https://www.balldontlie.io/api/v1/games/48765

{
    "id": 48765,
    "date": "2019-02-11 00:00:00 UTC",
    "home_team": {
        "id": 5,
        "abbreviation": "CHI",
        "city": "Chicago",
        "conference": "East",
        "division": "Central",
        "full_name": "Chicago Bulls",
        "name": "Bulls"
    },
    "home_team_score": 99,
    "period": 4,
    "postseason": false,
    "season": 2018,
    "status": "Final",
    "time": "     ",
    "visitor_team": {
        "id": 17,
        "abbreviation": "MIL",
        "city": "Milwaukee",
        "conference": "East",
        "division": "Central",
        "full_name": "Milwaukee Bucks",
        "name": "Bucks"
    },
    "visitor_team_score": 112
}

then curl https://balldontlie.io/api/v1/games?page=1&per_page=1

{
    "data": [
        {
            "id": 47179,
            "date": "2019-01-30T00:00:00.000Z",
            "home_team": {
                "id": 2,
                "abbreviation": "BOS",
                "city": "Boston",
                "conference": "East",
                "division": "Atlantic",
                "full_name": "Boston Celtics",
                "name": "Celtics"
            },
            "home_team_score": 126,
            "period": 4,
            "postseason": false,
            "season": 2018,
            "status": "Final",
            "time": " ",
            "visitor_team": {
                "id": 4,
                "abbreviation": "CHA",
                "city": "Charlotte",
                "conference": "East",
                "division": "Southeast",
                "full_name": "Charlotte Hornets",
                "name": "Hornets"
            },
            "visitor_team_score": 94
        }
    ],
    "meta": {
        "total_pages": 47486,
        "current_page": 1,
        "next_page": 2,
        "per_page": 1,
        "total_count": 47486
    }
}

Games not showing up in API

Some games aren't showing up when getting a certain date's games. For example, today (May 13), the Knicks game against the Spurs isn't up.

Percent Stats Changed from being logged as 0.xx to xx.xx

I am running some analysis on player stats, doing exponential weighted averages, and I realized any stat that is a % seems to have changed at some point from being inputted as 0.xx to xx.xx, not sure if this is by design for some reason but just wanted to inform you guys! This API has been life changing thank you.

Player Game Stats - Shot Percentage Inconsistent format / typing

I have noticed that some of the player shot percentages in game stats are sometimes listed as a percentage and sometimes in decimal format. One example is for Russell Westbrook during the 2018 season.

Data was stored as decimal format between the start of the 2018 season and 07-Feb-2019 and from there forward (9-Feb-19) it appears to be in a percentage type. The percentage type continues on through the 2019-20 season.

Here is the query I've been using: https://www.balldontlie.io/api/v1/stats?seasons[]=2018&player_ids[]=472&per_page=100

Page 0 of `players` endpoint is a duplicate of page 1

The documentation for the players endpoint indicates that the default for the page value is 0:
Screen Shot 2020-08-05 at 12 48 18 PM

This can be construed to imply that page counting begins at 0. However, while querying page 0 is permitted, it is, in fact, a duplicate of page 1:

$ curl "https://www.balldontlie.io/api/v1/players?per_page=100&page=0" > page0.txt    
$ curl "https://www.balldontlie.io/api/v1/players?per_page=100&page=1" > page1.txt
$ diff page0.txt page1.txt 
$ shasum page0.txt page1.txt
268996da6aebeb8d11914fb530029b1d69ff58fa  page0.txt
268996da6aebeb8d11914fb530029b1d69ff58fa  page1.txt
$ 

That page 0 query is permitted but is a duplicate of page 1 was confusing, and I didn't realize the duplication until later.

Some options for dealing with this issue include:

  • Return an error for queries to page 0
  • Update the documentation for the players endpoint to make it clearer that pagination begins with page 1

One time donation

Hey I've been using your project for a while and I'd like to make a one time donation instead of hassling with Patreon. Let me know how I can do this! I appreciate this project and want to let you know!

Returning averages for all players on a given team

This is more of a question, but I can't seem to find a direct way to this, so I think I might be overlooking something.

Is there a way to return only season averages for players only on a given team? Or would I have to just find all the player ids from the player endpoint first, then add them to the season averages endpoint?

Thanks!

Getting a Single Player ID

I'm having an issue getting a single player ID for some players. If I request a single ID for James Harden then it comes back with his Player ID.
James Harden Player ID URL: https://www.balldontlie.io/api/v1/players?search=james&search=harden

If I attempt to do the same thing with Lebron James I get 40 records.
LeBron James Player ID URL: https://www.balldontlie.io/api/v1/players?search=lebron&search=james

If I attempt to get LeBron James' ID by just using his first name then I get a single record.
LeBron James Player ID (first name only) URL: https://www.balldontlie.io/api/v1/players?search=lebron

The issue with this is that I can't consistently request a single ID with a predefined request and then perform queries based on that ID. I could attempt to parse all of the records based on the 40 records returned but it concerns me that I might not get the correct ID given that it's already uncertain based on a more refined query.

This puts me in a position of having to query all player ID's and then storing them locally for sorting. The downside is that I have to issue the queries for 30+ pages to acquire this list. One might think that this list wouldn't require updates that often BUT teams bring players up from G-League on a regular basis so I never know if the list will be complete / incomplete unless the data is updated. As a result it forces me to update the list regularly if I am to keep it accurate. On top of that it is inefficient and increases load on my app and your system and network infrastructure. This would also compound quickly as customer scale increases.

Season Standings

Would love to be able to query standings. We seem to have all the pieces: teams, standings, games with timestamps etc.

2019-2020 Season and PostSeason Player Game Stats Not Updating

Data updates do not occur past the 23rd of August:

Query: https://www.balldontlie.io/api/v1/stats?seasons[]=2019&player_ids[]=237&per_page=100
Issue: Returns 2019-2020 player game stat data up to 23-Aug-2020 but no games past the 23rd.

Query: https://www.balldontlie.io/api/v1/stats?seasons[]=2019&player_ids[]=237&per_page=100&postseason=true
Issue: Returns 2019-2020 player game stat data for postseason up to 23-Aug-2020 but no games past the 23rd.

Feature Request : Pull Multiple Players by Surrogate Key with Single Request

Get Players by multiple Surrogate Keys.

Currently there is a get by single surrogate key.

https://www.balldontlie.io/api/v1/players/25

Would like to see:

https://www.balldontlie.io/api/v1/players/_id=14,25,47

This would allow me to use the existing "name" search:
https://www.balldontlie.io/api/v1/players?per_page=10&page=1&search=smith

then use the above...create a new call.....and get the details of N number of player with a single call.

If I were a ruby developer, I would do a Pull Request. But I am not fluent in Ruby. :(

NBA Logos

Please remove if this isn't allowed @ynnadkrap but I love using your API and thought I'd share a library I developed that pairs well with this project!

I developed React NBA Logos: (https://github.com/ChrisKatsaras/React-NBA-Logos) which allows you to easily use SVG NBA logos in your React App. I figured since most people on here are using your API with some sort of web-app, I'd let them know to make their lives easier ๐Ÿ˜„

Keep up the great work!

Stats for multiple players

More of a question than an issue, but is there a reason you set it up to have multiple players joined by & and not just within one single player_ids array? What is the empty array after each player_id for? Can work around the implementation but was just curious!

Current
api/v1/season_averages?season=2018&player_ids[]=1&player_ids[]=2

Example
api/v1/season_averages?season=2018&player_ids=[1, 2]

Player History

I know that there has been an issue that was addressing the wrong players on the wrong teams. However, is there a way that when you search a player by their name (i.e. ?search=carmelo) that not only would you get the players that have the name of carmelo as either first or last, but you can also get a list of teams they have been a part of? I'm just curious.

Also, is there a way you can get the player's rating in games like NBA 2K20?

Would be interested to know if that's possible - btw great API and stellar docs as well @ynnadkrap

Player differential

Hello,

Would it be possible to have the players differential for each game.
I don't know exactly the name but this is the last column is the NBA box score.
It represents the value of the following operation : [points of the player's team] - [points of the opponents team] but only when the given player was on the court.
I know this stat is often forgotten but in my opinion, this is really important (in order to know the impact of the player on a game and not only if he plays to scores or for the stats).

Thank you in advance.
BR,

Xavier

Season totals

Hi there, is there an easy way to grab a players season total stats without having to dig in and loop over each game in the season? e.g total points, rebounds, assists, etc

Player's Team ID Updating w/ Trade News

Not sure if it because we are still in pre-season, but the source data of the API still has players in their 2019-2020 teams. Any idea when the source data will update to reflect current teams?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.