This project is to showcase a simple platform that can be used to query big data.
The platform is built using the following technologies:
- Java 21
- Spring Boot 3.3
- Maven
- Docker
- Spark
- Enable Docker on your machine
- Run the following command to build the project:
./bin/setup
- Run the following command to start the project:
Default port is 8080 if not provided
./bin/run $port
Dataset is obtained from taxi trips in Chicago for the year 2020. It's in parquet format. To setup data please set the path in the properties, eg
dataset:
file:
path: src/main/resources/chicago_taxi_trips_2020.parquet- Get Total Trips
curl -X GET "http://localhost:8080/api/v1/data/total-trips?start={start_date}&end={end_date}" - Get Average Fare Heatmap
curl -X GET "http://localhost:8080/api/v1/data/average-fare-heatmap?data={date}" - Get Average Speed in 24 Hours
curl -X GET "http://localhost:8080/api/v1/data/average-speed-24hrs?date={date}"
This project is built based on common/standard Spring Boot architecture, where it's divided into 3 layers:
- Controller layer where the API is defined. Controller layer here is using Spring Webflux.
- Service layer where the business logic is defined. It's just a standard Java codes.
- Repository layer where the data access is defined. Repository layer here is using Spark to access the parquet data.
sequenceDiagram
participant user as user
participant api as controller
participant svc as service
participant repo as repository
participant db as spark
autonumber
user ->>+ api: make request
api ->>+ svc: forawrd request
svc ->>+ repo: fetch data
repo ->>+ db: query data
db ->>- repo: return data
repo->>-svc:
svc->>svc: do additional processing
svc->>-api: return processed data
api->>-user: return requested data
- Swagger UI: http://localhost:8080/swagger-ui.html
© 2024 Andreas Arifin