https://github.com/robson16/goldmedal
This project is a Spring Data JPA for an Olympic metrics reporting web application called Gold Medal Metrics.
https://github.com/robson16/goldmedal
codeacademy crud-api java rest-api spring-boot
Last synced: 26 days ago
JSON representation
This project is a Spring Data JPA for an Olympic metrics reporting web application called Gold Medal Metrics.
- Host: GitHub
- URL: https://github.com/robson16/goldmedal
- Owner: Robson16
- License: mit
- Created: 2025-02-22T23:07:40.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-02-24T15:56:27.000Z (over 1 year ago)
- Last Synced: 2025-03-03T15:15:59.494Z (about 1 year ago)
- Topics: codeacademy, crud-api, java, rest-api, spring-boot
- Language: JavaScript
- Homepage:
- Size: 875 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Gold Medal Metrics Challenge Project
## Overview
Gold Medal Metrics is an Olympics analytics web application built with **Spring Boot** and **Spring Data JPA**. This project is part of the [Create REST APIs with Spring and Java](https://www.codecademy.com/) course by Codecademy.
The application allows users to:
- View a list of countries along with their population, GDP, and number of Olympic gold medals.
- Sort the list by different attributes, including country name, population, GDP, and medal count.
- View detailed Olympic statistics for a selected country.
- Retrieve a list of Olympic gold medal wins for a country, including details like the year, season, athlete name, city, and event.
- Sort the list of Olympic wins by various attributes.
## Tech Stack
- **Java 11**
- **Spring Boot 2.5.2**
- **Spring Data JPA**
- **H2 Database** (for development and testing)
- **Apache Commons Text** (utility functions)
## Prerequisites
Ensure you have the following installed:
- Java 11 or higher
- Maven
## Installation & Setup
1. Clone the repository:
```sh
git clone https://github.com/Robson16/goldmedal.git
cd goldmedal
```
2. Build the project with Maven:
```sh
mvn clean install
```
3. Run the application:
```sh
mvn spring-boot:run
```
4. The API will be available at:
```sh
http://localhost:3001
```
## API Usage
### Get all countries sorted by name (ascending order)
```sh
curl --request GET "http://localhost:3001/countries?sort_by=name&ascending=y"
```
**Response:**
```json
{
"countries": [
{"name":"Afghanistan","code":"AFG","gdp":594.32,"population":32526562,"medals":0},
...
]
}
```
### Get details for a specific country (e.g., United States)
```sh
curl --request GET "http://localhost:3001/countries/united%20states"
```
**Response:**
```json
{
"name":"United States",
"gdp":56115.72,
"population":321418820,
"numberMedals":2477,
"numberSummerWins":2302,
"percentageTotalSummerWins":21.957,
"yearFirstSummerWin":1896,
"numberWinterWins":175,
"percentageTotalWinterWins":9.109,
"yearFirstWinterWin":1924,
"numberEventsWonByFemaleAthletes":747,
"numberEventsWonByMaleAthletes":1730
}
```
### Get list of Olympic gold medal winners for a country (sorted by athlete's name descending)
```sh
curl --request GET "http://localhost:3001/countries/united%20states/medals?sort_by=name&ascending=n"
```
**Response:**
```json
{
"medals": [
{
"year":1968,
"city":"Mexico",
"season":"Summer",
"name":"ZORN, Zachary",
"country":"United States",
"gender":"Men",
"sport":"Aquatics",
"discipline":"Swimming",
"event":"4X100M Freestyle Relay"
},
...
]
}
```
## Dependencies
The project uses the following dependencies, as defined in `pom.xml`:
```xml
org.springframework.boot
spring-boot-starter-data-jpa
org.springframework.boot
spring-boot-starter-web
com.h2database
h2
runtime
org.apache.commons
commons-text
1.8
org.springframework.boot
spring-boot-starter-test
test
```
## Future Enhancements
- Add support for retrieving Olympic statistics by athlete.
- Implement authentication and authorization for API access.
- Migrate to a production-ready database like PostgreSQL or MySQL.
---
This project was developed as part of the **Create REST APIs with Spring and Java** course by Codecademy.
**Happy Coding!** 🚀