Giter Club home page Giter Club logo

sales-data-analyzer's Introduction

Development

System Modules

  • reader module
  • parser module
  • analyzer module
  • reporter module

Sales Data Analyzer

Sales Data Analyzer is a plain text file parser and data analyser, and a report generator system. It imports flat files, parses data from each file, analyses its data and generates a report output file for each input file.

The following sections describe the input file reader, the expected data format of the input files, the data analysis performed and the generated output report file.

Input File Reader

The application reads every new file with the .dat extension in $HOME/data/in/ path. Each file is parsed, according to an expected formatting layout, and its data is analyzed.

Input File Data

There are three possible types of data for each line, each with a specific format:

  1. salesman
  2. customer
  3. sales

Any lines containing invalid formatted data are ignored.

1. Salesman Data Format

A salesman data line starts with a 3-character id 001 and has the following layout:

001ç<cpf>ç<name>ç<salary>

Fields constraints:

  • cpf: a 11 character-wide numeric only field;
  • name: can contain any characters except 'ç'; must have length ≥ 1;
  • salary: can contain any digit in [0-9] and at most one '.' character; must have length ≥ 1;

2. Customer Data Format

A customer data line starts with a 3-character id 002 and has the following layout:

002ç<cnpj>ç<name>ç<business_area>

Fields constraints:

  • cnpj: a 14 character-wide numeric only field;
  • name: can contain any characters except 'ç'; must have length ≥ 1;
  • business_area: can contain any characters except 'ç'; must have length ≥ 1;

3. Sales Data Format

A sales data line starts with a 3-character id 003 and has the following layout:

003ç<sale_id>ç<item_list>ç<salesman_name>

Fields constraints:

  • sale_id: can contain any digit in [0-9]; must have length ≥ 1;

  • item_list: a comma-separated list, containing at least one item, with the following layout:

    [<item_id_1>-<item_quantity_1>-<item_price_1>,<item_id_2>-<item_quantity_2>-<item_price_2>,...,<item_id_n>-<item_quantity_n>-<item_price_n>]

    Fields constraints:

    • item_id: can contain any digit in [0-9]; must have length ≥ 1;
    • item_quantity: can contain any digit in [0-9]; must have length ≥ 1;
    • item_price: can contain any digit in [0-9] and at most one '.' character; must have length ≥ 1;
  • salesman_name: can contain any characters except 'ç'; must have length ≥ 1;

Data Analysis

The application summarizes for each input file the following data:

  • customers amount
  • salesmen amount
  • most expensive sale id
  • worst salesman name

Output File Generator

An output report file named <input_file_name>.done.dat is created in $HOME/data/out/ path for each input file analysed.

Report Data Format

The output report file has the following layout:

customers amount: <customers_amount>
salesmen amount: <salesmen_amount>
most expensive sale id: <most_expensive_sale_id>
worst salesman name: <worst_salesman_name>

sales-data-analyzer's People

Contributors

dmertins 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.