Code Monkey home page Code Monkey logo

vouchers's Introduction

Vouchers Data Engineering Project, Wefarm

Wefarm has voucher data stored in json files. There is need to have this data cleaned and stored in a sql database for easy querying by analysts.

Requirements

  • Postgres database
  • Python3
  • Pip
  • Python packages
    • The following packages are required for the project to run.
      pandas
      sqlalchemy
      dbt
      numpy
      
    • The requirements.txt file contains a list of these packages. Running the command below installs them at once, and their dependencies.
      pip3 install -r requirements.txt
      

It is preferrable if the above are run in a virtual environment.

Data model

The output of this project is two tables.

Master calendar date dimension

field name type description
date datetime date field
day_of_week int day of the week
day_of_month int day of the month
week_of_month int week of the month
week_of_year int week of the year
month int month number
year int month number

Vouchers table

field name type description
user_id int id of the user
voucher_code binary unique id of the voucher
product varchar name of product
country varchar vendor country
status varchar voucher redemption status
date datetime date associated with voucher

How to run

There are several steps involved in runnig this project.

  1. Start the postgres database service. For linux based systems, you can use the command below:

    sudo service postgresql start
    
  2. Run the command below from a terminal to stage the json files to the tb. Run the command from the root folder of the project.

    python3 load_to_db.py
    
  3. Run dbt to clean the data and build the data models.

    cd vouchers_project/
    dbt run
    
  4. To run tests on the models, execute the the command:

    dbt test
    
  5. Generate and render docs to access the web interface for dbt. By default, dbt will run on port 8080

    dbt docs generate
    dbt docs run
    

vouchers's People

Contributors

dennismutia avatar

Watchers

 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.