Giter Club home page Giter Club logo

travelsystem's Introduction

Travel System

Assumptions

  • This Travel System is designed with flexibility for future development and maintenance.
  • A Trip is uniquely identified by the combination of company id and bus id and a pair of Touch On and Touch Off.
  • A Touch Off event is identified by the combination of company id and bus id, occurring after the timestamp of the corresponding Touch On event.
  • Touch Off events are not associated with any Touch On events then it's invalid data
  • A Trip will be flagged as unprocessable if there is a mismatch in Primary Account Numbers (PAN) between the Touch On and Touch Off events.

How to Run

  • Requirements: Apache Maven 3.6.3, Java version 17
  • Run the application using Maven:
  mvn spring-boot:run

How to Test

  • An example input file, touchData.csv, is provided at src/main/resources/datafiles/input/touchData.csv. Modify this file to test additional cases if needed.

    touchData.csv

    image

  • Output files will be generated in src/main/resources/datafiles/out/.

    trips.csv

    image

    tripSummary.csv

    image

    unprocessableTouchData.csv

    image

  • Follow these steps:

  1. Modify the input file: src/main/resources/datafiles/input/touchData.csv.
  2. Run the application:
    mvn spring-boot:run
    
  3. Verify the output files: src/main/resources/datafiles/out/.

Note: Input and output file paths can be configured in src/main/resources/application.yml.

Solution Overview

The solution preprocesses each input data field for modeling and persists it into an in-memory database (H2 DB). This approach replaces storing data in Java variables or objects, providing efficient storage and retrieval capabilities. By leveraging HQL (Hibernate Query Language), the application can easily access and collect data as required. The architecture emphasizes decoupling the logic into multiple service classes, facilitating ease of change, development, and replacement when needed. Additionally, comprehensive unit tests have been provided for major functions.

image

Technologies Used

  1. Spring Boot 3.x: Compatible with Java 17, offering streamlined development and configuration.
  2. Project Lombok: Automates repetitive Java boilerplate tasks, improving code readability and conciseness.
  3. Spring Data: Simplifies access to various persistence stores, including relational databases.
  4. Liquibase: Manages database schema changes, providing version control and seamless migration.
  5. H2 Database: H2 is an open-source lightweight Java database. It can be embedded in Java applications or run in the client-server mode. Mainly, the H2 database can be configured to run as an in-memory database, which means that data will not persist on the disk
  6. Mockito: Mocking framework for unit testing in Java, facilitating the creation of test doubles and verifying interactions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.