Coder Social home page Coder Social logo

domesticeconomy's Introduction

Zero Euro Bot: Chat Bot para controle financeiro

This project aims to develop a chatbot to easly save information of expenses and income on Domestic Economy, althought it can be used in different approaches;

About Domestic Economy chatbot:

✔️ You can register your expenses (see /expenses comand), informing a category and a subcategory (see /category & /subcategory comands);
✔️ You can add new cetegory & subcategory (see /add comand);
✔️ You can register your incomes (see /income comand);
✔️ You can retrieve a month summary of your expenses (see /summary comand);
✔️ You can register a month summary in a graphical way of your expenses (see /plot comand);
✔️ You can send sql query by message (see /sql comand);
✔️ You can backup your database (see /backup comand);
✔️ you can use it on a group chat with people yout share your expenses and incomes👫; ⚠️ This is already integrated in master branch;
✔️ you can Have this chatbot deploy in pythonanywherer with a flask webhook;
✔️ you can Have a timeseries graphs of all your expenses and incomes usingsee chatbot-functions;

Few things I'm planning to improve later:

  • Improve UX/UI by using menus;
  • Implement comando by voice by using Google API

Setting up a virtualenv

sudo apt-get install python3-pip python3-dev python-virtualenv python3-pandas python3-matplotlib # for Python 3.n
virtualenv ZeroEuroBot -p python3 
source ZeroEuroBot/bin/activate
easy_install -U pip
pip install requests

About files and codes:

  • setup.py: will create the database, tables and insert default values. :warning: Take a look on it if you plan to adequate both category and subcategories to your reality;
  • dbZeroEuro.py: has all the functions related to the database: insert & retrieve data;
  • economybot.py: is the bot it self. Mannage the text sent to bot and call the according functions;
  • Bot_run.sh: a bash script to keep bot running even after it breaks;
  • API.py: You must create this file where you should put the bot key, user-email & email password;
  • Key: is needed to use the bot; Be careful to keep it save;
  • user-email and email password: will be used on /backup function (see /backup) to send the database backup by e-mail;
    This file should be like:
API = '12312312ADAsxlclncxca'
email = '[email protected]'
password = 'your_password'

chatbot Functions

  • /start will greeting the user, check if user is already registered in users table. If not, it will be registered in users table;
    start

  • /category will retrieve all categories already registered in the category table;
    e.g.: /category
    getting category

  • /subcategory [category] will show the subcategories related to a especific category;
    e.g.: /subcategory casa
    getting sub category

  • /income [value] will save the value assed as a income in the database.
    ⚠️ Use . as decimal!.
    e.g.: /income 1999.99
    saving income

  • /expenses [value] [category] [subcategory] will save the value with category and subcategory assigned in the database;
    ⚠️ Use . as decimal!.
    e.g.: /expenses 19.99 casa luz
    expenses

  • /summary [param] [paramII] {month} {year} will return the summary of data saved on database grouping by param. If a second param is passed (paramII) the summary will be for category and subcategory. Also you can optionally specify a month and year. Otherwise, the summary shown will be of the current month and year;
    e.g.: /summary category subcategory 01 2018
    expenses
    expenses
    expenses

  • /plot [param] [paramII] {month} {year} will return a graphical (:bar_chart:) summary of data saved on database groupping by param.
    e.g.: /plot category 01 2018
    plot user
    plot category
    plot sub category
    plot historico

  • /backup will create and save a database backup in backup folder. Also the backup file will be sent by e-mail (:warning: see API.py).
    e.g.: /backup

  • /add [param] [paramII] will create and new category or subcategory. When the command /add is sent with param, only, the function will check if param already exists as category. Otherwise, will be inserted in category table. If /add is sent with both [param] and [paramII], the paramII will be save as subcategory with relation to param category.
    ⚠️ If intending to create a new category and subcategory, first create the category (eg.: /add newCategory) to later save the new subcategory related to the category previusly created (e.g.: /add newCategory newSubCategory).

  • /sql send a sql query and the results sent by message.
    ⚠️ commands like ALTER TABLE or DROP TABLE won't be accepted. This can be changed on economybot.py.
    e.g.: /sql select * from view_general limit 3

Useful Links

Some links that was useful to develop this project and study python:

domesticeconomy's People

Contributors

felipesbarros avatar lucadelu avatar alvfig avatar

Watchers

James Cloos 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.