Giter Club home page Giter Club logo

transactionanalyser's Introduction

TransactionAnalyser

To display statistic information about processed transactions

Requirement

The goal of the system is to display statistic information about processed transactions. A transaction record will contain the following fields: ID - A String representing the transaction id Date - The date and time when the transaction took place (format "DD/MM/YYYY hh:mm:ss") Amount - The value of the transaction (dollars and cents) Merchant - The name of the merchant this transaction belongs to Type - The type of the transaction, which could be either PAYMENT or REVERSAL Related Transaction - (Optional) - In the case a REVERSAL transaction, this field will contain the id of the transaction it is reversing.

The system will be initialized with an input file in CSV format containing a list of transaction records. ( org.deb.loader.CSVLoaderImpl )

Once initialized, the system should report the total number of transactions and the average transaction value for a specific merchant in a specific date range. Another requirement is that, if a transaction has a reversing transaction, then it should not be included in the computed statistics, even if the reversing transaction is outside of the requested date range. ( org.deb.analysis.Analysis )

Assumptions

For the sake of simplicity, you can assume that Transaction records are listed in correct time order. The input file is well formed and is not missing data.

How to build

mvn clean install 

How to run

mvn exec:java -Dexec.mainClass="org.deb.App"

or execute ./run.sh

Main Classes

  • org.deb.loader.impl.CSVLoaderImpl - loadTransactions method returns all PAYMENT transactions which are without any REVERSAL from csv file.

  • org.deb.analysis.Analysis - Analyze transactions.

Test Classes

  • org.deb.loader.CSVLoaderImplTest - to test CSV loading.
  • org.deb.analysis.TransactionAnalysisTest - to test Transaction analysis.

3rd party libraries

  • opencsv - to read CSV files.
  • org.openjdk.jmh - to do micro benchmark.

How to run benchmark

java -jar target/benchmarks.jar

transactionanalyser's People

Watchers

 avatar  avatar

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.