Skip to content

This system manages baseball leagues, teams, player profiles, game logs, and stats.

License

Notifications You must be signed in to change notification settings

michaelhyi/baseball-league-management-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Baseball League and Stats Management System


About

This app manages baseball leagues, teams, player profiles, game logs, and stats. It provides insights into player performance, league standings, and match results, making it suitable for both league management and statistical analysis.

Tech Stack

  • Python/Django
  • Go
  • C#/.NET
  • gRPC
  • SQL
  • MySQL

This project follows a microservices-based architecture.

Development

Requirements

API Gateway (Go/gRPC)
Players (Python/Django)
Endpoints
Create Player
curl -i -X POST http://localhost:8080/v1/players \
    -H 'Content-Type: application/json' \
    -d '{
        "name": "Michael Yi",
        "jerseyNumber": "14",
        "dob": "2004-12-14",
        "height": "5\u0027 10\"",
        "weight": 140,
        "position": "Shortstop",
        "teamId": 1
}'
Get Player
curl -i http://localhost:8080/v1/players/<id>
Update Player
curl -i -X PATCH http://localhost:8080/v1/players/<id> \
    -H 'Content-Type: application/json' \
    -d '{
        "name": "Michael Yi",
        "jerseyNumber": "14",
        "dob": "2004-12-14",
        "height": "5\u0027 10\"",
        "weight": 140,
        "position": "Shortstop",
        "teamId": 1
}'
Delete Player
curl -i -X DELETE http://localhost:8080/v1/players/<id>

Teams (C#/.NET)
Endpoints
Create Team
curl -i -X POST http://localhost:8080/v1/teams \
    -H 'Content-Type: application/json' \
    -d '{
        "name": "Los Angeles Dodgers",
        "leagueId": 1
    }'
Get Team
curl -i http://localhost:8080/v1/teams/<id>
Get Team With Roster
curl -i http://localhost:8080/v1/teams/with-roster/<id>
Update Team
curl -i -X PATCH http://localhost:8080/v1/teams/<id> \
    -H 'Content-Type: application/json' \
    -d '{
        "name": "New York Yankees",
        "leagueId": 2
    }'
Delete Team
curl -i -X DELETE http://localhost:8080/v1/teams/<id>
Games (Go/gRPC)
Endpoints
Create Game
curl -i -X POST http://localhost:8080/v1/games \
    -H 'Content-Type: application/json' \
    -d '{
        "homeTeamId": 1,
        "awayTeamId": 2,
        "homeTeamScore": 5,
        "awayTeamScore": 0,
        "date": "2004-12-14 12:00:00",
        "location": "Irvine, CA"
}'
Get Game
curl -i http://localhost:8080/v1/games/<id>
Update Game
curl -i -X PATCH http://localhost:8080/v1/games/<id> \
    -H 'Content-Type: application/json' \
    -d '{
        "homeTeamId": 1,
        "awayTeamId": 2,
        "homeTeamScore": 5,
        "awayTeamScore": 0,
        "date": "2004-12-14 12:00:00",
        "location": "Irvine, CA"
}'
Delete Game
curl -i -X DELETE http://localhost:8080/v1/games/<id>
Leagues (C#/.NET/gRPC)
Endpoints
Create League
curl -i -X POST http://localhost:8080/v1/leagues \
    -H 'Content-Type: application/json' \
    -d '{
        "name": "Athletic Coast Conference"
}'
Get League
curl -i http://localhost:8080/v1/leagues/<id>
Update League
curl -i -X PATCH http://localhost:8080/v1/leagues/<id> \
    -H 'Content-Type: application/json' \
    -d '{
        "name": "Athletic Coast Conference"
}'
Delete League
curl -i -X DELETE http://localhost:8080/v1/leagues/<id>
Stats (Python/Django)
Endpoints
Create Batting Stats
curl -i -X POST http://localhost:8080/v1/stats/batting \
    -H 'Content-Type: application/json' \
    -d '{
        "playerId": 1,
        "atBats": 3119,
        "runs": 562,
        "hits": 878,
        "totalBases": 1792,
        "doubles": 167,
        "triples": 36,
        "homeRuns": 225,
        "rbi": 567,
        "walks": 432,
        "strikeouts": 917,
        "stolenBases": 145,
        "hitByPitches": 22,
        "sacFlies": 18 
    }'
Create Pitching Stats
curl -i -X POST http://localhost:8080/v1/stats/pitching \
    -H 'Content-Type: application/json' \
    -d '{
        "playerId": 1,
        "wins": 38,
        "losses": 19,
        "earnedRuns": 161,
        "games": 86,
        "gamesStarted": 86,
        "saves": 0,
        "inningsPitched": 481.2,
        "strikeouts": 608,
        "walks": 173,
        "hits": 348 
    }'
Get Batting Stats
curl -i http://localhost:8080/v1/stats/batting/<player-id>
Get Pitching Stats
curl -i http://localhost:8080/v1/stats/pitching/<player-id>
Update Batting Stats
curl -i -X PATCH http://localhost:8080/v1/stats/batting/<player-id> \
    -H 'Content-Type: application/json' \
    -d '{
        "playerId": 1,
        "atBats": 3119,
        "runs": 562,
        "hits": 878,
        "totalBases": 1792,
        "doubles": 167,
        "triples": 36,
        "homeRuns": 225,
        "rbi": 567,
        "walks": 432,
        "strikeouts": 917,
        "stolenBases": 145,
        "hitByPitches": 22,
        "sacFlies": 18 
    }'
Update Pitching Stats
curl -i -X PATCH http://localhost:8080/v1/stats/pitching/<player-id> \
    -H 'Content-Type: application/json' \
    -d '{
        "playerId": 1,
        "wins": 38,
        "losses": 19,
        "earnedRuns": 161,
        "games": 86,
        "gamesStarted": 86,
        "saves": 0,
        "inningsPitched": 481.2,
        "strikeouts": 608,
        "walks": 173,
        "hits": 348 
    }'
Delete Batting Stats
curl -i -X DELETE http://localhost:8080/v1/stats/batting/<player-id>
Delete Pitching Stats
curl -i -X DELETE http://localhost:8080/v1/stats/pitching/<player-id>

Backlog

  • API Gateway
    • gRPC Error Handling
    • Rate Limiting, Logging, Monitoring, Data Validation, Pagination
    • Interservice Comms
    • Unit Tests
  • Players Service
    • Resolve TODO's
  • Teams Service
    • Unit Tests
  • Games Service
    • Unit Tests
  • Leagues Service
    • Unit Tests
  • Stats Service
    • Unit Tests
  • Setup Complex Queries
    • Team Stats (Record, Batting, Pitching)
    • Team/League Leaders
  • Distributed MySQL Databases? Sharding / Replication
  • System Design

About

This system manages baseball leagues, teams, player profiles, game logs, and stats.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published