freeCodeCamp / league-for-good

An open source sports league management tool
BSD 3-Clause "New" or "Revised" License
162 stars 106 forks source link

JSON Schema for game stats #50

Open ahstein3521 opened 6 years ago

ahstein3521 commented 6 years ago

We're going to introduce stat tracking on a sport-by-sport basis. We'll need a JSON schema for each sport. Please leave a comment with a proposed schema including any attributes you think we'd need to store that are important to stat-keeping for that sport.

The sports we're currently offering are:

I'd be happy to answer any questions. Thanks in advance.

ajGingrich commented 6 years ago

This is my first time contributing and I would like to work on this. I will shortly post a proposed schema once I get the project working on my local machine to understand if this is team oriented or individual stats.

ahstein3521 commented 6 years ago

Thanks for taking an interest! I think the plan is to store team stats for each game and then generate individual player stats from that.

On Wed, Aug 9, 2017 at 4:39 PM, Andrew Gingrich notifications@github.com wrote:

This is my first time contributing and I would like to work on this. I will shortly post a proposed schema once I get the project working on my local machine to understand if this is team oriented or individual stats.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/freeCodeCamp/league-for-good/issues/50#issuecomment-321374892, or mute the thread https://github.com/notifications/unsubscribe-auth/AO6vXWQbCHOho_FJl-7gxBZEU8U1Au5Wks5sWhkHgaJpZM4OtG7d .

ahstein3521 commented 6 years ago

If you run into any issues getting the program to start, let me know.

On Wed, Aug 9, 2017 at 4:54 PM, Adam Stein adamhs3521@gmail.com wrote:

Thanks for taking an interest! I think the plan is to store team stats for each game and then generate individual player stats from that.

On Wed, Aug 9, 2017 at 4:39 PM, Andrew Gingrich notifications@github.com wrote:

This is my first time contributing and I would like to work on this. I will shortly post a proposed schema once I get the project working on my local machine to understand if this is team oriented or individual stats.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/freeCodeCamp/league-for-good/issues/50#issuecomment-321374892, or mute the thread https://github.com/notifications/unsubscribe-auth/AO6vXWQbCHOho_FJl-7gxBZEU8U1Au5Wks5sWhkHgaJpZM4OtG7d .

ajGingrich commented 6 years ago

I was able to run the developement originally but and I tried to log-in with Google but had an error from my app consol.e. I fixed the error and now I have an error connected to mongoDB. The app will start after npm run dev but I hangs on the login.

