Skip to content

gagradebnath/FinTech

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

114 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FinGuard: Personal Finance Management Web A### 🏦 **Co### πŸŽ›οΈ Advanced PL/SQL Features

  • ⚑ Stored Procedures: 7 optimiz### πŸ”§ Technical Implementation
  • Database Integration: Two dedicated blockchain tables
    • blockchain: Store blockchain blocks with hash chains
    • blockchain_transactions: Store blockchain-specific transaction data
  • Python Implementation: Complete blockchain classes and utilities
  • API Endpoints: REST APIs for blockchain verification and analytics
  • Real-time Processing: Blockchain validation during transaction processing

πŸ—„οΈ Complete Database Schema

FinGuard uses a comprehensive MySQL database with 14 core tables:

Core Tables

  • users: User account information with balance tracking
  • roles: Role-based access control (USER, ADMIN, AGENT)
  • permissions: System permissions and capabilities
  • role_permissions: Role-permission mappings
  • transactions: All financial transactions with audit trail
  • contact_info: User contact information (email, phone)
  • addresses: User address information

Blockchain Tables

  • blockchain: Immutable blockchain blocks with hash chains
  • blockchain_transactions: Blockchain-specific transaction data

Security & Fraud Tables

  • fraud_list: Fraud reports and investigations
  • user_passwords: Secure password hashes
  • admin_logs: Complete audit trail of all actions

Budget & Finance Tables

  • budgets: User budget planning
  • budget_expense_categories: Budget expense categories
  • budget_expense_items: Individual budget items
  • user_expense_habit: User spending patterns and habits

Database Features

  • Foreign Key Constraints: Complete referential integrity
  • Indexes: Optimized queries with strategic indexing
  • Triggers: Automatic validation and audit logging
  • Stored Procedures: Complex operations with error handling
  • Functions: Analytical functions for risk assessment

πŸ—ƒοΈ Database Featuresures for core operations

  • πŸ”§ Functions: 4 analytical functions for risk and spending analysis
  • πŸ‘οΈ Views: 3 comprehensive views for reporting and monitoring
  • πŸ”” Triggers: 4 audit triggers for automatic logging and fraud detection
  • πŸ”— Blockchain Integration: Immutable transaction records with SHA-256 hashingnking Features**
  • πŸ’Έ Enhanced Money Transfers: Fraud detection, balance validation
  • πŸ”„ Transaction Rollbacks: 72-hour rollback window with audit trail
  • πŸ“Š Risk Assessment: Real-time user risk scoring
  • πŸ›‘οΈ Fraud Protection: Automatic fraud flagging and prevention
  • πŸ”— Blockchain Security: SHA-256 blockchain for transaction integrity
  • πŸ” Immutable Records: Tamper-proof transaction history

πŸš€ INSTANT SETUP: Just run setup.bat β†’ Open http://localhost:5000
Login: admin/admin, agent/agent, or user/user

FinGuard is a comprehensive personal finance management web application with advanced PL/SQL optimizations, rollback functionality, modern UI, role-based access control, budget planning, and transaction management.

πŸš€ ONE-CLICK SETUP

Just double-click: setup.bat

The setup will prompt you for MySQL credentials, then everything happens automatically:

  • βœ… Installs MySQL (if needed)
  • βœ… Installs Python packages
  • πŸ”„ Creates fresh database (removes existing if found)
  • πŸ”§ Updates app/config.py with your MySQL credentials
  • βœ… Deploys comprehensive PL/SQL optimizations
  • βœ… Adds test data and user accounts
  • βœ… Starts the application

⚠️ Note: This will delete any existing fin_guard database for a clean installation.

πŸ’» Requirements

  • Windows OS
  • Python 3.8+ (will be installed if missing)
  • MySQL 5.7+ (will be installed if missing)
  • Internet connection (for package installation)

No need to install MySQL manually - the setup script handles it!

🎯 Test It Instantly

After running setup.bat, login with these accounts:

Username Password Role
admin admin Admin
agent agent Agent
user user User

Access: http://localhost:5000 (opens automatically)

✨ Key Features

🏦 Core Banking Features

  • οΏ½ Enhanced Money Transfers: Fraud detection, balance validation
  • πŸ”„ Transaction Rollbacks: 72-hour rollback window with audit trail
  • πŸ“Š Risk Assessment: Real-time user risk scoring
  • πŸ›‘οΈ Fraud Protection: Automatic fraud flagging and prevention

πŸŽ›οΈ Advanced PL/SQL Features

  • ⚑ Stored Procedures: 7 optimized procedures for core operations
  • οΏ½ Functions: 4 analytical functions for risk and spending analysis
  • πŸ‘οΈ Views: 3 comprehensive views for reporting and monitoring
  • πŸ”” Triggers: 3 audit triggers for automatic logging

πŸ’Ό Multi-Role System

  • Admin Dashboard: User management, system monitoring, fraud reports
  • Agent Dashboard: Customer service, transaction assistance
  • User Dashboard: Personal finance, budgets, transaction history

πŸ“± Modern Interface

  • πŸŒ™ Dark Theme: Professional dark mode interface
  • πŸ“± Responsive Design: Works on all devices
  • πŸ“Š Real-time Charts: Interactive financial analytics
  • πŸ”’ Security: Role-based permissions, session management

πŸ› οΈ What's Inside

🏦 Core Banking Operations

  • πŸ’Έ Enhanced Money Transfers: Secure transfers with fraud detection
  • πŸ”„ Transaction Rollbacks: Undo transactions within 72 hours
  • πŸ“Š Budget Planning: Create and manage personal budgets
  • πŸ“ˆ Transaction Analytics: Real-time financial insights
  • πŸ›‘οΈ Fraud Protection: Automatic fraud detection and reporting
  • πŸ”— Blockchain Security: Immutable transaction records with SHA-256 hashing
  • πŸ” Transaction Integrity: Tamper-proof blockchain validation

πŸ‘¨β€πŸ’Ό Multi-Role Dashboards

  • πŸ”§ Admin Panel: User management, system monitoring, fraud reports, blockchain analytics
  • 🎯 Agent Tools: Customer service, money operations, transaction assistance
  • πŸ‘€ User Portal: Personal finance, budgets, transaction history

πŸ“Š Advanced Analytics

  • πŸ“ˆ Risk Scoring: AI-powered user risk assessment
  • πŸ’° Spending Analysis: Daily/weekly/monthly spending patterns
  • πŸ” Audit Trails: Complete transaction logging and monitoring
  • πŸ“‹ Reporting: Comprehensive financial reports
  • πŸ”— Blockchain Analytics: Real-time blockchain integrity monitoring
  • πŸ” Fraud Detection: Advanced blockchain-based fraud detection

οΏ½ Blockchain Implementation

FinGuard features a complete blockchain implementation for transaction security and fraud detection:

πŸ—οΈ Blockchain Architecture

  • Block Class: Immutable blocks with SHA-256 hashing
  • Genesis Block: System-initialized first block
  • Chain Validation: Complete blockchain integrity verification
  • Tamper Detection: Automatic detection of blockchain manipulation

πŸ” Security Features

  • SHA-256 Hashing: Cryptographic security for each block
  • Immutable Records: Tamper-proof transaction history
  • Chain Validation: Real-time blockchain integrity checks
  • Fraud Detection: Advanced fraud detection through blockchain analysis

πŸ“Š Blockchain Analytics Dashboard

  • Real-time Monitoring: Live blockchain status and health
  • Block Statistics: Total blocks, validation status, chain health
  • Fraud Reports: Blockchain-based fraud detection results
  • Transaction Verification: Verify individual transactions via blockchain

πŸ›‘οΈ Fraud Detection via Blockchain

  • Transaction Validation: Every transaction validated against blockchain
  • Inconsistency Detection: Automatic detection of blockchain inconsistencies
  • User Flagging: Automatic fraud flagging based on blockchain analysis
  • Audit Trail: Complete audit trail of all blockchain operations

πŸ”§ Technical Implementation

  • Database Integration: Two dedicated blockchain tables
    • blockchain: Store blockchain blocks with hash chains
    • blockchain_transactions: Store blockchain-specific transaction data
  • Python Implementation: Complete blockchain classes and utilities
  • API Endpoints: REST APIs for blockchain verification and analytics
  • Real-time Processing: Blockchain validation during transaction processing

οΏ½πŸ—ƒοΈ Database Features

πŸ“¦ Stored Procedures

  • ProcessMoneyTransferEnhanced: Enhanced money transfer with fraud detection
  • RollbackTransaction: Rollback completed transactions
  • GetTransactionStatus: Check transaction status and rollback eligibility
  • BackupUserBalance: Create user balance backups
  • RestoreUserBalance: Restore user balance from backup
  • AutoRollbackFailedTransactions: Auto-rollback failed transactions
  • CleanupOldFraudReports: Clean up old fraud reports
  • AddColumnIfNotExists: Dynamic database schema modifications

πŸ”§ Functions

  • GetUserRiskScore: Calculate user risk score (0-100)
  • GetUserDailySpending: Get daily spending amount
  • IsWithinSpendingLimit: Check if user is within spending limits
  • GetUserTransactionCount: Get transaction count for specified period

πŸ‘οΈ Views

  • v_transaction_analytics: Comprehensive transaction analysis
  • v_user_risk_analysis: User risk and spending analysis
  • v_rollback_monitoring: Rollback eligibility monitoring

πŸ”” Triggers

  • tr_transaction_audit: Automatic transaction audit logging
  • tr_balance_validation: Prevent negative balances and log changes
  • tr_fraud_detection: Real-time fraud detection and flagging
  • tr_user_registration: Handle new user registration tasks

πŸ”— Blockchain Implementation

  • Block Class: Immutable blocks with SHA-256 hashing
  • FinGuardBlockchain Class: Complete blockchain management
  • Blockchain Tables:
    • blockchain: Store blockchain blocks
    • blockchain_transactions: Store blockchain-specific transaction data
  • Fraud Detection: Advanced blockchain-based fraud detection
  • Transaction Integrity: Tamper-proof transaction validation
  • Real-time Monitoring: Blockchain analytics and monitoring dashboard

πŸ“ Project Structure

FinGuard/
β”œβ”€β”€ setup.bat                      # πŸš€ One-click setup script (run this!)
β”œβ”€β”€ auto_setup.py                  # Automatic MySQL installation and setup
β”œβ”€β”€ database_seed.py               # Database seeding with test data
β”œβ”€β”€ run.py                         # Start the application
β”œβ”€β”€ FinGuard_Complete_PL_SQL.sql   # πŸ†• Complete PL/SQL optimizations
β”œβ”€β”€ deploy_complete.bat            # Deploy all PL/SQL features
β”œβ”€β”€ fix_collations.sql             # Fix database collation issues
β”œβ”€β”€ DatabaseSchema_MySQL.sql       # MySQL database schema
β”œβ”€β”€ app/                           # Main application code
β”‚   β”œβ”€β”€ routes/                    # Web pages and API endpoints
β”‚   β”‚   β”œβ”€β”€ blockchain.py          # πŸ†• Blockchain routes and analytics
β”‚   β”‚   β”œβ”€β”€ admin.py               # Admin dashboard
β”‚   β”‚   β”œβ”€β”€ agent.py               # Agent operations
β”‚   β”‚   β”œβ”€β”€ user.py                # User operations
β”‚   β”‚   └── fraud.py               # Fraud detection
β”‚   β”œβ”€β”€ templates/                 # HTML templates
β”‚   β”‚   β”œβ”€β”€ blockchain_dashboard.html # πŸ†• Blockchain monitoring dashboard
β”‚   β”‚   β”œβ”€β”€ admin_dashboard.html   # Admin interface
β”‚   β”‚   └── ...                    # Other templates
β”‚   β”œβ”€β”€ static/                    # CSS, JavaScript, images
β”‚   └── utils/                     # Business logic and database operations
β”‚       β”œβ”€β”€ blockchain_utils.py    # πŸ†• Complete blockchain implementation
β”‚       β”œβ”€β”€ advanced_sql_utils.py  # Advanced SQL operations
β”‚       β”œβ”€β”€ fraud_utils.py         # Fraud detection utilities
β”‚       └── ...                    # Other utilities
└── PL_SQL_Documentation.md        # πŸ†• Complete PL/SQL documentation

πŸ†˜ Need Help?

Setup Issues

  • MySQL installation fails: The script will prompt to install manually from https://dev.mysql.com/downloads/
  • Permission denied: Run setup.bat as administrator
  • Python not found: Install Python 3.8+ from https://python.org
  • MySQL connection fails: Double-check your MySQL credentials (host, port, username, password)
  • Collation errors: Run fix_collations.bat to fix database collation issues

Application Issues

  • Can't login: Use test accounts (admin/admin, agent/agent, user/user)
  • Page errors: Restart by running python run.py
  • Missing data: Rerun setup.bat to recreate sample data

Advanced Configuration

  • Custom MySQL settings: Edit mysql_config_template.py before running setup
  • Production deployment: Set environment variables for database credentials
  • Development: All source code is in the app/ directory

πŸš€ Quick Start

  1. Double-click: setup.bat
  2. Enter MySQL credentials: When prompted (host, port, username, password)
  3. Wait: Automatic setup completes (2-5 minutes)
  4. Access: Browser opens to http://localhost:5000
  5. Login: Use admin/admin, agent/agent, or user/user

οΏ½ Manual Setup (Optional)

If you prefer manual control:

# Install dependencies
pip install PyMySQL cryptography Flask-SQLAlchemy

# Setup database and seed data
python auto_setup.py

# Start application
python run.py

πŸ”‘ Demo Accounts

All accounts start with 10,000 balance for testing:

Role Username Password Features
Admin admin admin User management, admin dashboard, blockchain analytics
Agent agent agent Add money, cash out, agent dashboard
User user user Send money, budgets, profile

πŸ”— Blockchain Dashboard Access

  • Admin Users: Access full blockchain analytics at /blockchain-dashboard
  • Real-time Monitoring: Live blockchain health and integrity status
  • Fraud Detection: View blockchain-based fraud detection results
  • Transaction Verification: Verify individual transactions via blockchain

πŸ’Ύ Database (MySQL)

  • Database: MySQL 8.0+ (fin_guard database)
  • Schema: DatabaseSchema_MySQL.sql with proper ENUM constraints
  • Setup: Fully automated via setup.bat
  • Connection: PyMySQL with robust error handling
  • Features:
    • βœ… Foreign key relationships
    • βœ… ENUM constraints for data integrity
    • βœ… Automatic installation and configuration

πŸ—οΈ Built With

  • Python Flask - Web framework
  • MySQL - Database
  • Bootstrap 5 - Modern UI
  • Chart.js - Data visualization

πŸ’‘ What Makes It Special

βœ… Enterprise-Grade Security: Complete blockchain implementation with SHA-256 hashing
βœ… Advanced Fraud Detection: Multi-layered fraud detection with automatic flagging
βœ… Fully Working: All features tested and functional including blockchain validation
βœ… One-Click Setup: Single script does everything automatically
βœ… Modern Design: Dark theme, responsive layout with blockchain analytics
βœ… Real-World Ready: Role permissions, security features, immutable audit trail
βœ… Zero Configuration: Automatic MySQL installation and setup
βœ… Comprehensive Database: 14 tables with stored procedures, functions, and triggers
βœ… Complete Documentation: Full database documentation in /app/utils/README.md

πŸ” Security Features

  • Blockchain Integrity: Every transaction secured with SHA-256 blockchain
  • Immutable Records: Tamper-proof transaction history
  • Fraud Detection: Advanced fraud detection through blockchain analysis
  • Role-Based Access: Multi-level permission system
  • Audit Trail: Complete logging of all system actions
  • Password Security: Bcrypt hashing with salt

πŸ“Š Analytics & Monitoring

  • Real-time Blockchain Analytics: Live monitoring of blockchain health
  • Transaction Analytics: Comprehensive transaction analysis
  • Risk Assessment: AI-powered user risk scoring
  • Fraud Reports: Detailed fraud investigation reports
  • System Monitoring: Complete system health monitoring
  • Performance Metrics: Database and application performance tracking

Ready to explore personal finance management with enterprise-grade blockchain security? Just run setup.bat and start in under 5 minutes!

πŸ“š Complete Documentation

Database Documentation

  • /app/utils/README.md: Complete database documentation including:
    • All 14 database tables with column descriptions
    • Stored procedures, functions, and triggers
    • Common database queries used throughout the application
    • Blockchain implementation details
    • Security features and fraud detection mechanisms

PL/SQL Documentation

  • PL_SQL_Documentation.md: Comprehensive PL/SQL documentation
  • FinGuard_Complete_PL_SQL.sql: Complete PL/SQL implementation

Key Documentation Sections

  • πŸ“Š Database Schema: Complete 14-table schema documentation
  • πŸ”— Blockchain Implementation: SHA-256 blockchain with fraud detection
  • πŸ”§ Stored Procedures: 8 optimized procedures for core operations
  • πŸ“ˆ Functions: 4 analytical functions for risk assessment
  • πŸ”” Triggers: 4 audit triggers for automatic logging
  • πŸ›‘οΈ Security Features: Role-based access, fraud detection, audit trails
  • πŸ“‹ Query Reference: Common database queries used in application

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors