/challenge-airport-travellers-insights-service

Sample Spring Boot/Java service that gives insights on airport travellers

Primary LanguageJavaMIT LicenseMIT

Airport travellers insights service

Sample Spring Boot/Java service that gives insights on airport travellers.

Airport travellers insights service is a REST service that gives insights on flights and airports.

In this code challenge, we want to implement a feature that gives insights on the purpose of trips travellers do. We can take advantage of Amadeus APIs and use Trip Purpose Prediction to predict if the purpose of a round trip travel is for leisure or for business with a certain probability. With such information the service has to provide an operation that, given an airport and a date, returns the number of passengers that are travelling for leisure and for business in that date.

Service capabilities

The service has to provide the following operations.

Register a trip

Register a round trip travel from an origin airport to a destination airport with the departure and return dates of the flights.

Cancel a trip

Cancel a registered trip.

Get airport insights

Given an airport and a date, return the number of traveller that transit through the airport in that date, the number of travellers that are travelling for leisure and for business and the probabilities that the estimations are correct.

As an example, let assume that we have registered two trips:

  1. Passenger 1, travelling for leisure, from LIN to AMS with departure date 2022-07-14 and return date 2022-07-18, and
  2. Passenger 2, travelling for business, from BRU to LIN with departure date 2022-07-12 and return date 2022-07-14.

Requesting the insights of Linate (LIN) airport on 2022-07-14 must return that there are 2 passengers in the airport: one is travelling for leisure and one is travelling for business.

Get airport travellers

Given an airport and a range of dates, return the number of travellers that transit through the airport, the number of travellers that are travelling for leisure and for business and their trends with reference to the previous day for each day within the specified range.

As an example, if the requester asks for the travellers in Linate (LIN) airport between 2022-07-10 and 2022-07-14 the response might contain the following data.

Date Travellers Trend Business trav. Business trav. trend Leisure trav. Leisure trav. trend
2022-07-10 200 0 100 0 100 0
2022-07-11 230 +30 98 -2 132 +32
2022-07-12 220 -10 95 -3 125 -7
2022-07-13 170 -50 100 +5 70 -55
2022-07-14 200 +30 120 +20 80 +10

This operation can be used for statistical analysis of traveller flow in airports.

Assignment

The following activities must be accomplished in the code challenge to fully implement the feature described above. You can clone this repository and start working from the sources provided by this project. You can change any file of this project: the existing code consists of a service scaffold with the purpose of simplifying the development of the service.

  • If something can be enhanced, any valuable improvement will be appreciated.
  • If something has to be changed because it is wrong and/or it does not fit the solution you are implementing, then change it and document your modifications if you think the change is not clear to understand.

The activities to be accomplished are listed herein.

  • Complete the documentation of the API updating the OpenAPI we provide by designing the missing parts.
  • Implement the service operations as described in section Service capabilities.
  • Implement tests to verify that correctness of the service functionalities and prevent regressions on further changes.
  • Add instructions to build a Docker container image containing the service and explain how to launch it. Document it in section Run with Docker in this page.
  • Fill the ✏️ TODOs in this README file.
  • Upload the code to a public repository or a private one after granting the access to gilberto@faire.ai (Head of Technology @ faireai); we may request to grant access to other colleagues that will review the code.

What we evaluate

During the review of your implementation we pay attention to the following points.

  • Correctness of the business logic.
  • Quality of the code with a focus on its readability.
  • Architecture of the service.
  • Proper tests code coverage and use of tests.

Build

The project uses Gradle as build tool. It makes easy to build the service and launch it.

To compile and verify the project run:

% ./gradlew clean check

Configuration

✏️ TODO Document how to configure the service.

Run the service

The service can be launched running the following command:

% ./gradlew bootRun

Run with Docker

✏️ TODO Document how to run the service using Docker.

Usage

✏️ TODO Explain how to use the service and provide examples.

The service exposes the endpoint /api-docs to get the OpenAPI documentation of the service API. On localhost, you can get it with curl with the following command.

% curl localhost:8080/api-docs

Notes

  • If you are using GitHub you can take advantage of GitHub Actions. The project contains configured workflows in .github directory.