Skip to content

Repository files navigation

College Football Scores

A Java-based system for managing college football data with a REST API and PostgreSQL database.

Project Structure

college-scores/
├── rest-api/ # REST API server
│ ├── src/
│ │ ├── main/
│ │ │ ├── java/com/example/
│ │ │ │ ├── RestApiApplication.java # Dropwizard app
│ │ │ │ ├── RestApiConfiguration.java # App config
│ │ │ │ └── ConferenceResource.java # REST endpoints
│ │ │ └── resources/
│ │ │ ├── migrations.xml # Database migrations
│ │ │ └── conferences.csv # Initial data
│ │ └── test/
│ │ ├── java/com/example/
│ │ │ └── ConferenceResourceTest.java # Integration tests
│ │ └── resources/
│ │ ├── test-config.yml # Test config
│ │ └── migrations-test.xml # Test migrations
│ ├── config.yml # Production config
│ └── pom.xml # REST API Maven config
│
├── rest-client/ # REST client module (new)
│ └── pom.xml # REST client Maven config
│
├── pom.xml # Parent POM with dependency management
└── server.sh # Server startup script

Technologies

  • Java 21
  • Maven for build management
  • Dropwizard 4.0.1 web framework
  • PostgreSQL database
  • JDBI 3.43.0 for database access
  • Liquibase for database migrations
  • JUnit 5 for testing
  • H2 for test database
  • Jackson for JSON processing

Features

  • REST API for college football data
  • Database migrations
  • Integration testing
  • Dependency analysis
  • UTF-8 encoding enforcement

Building

# Build all modules
mvn clean install
# Run dependency analysis
mvn dependency:analyze
# Run tests
mvn test

Running

# Start the server (includes database initialization)
./server.sh

The REST API will be available at:

Configuration

Database

Configure PostgreSQL connection in rest-api/config.yml:

database:
driverClass: org.postgresql.Driverurl: jdbc:postgresql://college-scores-db:5432/user: postgrespassword: postgres

Testing

Test configuration uses H2 in-memory database:

database:
driverClass: org.h2.Driverurl: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;MODE=PostgreSQLuser: sapassword: sa

Development

Adding New Endpoints

  1. Create model class
  2. Add database migration
  3. Create resource class
  4. Add integration tests

Database Migrations

# Check status
java -jar rest-api/target/rest-api-1.0-SNAPSHOT.jar db status rest-api/config.yml
# Apply migrations
java -jar rest-api/target/rest-api-1.0-SNAPSHOT.jar db migrate rest-api/config.yml

Testing

Integration tests use:

  • H2 in-memory database
  • Separate migrations file
  • DropwizardAppExtension
  • JUnit 5

Tasks

Fix the build

Running mvn clean install currently has issues that need to be fixed in order to build the project.

Fix the build and run ./server.sh and demonstrate being able to access one of the current REST endpoints (http://localhost:9090/api/conferences)

Fix tests

There is ConferenceResourceTest.java within the rest-api module. It is currently disabled because there is an issue with the test. Enable the tests and fix the issue.

Add new REST endpoint

Data is already loaded into a test database. Add an endpoint at /api/teams that allows users to get all teams and another endpoint to query a team by name. If no teams are found, a 404 error message should be returned.

Configure code coverage reporting

Report and aggregate code coverage in maven for the entire project.

Modify Liquibase migrations

Add a new de-normalized table to Postgres called games. It should have the following columns:

  • id (integer)
  • season (integer year value)
  • week (integer)
  • start_date (timestamp)
  • venue_name (string)
  • home_school_name (string)
  • home_points (integer)
  • away_school_name (string)
  • away_points (integer)

Process data/games_week_1.csv

Create a task that will load data from data/games_week_1.csv. This should do lookups in the database for venue and school names and populate the data accordingly

Download data for year=2025 and week=2

Obtain a free API key from https://collegefootballdata.com/. Use the documentation from https://apinext.collegefootballdata.com/ to download all games data for year=2025 and week=2 and store in data/games_week_2.csv. This should have the same format as the previous CSV file and should be used to load week 2 data using the same task created above.

Note that the API gives a lot more information than what's being asked to store.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages