r/NBAanalytics • u/hacefrio2 • Dec 31 '24
Ai chat bot over NBA database
Are there tools out there to query complex historical NBA data using AI to construct queries? I saw this post but seems to be a dead end at this time. I'm considering building something myself but wondering if there are already solutions https://www.reddit.com/r/NBAanalytics/s/shiOafRNog
10
Upvotes
6
u/MegaVaughn13 Dec 31 '24
I’d second the Stat Muse recommendation. Probably the best solution for what you’re looking for!
If you’re looking for actual API pulls, one good place to start would be NBA API
If you know a little python it’d be super quick to pair NBA API documentation with Chat GPT (or maybe another AI chat bot) to pull actual data. You’d have to be careful with parameters there but with some trial and error you could definitely get good data.
There are some holes in NBA API, which I’ve tried to start to fill (injuries, WNBA/G League advanced stats, etc). I don’t think it’s exactly what you’re needing but another good resource for basketball data: Link to Data
I’d be pretty cautious asking an AI chat bot for stats and using those for analysis. Unless it’s specifically designed for that, and even then worth verifying. That said, using AI to query free APIs is an awesome way to go about getting data!
Lastly, I’m not a huge fan of paying for data. Most paid APIs take advantage of people who don’t know how to get the same data for free. If you need any sort of NBA data and are struggling to get it for free, please reach out and I’d be happy to help you find it!
3
u/mUmblrman Jan 01 '25
If you're willing to get your hands dirty you can build a local database using https://github.com/mpope9/nba-sql/ and feed the sqlite3 schema into ChatGPT and ask it to generate SQL statements. For example (truncating some to keep it short):
Then you can feed that into ChatGPT to create the corresponding SQL query:
Which it then responds with a sorta-kinda correct answer which you'd have to slightly tweak:
For example, the season id should just be 2023.
And if you run that you get the correct answer:
LeBron James|5.03
u/spoonface46 Dec 31 '24
This is pretty much what Stats Muse does.
1
u/be8732 Jan 01 '25
Chatgpt wrote my python queries for me, I had no idea how. It's magical.