Skip to content

MarceloAdan73/pystreamflow-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ’ฐ PyStreamFlow

CI

Python Streamlit Plotly SQLite License Tests PWA Stars

๐Ÿš€ Personal finance management web app with integrated AI

๐Ÿ“ฑ Demo โ€ข ๐Ÿ“‹ Features โ€ข ๐Ÿ› ๏ธ Installation โ€ข ๐Ÿ“– Technical Docs โ€ข ๐Ÿค Contribute


๐ŸŒŸ Why PyStreamFlow?

Feature Description
๐ŸŽฏ Smart Automatic amount detection (US/EU format)
๐Ÿ“Š Visual Interactive charts with Plotly
๐Ÿค– AI Financial assistant with HuggingFace + local fallback
๐Ÿ’พ Persistent Local SQLite, no setup required
๐Ÿ“ฑ PWA Installable as mobile app
๐Ÿ”’ Secure Optional authentication via Supabase
๐Ÿงช Tested 17 unit tests passing

๐Ÿ“ฑ Demo

**๐Ÿ”— Live App**โ†—๏ธ


๐Ÿ“ธ Screenshots

Desktop - Dashboard Desktop - New Transaction Desktop - History
Desktop - Charts Desktop - Budgets Mobile

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  ๐Ÿ’ฐ PyStreamFlow                              [Dashboard]   โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                             โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
โ”‚   โ”‚   INGRESOS   โ”‚  โ”‚    GASTOS    โ”‚  โ”‚   BALANCE    โ”‚    โ”‚
โ”‚   โ”‚  $ 150,000   โ”‚  โ”‚   $ 45,000   โ”‚  โ”‚  $ 105,000   โ”‚    โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
โ”‚                                                             โ”‚
โ”‚   ๐Ÿ“ˆ Evoluciรณn de Gastos    |    ๐Ÿฐ Por Categorรญa         โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      |    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”‚
โ”‚   โ”‚  โ–“โ–“โ–“โ–“โ–“โ–“โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘    โ”‚      โ”‚    โ”‚   โ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘    โ”‚     โ”‚
โ”‚   โ”‚  โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–‘โ–‘โ–‘โ–‘    โ”‚      โ”‚    โ”‚   โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘    โ”‚     โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜      |    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ”‚
โ”‚                                                             โ”‚
โ”‚   ๐Ÿ“ Transacciones Recientes                              โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”โ”‚
โ”‚   โ”‚ ๐ŸŸข Salario        $ 80,000    15/03/2024            โ”‚โ”‚
โ”‚   โ”‚ ๐Ÿ”ด Supermercado   $ 15,000    14/03/2024            โ”‚โ”‚
โ”‚   โ”‚ ๐Ÿ”ด Transporte     $ 5,000     14/03/2024            โ”‚โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜โ”‚
โ”‚                                                             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โœจ Features

๐Ÿ  Core

  • โœ… Transaction recording with smart amount detection
  • โœ… Dashboard with real-time metrics
  • โœ… Currency: Argentine Pesos (ARS)
  • โœ… Date filters with validation
  • โœ… Interactive Plotly charts with tooltips
  • โœ… Pagination in history (1000+ transactions)

๐Ÿ’ฐ Financial Management

  • โœ… Monthly budgets per category with visual alerts
  • โœ… Savings goals with visual progress
  • โœ… In-app alerts when budget exceeded
  • โœ… Complete history with search, filters, editing

๐Ÿ’พ Data & Sync

  • โœ… Local SQLite persistence
  • โœ… Backup/Import JSON
  • โœ… PDF report export
  • โœ… Supabase authentication (optional)
  • โœ… Offline mode without account

๐Ÿท๏ธ Categories

  • โœ… Predefined: Food, Housing, Transport, etc.
  • โœ… Custom: Create your own categories

๐Ÿค– AI Assistant

  • โœ… Floating chat with personalized responses
  • โœ… HuggingFace Zephyr for intelligent analysis
  • โœ… Local fallback without internet

๐ŸŽจ UI/UX

  • โœ… Responsive design (mobile + desktop)
  • โœ… Animations micro-interactions
  • โœ… Onboarding tutorial
  • โœ… Skeleton loaders
  • โœ… PWA installable as app

โŒจ๏ธ Keyboard Shortcuts

Shortcut Action
Ctrl + N New transaction
Ctrl + H Go to History
Ctrl + D Go to Dashboard

๐Ÿ› ๏ธ Installation

Requirements

  • Python 3.10+
  • pip

Step by step

# 1. Clone repository
git clone https://github.com/your-user/pystreamflow.git
cd pystreamflow

# 2. Create virtual environment
python -m venv venv

# Windows
venv\Scripts\activate

# macOS/Linux
source venv/bin/activate

# 3. Install dependencies
pip install -r requirements.txt

# 4. Configure environment variables (optional)
cp .env.example .env

# 5. Run
streamlit run pystreamflow.py

๐Ÿš€ Deploy on Streamlit Cloud

# 1. Push to GitHub
# 2. Go to https://streamlit.io/cloud
# 3. Connect GitHub โ†’ Select repo
# 4. Main file: pystreamflow.py
# 5. Enjoy! ๐ŸŒ

๐Ÿ—๏ธ Technical Architecture