Error connecting to MongoDB: { MongoError: connection 0 to ds031617.mlab.com:31617 timed out

I also am getting a large amount of webpack compilation errors such as these: error Casing of react does not match the underlying filesystem import/no-unresolved But I don't think they are crucial.

ajGingrich commented 6 years ago

I wrote a basic schema for the sports. Obviously there are alot of stats for each sports so I didn't include everything. Let me know what you think.

{
"soccer": {
    "gameResult": "string",
    "offensive": {
        "goals": "integer",
        "assists": "integer",
        "shots": "integer",
        "shotsOnTarget": "integer",
    }
    "defensive": {
        "goalsAgainst": "integer",
        "shotsAllowed": "integer",
        "shotsOnTargetAllowed": "integer"
    }
    "goalkeeping": {
        "saves" "integer",
        "cleanSheet": "boolean"
    },
    "possesion": "integer",
    "yellowCards": "integer",
    "redCards": "integer"

},
"football": {
    "gameResult": "string",
    "offensive": {
        "points": "integer",
        "yardsPerGame": "integer",
        "rushingTouchdowns": "integer",
        "passingTouchdowns": "integer"
    },
    "defensive": {
        "pointsAgainst": "integer",
        "yardsPerGameAllowed": "integer",
        "rushingTouchdowonsAgainst" "integer",
        "passingTouchdowonsAgainst" "integer",
        "sacks": integer
    },
    "specialTeams": {
        "fieldGoalsAttempted": "integer",
        "fieldGoalsMade": "integer",
        "puntReturnsForTouchdown"
    }
},
"basketball": {
    "gameResult": "string",
    "offensive": {
        "points": "integer",
        "assists": "integer",
        "turnovers": "integer",
        "rebounds": "integer",
        "fieldGoalPercentage": {
            overall: "integer"
            freeThrow: "integer",
            twoPoint: "integer",
            threePoint: "integer"
        },
    },
    "defensive": {
        "pointsAgainst": "integer",
        "steals": "integer",
        "bloacks": "integer",
        "rebounds": "integer",
        "fieldGoalPercentage": {
            overall: "integer"
            freeThrow: "integer",
            twoPoint: "integer",
            threePoint: "integer"
        }
    },
    "personalFouls": "integer"
},
"baseball": {
    "gameResult": "string", 
    "batting": {
        "runsScored": "integer",
        "battingAverage": "integer",
        "homeruns": integer
    },
    "pitching": {
        "earnedRunsAgainst": "integer",
        "battingAverageAgainst": "integer",
        "homerunsAgainst": "integer",
    },
    "steals": "integer",
    "errors": "integer"
},
"hockey": {
    "gameResult": "string",
    "overtime": "boolean",
         "penaltyTime: "integer",
    "offensive": {
        "goals": 'integer,
        "assists": integer,
        "powerPlayPecentage": "integer"
        "shots": "integer",
        "shotsOnTarget": "integer"
    },
    "defensive": {
        "goalsAllowed": "integer",
        "assistsAllowed": integer,
        "powerPlayPecentageAllowed": "integer"
        "shotsAllowed": "integer",
        "shotsOnTargetAllowed": "integer"
    }
  }
}
paulywill commented 6 years ago

For hockey there should be a stat on "Penalty Time" as well.

ajGingrich commented 6 years ago

For hockey there should be a stat on "Penalty Time" as well.

thanks for suggestion. I updated the hockey schema to include Penalty Time

Knochenmark commented 6 years ago

You might want to split up the stats into general game stats, stats for home and guest team. Otherwise I dont understand how you would use the "possesion" stat from soccer for example. Which would then be always 100%? Splitting the stats up would also allow for a "goal" property on each team object from which you can construct the end result instead of storing it as a string.

ajGingrich commented 6 years ago

I believe each team would have JSON data for each game so it would already be split up.

Knochenmark commented 6 years ago

Just did some digging and the first API i found also splits the home/away team. My main point stands, that saving the result as a string is a bad idea. It is way easier to construct the result from 2 properties and this allows for easier filtering of the match objects. https://docs.crowdscores.com/#page:matches,header:matches-match-details

I've also seen they have further information like if a game went into extra time, if there was a penalty shot out etc.

thejayhaykid commented 6 years ago

I'm focusing on football specifically cause I really want to make a football stats app cause I haven't found one. I looked at the team stats from maxpreps.com and looking at box scores from ESPN. This would be duplicated for home and away teams.

"football": {
    "gameResult": "string",
    "offensive": {
        "points": "integer",
        "passingYards": "integer",
                "rushingYards": "integer",
                "totalYards": "integer",
                "passingPlays": "integer",
                "rushingPlays": "integer",
                "totalPlays": "integer",
                "yardsPerPlay": "float",
                "fumbles": "integer",
                "interceptions": "integer",
                "turnovers": "integer",
        "rushingTouchdowns": "integer",
        "passingTouchdowns": "integer",
                "redZoneAttempts": "integer",
                "redZoneScores": "integer",
                "penalties": "integer",
                "penaltyYards": "integer",
                "timeOfPossession": "integer"
    },
    "defensive": {
        "pointsAgainst": "integer",
        "rushingYards": "integer",
                "passingYards": "integer",
                "tackles": "integer",
                "tacklesForLoss": "integer",
                "sacks": "integer",
                "forcedFumbles": "integer",
                "recoveredFumbles": "integer",
                "passesDefended": "integer",
                "interceptions": "integer",
                "safeties": "integer",
        "rushingTouchdownsAgainst": "integer",
        "passingTouchdownsAgainst": "integer",
                "rushingPlays": "integer",
                "passingPlays": "integer",
                "totalPlays": "integer"
    },
    "specialTeams": {
        "fieldGoalsAttempted": "integer",
        "fieldGoalsMade": "integer",
                "punts": "integer",
                "puntBlocks": "integer",
        "puntReturnsForTouchdown": "integer",
                "kickReturnsForTouchdowns": "integer",
                "puntReturnYards": "integer",
                "kickReturnYards": "integer"
    }
}
jstephenperry commented 6 years ago

What is the status on implementing this feature? I'd like to help implement a detailed soccer JSON structure as a current competitive soccer referee.

makkoli commented 6 years ago

@jstephenperry I don't think anyone is currently actively working on this. This isn't high priority, but does need to be done.