US ACCIDENTS API

Requirements

  • Java 11
  • Docker

Description

The US Accidents API is a Spring Boot based application which is aimed to inform the car accidents that occurred in the United States.

To store the accidents, the application uses Mongo DB.

The API provides the following functionalities:

  • Get a paginated list of accidents that took place within a given polygon shape, providing the points that form the polygon.
  • Get a paginated list of accidents that took place within a given circle shape, providing a point and radius.
  • Get an accident by its identifier.
  • Get a paginated list of all the accidents.
  • Get the list of the most common conditions of the accidents (temperature, humidity, weather conditions)

Run the application locally

  1. Download the JSON file (zip) containing the dataset from here.
  2. Unzip the file and store it within the /mongo folder, by the name us_accidents.json
  3. On the root of the project, execute the command docker-compose up. This command will set up the Mongo database, executing the script /mongo/import.sh which will import the dataset to the database.
  4. Within the /accidents folder, start the Java application.
  5. Once the application is up and running, access the following link to see the API specification. You can test the endpoints developed through the Swagger UI, or using the Postman collection provided in the /accidents/docs/BD2.postman_collection.json file, which gathers some sample requests to send to each endpoint.

Useful Links

Ownership

  • Onofri, Melisa 15293/9
  • Repetto, Lorenzo 15143/5

2022