Skip to content
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

Los Angeles Chargers #237

Open
danielcroona opened this issue Apr 20, 2017 · 7 comments
Open

Los Angeles Chargers #237

danielcroona opened this issue Apr 20, 2017 · 7 comments

Comments

@danielcroona
Copy link

danielcroona commented Apr 20, 2017

What is the recommended way to change San Diego Chargers to Los Angeles Chargers in nfldb?

@gatortim
Copy link

gatortim commented Aug 4, 2017

Follow up: will teams maintain a constant team_id when teams move cities? It seems like the logical unique ID but I'm not sure of the mapping to the nfl api. If something else makes more sense as a unique ID for teams could you give a heads up?

@donlaur
Copy link

donlaur commented Aug 4, 2017 via email

@DaSkunk
Copy link

DaSkunk commented Aug 13, 2017

I'll preface this by saying that even though I've been using nfldb for over a year, I still consider myself a novice. But so many of these posts have helped me that if this response can help someone else I'd like to pay it forward. Last year I was able to pull together several pieces of info that enabled me to fix the problem with the Rams relocating to L.A. Thankfully I wrote down what I did because I literally just used the same process 30 minutes ago to fix the Chargers problem. I just did an nfldb-update to get the latest week 1 schedule & scores and it now correctly shows SEA playing LAC tonight. So I believe this worked

  1. Add the following
    ['LAC', 'Los Angeles', 'Chargers', 'Los Angeles Chargers', 'LAC'],
    to
    /usr/local/lib/python2.7/site-packages/nfldb/team.py
    and
    /usr/local/lib/python2.7/site-packages/nflgame/init.py

  2. log into psql command line with psql -U nfldb nfldb
    then type
    INSERT INTO team (team_id, city, name) VALUES ('LAC', 'Los Angeles', 'Chargers');

the command prompt should return with INSERT 0 1 which means it worked
Verify by trying
SELECT * FROM team

The LA Chargers should be a row in the table

To fix the preseason week 1 game table, you have to manually update the row from UNK to LAC

  1. Log into psql -U nfldb nfldb

  2. select * from game where (season_year='2017' and season_type='Preseason' and week='1' and away_team='SEA');

  3. Look at the gamekey value (e.g. 57180) and search for it in the /Python/Lib/site-packages/nflgame/schedule.json.
    Make sure there's only one entry and the date matches with the SQL table

  4. UPDATE game SET home_team='LAC' WHERE (gamekey='57180');

To verify you can run the query again

select * from game where (season_year='2017' and season_type='Preseason' and week='1' and away_team='SEA');

and you should see LAC in the home_team field.

I haven't been able to retrieve the games for the remainder of the 2017 preseason to see if the fix worked permanently for all weeks. If anyone has been able to get weeks 2 through 4 please post a comment. Thank you.

@bostasie
Copy link

bostasie commented Aug 14, 2017

Yeah I have the same issue where I need to have the full season schedule but only have games through Preseason week 1.

Edit: I've been able to instigate this by changing _CUR_SCHEDULE in live.py and iterating through all weeks, save and run update, save and run update...
_CUR_SCHEDULE = "http:https://www.nfl.com/ajax/scorestrip?season=2017&seasonType=PRE&week=4"
_CUR_SCHEDULE = "http:https://www.nfl.com/ajax/scorestrip?season=2017&seasonType=REG&week=17"

@DaSkunk
Copy link

DaSkunk commented Aug 15, 2017 via email

@ochawkeye
Copy link
Contributor

NFL...you guys are killing me here.

image

@abartley1
Copy link

abartley1 commented Sep 15, 2017

I've been struggling with this too. Here's a quick & dirty set of updates to run that have worked for me. I tried to write them in a way that it'll keep working if the NFL (or whoever) doesn't get around to fixing the SD/UNK issues. Hopefully this helps someone else too!

--- Update team in play_player table
UPDATE play_player pp
SET team = 'LAC'
WHERE team = 'UNK'
   AND gsis_id IN (
      SELECT gsis_id 
      FROM game 
      WHERE 
         season_year='2017' 
         AND (away_team='UNK' OR home_team='UNK')
   )
;

--- Update team in player table
UPDATE player 
SET team = 'LAC'
WHERE team = 'SD';

--- Update pos_team in drive table
UPDATE drive
SET pos_team = 'LAC'
WHERE pos_team = 'UNK'
   AND gsis_id IN (
      SELECT gsis_id 
      FROM game 
      WHERE 
         season_year='2017' 
         AND (away_team='UNK' OR home_team='UNK')
   )
;

--- Update home_team in game table
UPDATE game
SET home_team = 'LAC'
WHERE home_team = 'UNK'
   AND gsis_id IN (
      SELECT gsis_id 
      FROM game 
      WHERE 
         season_year='2017' 
         AND (away_team='UNK' OR home_team='UNK')
   )
;

--- Update away_team in game table
UPDATE game
SET away_team = 'LAC'
WHERE away_team = 'UNK'
   AND gsis_id IN (
      SELECT gsis_id 
      FROM game 
      WHERE 
         season_year='2017' 
         AND (away_team='UNK' OR home_team='UNK')
   )
;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants
@donlaur @ochawkeye @abartley1 @danielcroona @gatortim @bostasie @DaSkunk and others