pystreamflow/
โ”œโ”€โ”€ pystreamflow.py       # โญ Main app (3134 lines)
โ”œโ”€โ”€ database.py           # ๐Ÿ“ฆ SQLite data layer (479 lines)
โ”œโ”€โ”€ auth.py               # ๐Ÿ” Supabase auth (181 lines)
โ”œโ”€โ”€ style.css             # ๐ŸŽจ Styles (1540 lines)
โ”œโ”€โ”€ test_app.py           # ๐Ÿงช Unit tests (213 lines)
โ”œโ”€โ”€ requirements.txt      # ๐Ÿ“‹ Dependencies
โ”œโ”€โ”€ pyproject.toml        # โš™๏ธ Python config
โ”œโ”€โ”€ .env.example          # ๐Ÿ”ง Config template
โ”œโ”€โ”€ LICENSE               # ๐Ÿ“œ MIT License
โ”œโ”€โ”€ README.md             # ๐Ÿ“– This file
โ”œโ”€โ”€ run.bat / run.sh      # โšก Run scripts
โ”œโ”€โ”€ static/
โ”‚   โ”œโ”€โ”€ manifest.json     # ๐Ÿ“ฑ PWA manifest
โ”‚   โ””โ”€โ”€ service-worker.js # ๐ŸŒ PWA service worker
โ””โ”€โ”€ venv/                 # ๐Ÿ Virtual environment (not versioned)

๐Ÿ“– Technical Documentation

Tech Stack

Layer Technology Version
Framework Streamlit โ‰ฅ1.30.0
Data Pandas โ‰ฅ2.0.0
Visualization Plotly โ‰ฅ5.18.0
PDF ReportLab โ‰ฅ4.0.0
Database SQLite built-in
AI Cloud HuggingFace Hub โ‰ฅ0.20.0
Auth Cloud Supabase โ‰ฅ2.0.0
Testing Pytest โ‰ฅ8.0.0

Database Schema

-- Transactions
CREATE TABLE transacciones (
    id TEXT PRIMARY KEY,
    tipo TEXT NOT NULL,
    monto REAL NOT NULL,
    categoria TEXT NOT NULL,
    descripcion TEXT,
    fecha TEXT NOT NULL,
    moneda TEXT DEFAULT 'ARS',
    user_id TEXT,
    created_at TEXT
);

-- Budgets
CREATE TABLE presupuestos (
    id INTEGER PRIMARY KEY,
    user_id TEXT,
    categoria TEXT NOT NULL,
    limite REAL NOT NULL
);

-- Savings Goals
CREATE TABLE metas_ahorro (
    id TEXT PRIMARY KEY,
    user_id TEXT,
    nombre TEXT NOT NULL,
    objetivo REAL NOT NULL,
    ahorrado REAL DEFAULT 0,
    fecha_limite TEXT,
    categoria TEXT
);

-- Custom Categories
CREATE TABLE categorias_custom (
    id INTEGER PRIMARY KEY,
    user_id TEXT,
    tipo TEXT NOT NULL,
    nombre TEXT NOT NULL
);

Smart Amount Detection

The app automatically detects formats:

"15000"           โ†’ 15000    # Simple
"15000 ARS"       โ†’ 15000    # With text
"1.500,50"       โ†’ 1500.50  # European
"1500.50"        โ†’ 1500.50  # American

AI Assistant API

# Query HuggingFace
response = consultar_ia("How much did I spend on food?", context)

# Local fallback (no internet)
response = consultar_ia_local(question, context)

๐Ÿงช Testing

# Run all tests
pytest test_app.py -v

# Specific tests
pytest test_app.py::test_detectar_moneda_simple -v

Results: 17 tests passing โœ…

Test Status
test_detectar_moneda_simple โœ…
test_detectar_moneda_con_texto โœ…
test_detectar_moneda_con_comas โœ…
test_detectar_moneda_decimal โœ…
test_detectar_moneda_invalida โœ…
test_formatear_monto_ars โœ…
test_calcular_metricas_* โœ…
test_crear_transaccion โœ…
test_generar_id_formato โœ…
test_ciclo_completo_transaccion โœ…

โš™๏ธ Configuration

Environment Variables

Variable Description Required
HF_TOKEN HuggingFace token (cloud AI) โŒ
SUPABASE_URL Supabase project URL โŒ
SUPABASE_KEY Supabase API key โŒ

Usage Modes

Mode Description Requires
Local SQLite + local data โŒ Nothing
Cloud Supabase sync โœ… Credentials
AI Cloud HuggingFace โœ… HF Token
AI Local Basic responses โŒ Nothing

๐Ÿ”ฎ Roadmap

  • Multi-currency (USD, EUR)
  • Excel export
  • Push notifications
  • Native mobile app (React Native)
  • Bank integration (Open Banking)
  • Investment tracking

๐Ÿค Contribute

# 1. Fork
# 2. Create branch
git checkout -b feature/new-feature

# 3. Commit
git commit -am 'Add new feature'

# 4. Push
git push origin feature/new-feature

# 5. Pull Request

๐Ÿ“„ License

MIT License - See LICENSE


๐Ÿ™ Acknowledgments


โญ If you like the project, give it a star!

Made with โค๏ธ by PyStreamFlow Team

About

Interactive personal finance manager with AI assistant. Track income/expenses, set budgets, savings goals, and get intelligent insights powered by HuggingFace. Built with Python + Streamlit.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages