11 Commits
Author SHA1 Message Date
nprasad2077 878f8b549c New REST API Release 2024-06-28 09:48:32 -05:00
nprasad2077 1a3338ca68 Update README.md 2024-06-28 09:48:07 -05:00
nprasad2077 c575b4a74d Update README.md 2024-05-16 15:27:46 -05:00
nprasad2077 c664c9177d Update README.md 2024-05-16 13:47:12 -05:00
Nikhil Prasad a5db9d1110 Update README.md 2023-07-03 14:01:39 -05:00
Nikhil Prasad dc9b0df5be Update README.md
run in postman button
2023-06-23 19:53:48 -05:00
Nikhil Prasad 0dd41194d6 Update README.md 2023-06-23 19:39:13 -05:00
Nikhil Prasad 240449903c Update README.md 2023-06-23 19:33:11 -05:00
Nikhil Prasad ea5b535d50 Update README.md 2023-06-23 19:22:49 -05:00
Nikhil Prasad b38acd64cb Update README.md 2023-06-23 19:20:11 -05:00
Nikhil Prasad 204cc1a00d Merge pull request #15 from nprasad2077/deploy
Deploy
2023-06-23 19:11:52 -05:00
11 changed files with 3464 additions and 451 deletions

No files matched your search

+3445 -389
View File
File diff suppressed because it is too large. Load diff
-5
View File
@@ -1,5 +0,0 @@
# Activate Python Shell
```
source venv/bin/activate
```
-1
View File
@@ -1 +0,0 @@
teams_data = ['HOU' ,'PHI', 'BOS', 'NYK', 'NJN', 'TOR', 'MEM', 'NOK', 'DAL', 'SAS', 'DEN', 'MIN', 'SEA', 'UTA', 'POR', 'MIL', 'CLE', 'CHI', 'IND', 'DET', 'SAC', 'PHO', 'GSW', 'LAC', 'LAL', 'MIA', 'ATL', 'WAS', 'ORL', 'CHA']
@@ -1,18 +0,0 @@
from django.core.management.base import BaseCommand
from nba_data.models import PlayerAdvancedData
from django.db import connection
class Command(BaseCommand):
# Provides a description for use with the custom django management command (python manage.py help).
help = 'Delete all player ADVANCED data with season specified and reset primary key sequence in DB'
def handle(self, *args, **options):
# Delete player data with season
season = 2006
PlayerAdvancedData.objects.filter(season=season).delete()
# Reset the PK sequence
with connection.cursor() as cursor:
cursor.execute('ALTER SEQUENCE nba_data_playeradvanceddata_id_seq RESTART WITH 1;')
self.stdout.write(self.style.SUCCESS('Successfully deleted all players with season = {} in DB'.format(season)))
@@ -1,18 +0,0 @@
# Generated by Django 4.2 on 2023-09-20 07:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('nba_data', '0017_alter_playershotchartdata_result'),
]
operations = [
migrations.AlterField(
model_name='playeradvanceddata',
name='ft_attempt_rate',
field=models.DecimalField(decimal_places=3, max_digits=8, null=True),
),
]
+1 -1
View File
@@ -79,7 +79,7 @@ class PlayerAdvancedData(models.Model):
PER = models.DecimalField(max_digits=6, decimal_places=1, null=True) PER = models.DecimalField(max_digits=6, decimal_places=1, null=True)
TS_percent = models.DecimalField(max_digits=5, decimal_places=3, null=True) TS_percent = models.DecimalField(max_digits=5, decimal_places=3, null=True)
three_p_attempt_rate = models.DecimalField(max_digits=5, decimal_places=3, null=True) three_p_attempt_rate = models.DecimalField(max_digits=5, decimal_places=3, null=True)
ft_attempt_rate = models.DecimalField(max_digits=8, decimal_places=3, null=True) ft_attempt_rate = models.DecimalField(max_digits=5, decimal_places=3, null=True)
orb_percent = models.DecimalField(max_digits=5, decimal_places=2, null=True) orb_percent = models.DecimalField(max_digits=5, decimal_places=2, null=True)
drb_percent = models.DecimalField(max_digits=5, decimal_places=2, null=True) drb_percent = models.DecimalField(max_digits=5, decimal_places=2, null=True)
trb_percent = models.DecimalField(max_digits=5, decimal_places=2, null=True) trb_percent = models.DecimalField(max_digits=5, decimal_places=2, null=True)
+2 -4
View File
@@ -6,7 +6,6 @@ from bs4 import BeautifulSoup
import csv import csv
import json import json
import time import time
from data import teams_data
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
@@ -28,11 +27,10 @@ from nba_data.models import PlayerAdvancedData
# Change MEM to VAN for 2001 and prior. # Change MEM to VAN for 2001 and prior.
# Change LAC to SDC for 1984 and prior. # Change LAC to SDC for 1984 and prior.
teams = ['HOU' ,'PHI', 'BOS', 'NYK', 'NJN', 'TOR', 'MEM', 'NOH', 'DAL', 'SAS', 'DEN', 'MIN', 'SEA', 'UTA', 'POR', 'MIL', 'CLE', 'CHI', 'IND', 'DET', 'SAC', 'PHO', 'GSW', 'LAC', 'LAL', 'MIA', 'ATL', 'WAS', 'ORL', 'CHA'] teams = ['HOU' ,'PHI', 'BOS', 'NYK', 'NJN', 'TOR', 'MEM', 'NOH', 'DAL', 'SAS', 'DEN', 'MIN', 'OKC', 'UTA', 'POR', 'MIL', 'CLE', 'CHI', 'IND', 'DET', 'SAC', 'PHO', 'GSW', 'LAC', 'LAL', 'MIA', 'ATL', 'WAS', 'ORL', 'CHA']
season = input('What season? ') season = input('What season? ')
for team in teams_data: for team in teams:
url_make = 'https://www.basketball-reference.com/teams/' + team + '/' + season + '.html' url_make = 'https://www.basketball-reference.com/teams/' + team + '/' + season + '.html'
response = requests.get(url_make) response = requests.get(url_make)
+5 -4
View File
@@ -6,7 +6,6 @@ from bs4 import BeautifulSoup
import csv import csv
import json import json
import time import time
from data import teams_data
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
@@ -30,11 +29,13 @@ from nba_data.models import PlayerPlayoffAdvancedData
teams = ['HOU' ,'PHI', 'BOS', 'NYK', 'NJN', 'TOR', 'MEM', 'NOH', 'DAL', 'SAS', 'DEN', 'MIN', 'OKC', 'UTA', 'POR', 'MIL', 'CLE', 'CHI', 'IND', 'DET', 'SAC', 'PHO', 'GSW', 'LAC', 'LAL', 'MIA', 'ATL', 'WAS', 'ORL', 'CHA'] teams = ['HOU' ,'PHI', 'BOS', 'NYK', 'NJN', 'TOR', 'MEM', 'NOH', 'DAL', 'SAS', 'DEN', 'MIN', 'OKC', 'UTA', 'POR', 'MIL', 'CLE', 'CHI', 'IND', 'DET', 'SAC', 'PHO', 'GSW', 'LAC', 'LAL', 'MIA', 'ATL', 'WAS', 'ORL', 'CHA']
teams2 = ['HOU' ,'PHI', 'NYK', 'NJN', 'TOR', 'MEM', 'NOH', 'SAS', 'DEN', 'MIN', 'OKC', 'UTA', 'POR', 'MIL', 'CLE', 'CHI', 'IND', 'DET', 'SAC', 'PHO', 'GSW', 'LAC', 'LAL', 'MIA', 'ATL', 'WAS', 'ORL', 'CHA']
team_abbreviations = ['ATL', 'BOS', 'BRK', 'CHI', 'CHO', 'CLE', 'DAL', 'DEN', 'DET', 'GSW', 'HOU', 'IND', 'LAC', 'LAL', 'MEM', 'MIA', 'MIL', 'MIN', 'NOP', 'NYK', 'OKC', 'ORL', 'PHI', 'PHO', 'POR', 'SAC', 'SAS', 'TOR', 'UTA', 'WAS']
season = input('What season? ') season = input('What season? ')
teams2 = 'PHI' for team in teams:
for team in teams_data:
url_make = 'https://www.basketball-reference.com/teams/' + team + '/' + season + '.html' url_make = 'https://www.basketball-reference.com/teams/' + team + '/' + season + '.html'
response = requests.get(url_make) response = requests.get(url_make)
+5 -3
View File
@@ -6,7 +6,6 @@ from bs4 import BeautifulSoup
import csv import csv
import json import json
import time import time
from data import teams_data
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
@@ -28,11 +27,14 @@ from nba_data.models import PlayerPlayoffTotalsData
# Change LAC to SDC for 1984 and prior. # Change LAC to SDC for 1984 and prior.
teams = ['HOU' ,'PHI', 'BOS', 'NYK', 'NJN', 'TOR', 'MEM', 'NOH', 'DAL', 'SAS', 'DEN', 'MIN', 'SEA', 'UTA', 'POR', 'MIL', 'CLE', 'CHI', 'IND', 'DET', 'SAC', 'PHO', 'GSW', 'LAC', 'LAL', 'MIA', 'ATL', 'WAS', 'ORL', 'CHA'] teams = ['HOU' ,'PHI', 'BOS', 'NYK', 'NJN', 'TOR', 'MEM', 'NOH', 'DAL', 'SAS', 'DEN', 'MIN', 'OKC', 'UTA', 'POR', 'MIL', 'CLE', 'CHI', 'IND', 'DET', 'SAC', 'PHO', 'GSW', 'LAC', 'LAL', 'MIA', 'ATL', 'WAS', 'ORL', 'CHA']
team_abbreviations = ['ATL', 'BOS', 'BRK', 'CHI', 'CHO', 'CLE', 'DAL', 'DEN', 'DET', 'GSW', 'HOU', 'IND', 'LAC', 'LAL', 'MEM', 'MIA', 'MIL', 'MIN', 'NOP', 'NYK', 'OKC', 'ORL', 'PHI', 'PHO', 'POR', 'SAC', 'SAS', 'TOR', 'UTA', 'WAS']
season = input('What season? ') season = input('What season? ')
for team in teams_data: for team in teams:
url_make = 'https://www.basketball-reference.com/teams/' + team + '/' + season + '.html' url_make = 'https://www.basketball-reference.com/teams/' + team + '/' + season + '.html'
response = requests.get(url_make) response = requests.get(url_make)
+4 -5
View File
@@ -12,11 +12,10 @@ django.setup()
from nba_data.models import PlayerShotChartData from nba_data.models import PlayerShotChartData
player_name = 'Damian Lillard' player_name = 'James Harden'
season = 2013 season = 2010
# team = 'LAL' # You might want to find a way to get this from the webpage
# Player name and season will be inserted into DB. Modify before running script. url = 'https://www.basketball-reference.com/players/h/hardeja01/shooting/' + \
url = 'https://www.basketball-reference.com/players/l/lillada01/shooting/' + \
str(season) str(season)
response = requests.get(url) response = requests.get(url)
+2 -3
View File
@@ -6,7 +6,6 @@ from bs4 import BeautifulSoup
import csv import csv
import json import json
import time import time
from data import teams_data
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
@@ -27,14 +26,14 @@ from nba_data.models import PlayerTotalsData
# Change MEM to VAN for 2001 and prior. # Change MEM to VAN for 2001 and prior.
# Change LAC to SDC for 1984 and prior. # Change LAC to SDC for 1984 and prior.
teams = ['HOU' ,'PHI', 'BOS', 'NYK', 'NJN', 'TOR', 'MEM', 'NOH', 'DAL', 'SAS', 'DEN', 'MIN', 'SEA', 'UTA', 'POR', 'MIL', 'CLE', 'CHI', 'IND', 'DET', 'SAC', 'PHO', 'GSW', 'LAC', 'LAL', 'MIA', 'ATL', 'WAS', 'ORL', 'CHA'] teams = ['HOU' ,'PHI', 'BOS', 'NYK', 'NJN', 'TOR', 'MEM', 'NOH', 'DAL', 'SAS', 'DEN', 'MIN', 'OKC', 'UTA', 'POR', 'MIL', 'CLE', 'CHI', 'IND', 'DET', 'SAC', 'PHO', 'GSW', 'LAC', 'LAL', 'MIA', 'ATL', 'WAS', 'ORL', 'CHA']
# team = input('What team? ') # team = input('What team? ')
# OMIT above. Will now only ask for season and iterate thru teams list. # OMIT above. Will now only ask for season and iterate thru teams list.
season = input('What season? ') season = input('What season? ')
for team in teams_data: for team in teams:
url_make = 'https://www.basketball-reference.com/teams/' + team + '/' + season + '.html' url_make = 'https://www.basketball-reference.com/teams/' + team + '/' + season + '.html'
response = requests.get(url_make) response = requests.get(url_make)