Comments (4)
Hey @F4nt, I'm trying to get a sense of what the different things in the DB schema are supposed to be.
Why would different models FK to GamePlayer instead of separately to Game and Player?
My gut says you'll most often want to query against one or the other, and not as often for the game-instance of a player (with the biggest reason I see for that being to fetch the statline for a player in a game). Neither access pattern is impossible either way, but it seems like it'll be cleaner to do Game and Player.
from mls-api.
Hey @dget,
The main thing that ended up driving that is that players often play out of position and I wanted to capture that. For instance, Logan Pause is a central midfielder but played at RB for the Fire last week against Montreal. It wouldn't make sense to change his position on the Player object, because that should be (mostly) constant.
I wanted the flexibility to be able to filter down and see games where Pause played RB, and be able to see what affect that may or may not have had on outcomes. Having Player and GamePlayer lets us use Player as a constant of sorts, perhaps for displaying rosters, while GamePlayer can be used for game day stats line as you mentioned.
from mls-api.
That seems fair. For something like substitution, do you think it should have an FK to both Game and GamePlayer, or just GamePlayer? I'm thinking just GamePlayer, but noticed Goal has both, and want to make sure whatever I end up adding is consistent.
from mls-api.
Good question. The reason Goal has both is to simplify the query to get the totals for displaying the score. Admittedly, that isn't really necessary, and I could aggregate the totals through the GamePlayer model, but it felt cumbersome and messy. Thus the FKs to Game and GamePlayer. I could really go either way on it though, as it does border on extraneous.
I'd think with Subs we could just FK to GamePlayer. I can't think of any great benefit to FK to Game as well, and it sounds like your thoughts on similar there. That said, if you can think of a benefit of FK to Game, I'm open to it.
By the way, if it's easier, feel free to email me anytime at: f4nt AT f4ntasmic DOT com.
from mls-api.
Related Issues (10)
- Add season flag to scraper HOT 1
- Add option for parser to parse all games in a season
- Scraper needs to more intelligently display errors HOT 1
- Put an API in front of all this data
- Deploy the site somewhere HOT 1
- MultipleObjectsReturned when retrieving players in 2012 scrape HOT 2
- The scraper is single threaded right now, this is lame HOT 4
- Grab formation information HOT 1
- Urls that fail to parse
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mls-api.