How vatshayan/upi-fraud-detection-using-machine-learning works
Project type and purpose
• This is a full-stack web application for real-time UPI fraud detection.
• The frontend is a simple HTML/CSS interface (templates/index.html + static/styles.css).
• The backend is a Python/Flask app (app.py) that loads and runs a pre-trained machine-learning model.
• model.ipynb is used offline for data exploration, model training, and export.
File structure
• Top level:
• README.md – project overview
• app.py – Flask application entry point (routes, request handling, model inference)
• model.ipynb – Jupyter notebook for ML development
• Directories:
• /templates – Jinja2 HTML template(s) for user input and displaying results
• /static – CSS (and potentially JS or images) for styling and client behavior
• No explicit database folder; data persistence (if any) might be a flat file or in-memory.
README for additional clues
• Emphasizes a “user-friendly interface” for entering transaction details and “real-time fraud assessments.”
• Mentions security and privacy best practices (use HTTPS, sanitize inputs).
• No external services listed, so assume all inference happens in-app.
• Client-side UI (Browser)
• Web Server / API Layer (Flask app.py)
• ML Model Service (loaded from serialized model file or in-memory object)
• Data Store (optional – e.g., CSV/JSON log of transactions or a lightweight DB)
• Offline Model-Training Environment (model.ipynb + raw data)
1. User (Browser) → HTTP POST /predict → Flask API
2. Flask API → (call) ML Model Service → returns fraud score/label
3. Flask API → optional write to Data Store (logging/persistence)
4. Flask API → HTTP response → Browser (fraud assessment display)
5. Offline Training → reads raw data → updates ML Model → exports new serialized model → deployed to Web Server
c. Architectural patterns & design principles
• MVC-style separation:
• View = HTML templates
• Controller = Flask routes + request handling
• Model = ML inference code + serialized model artifacts
• Single-service deployment (monolith) with clear internal module boundaries
• Keep ML training and inference decoupled (batch vs. real-time)
• Security: enforce input validation, HTTPS for all endpoints, sanitize user inputs
d. Key technologies & libraries
• Python 3.x, Flask (app.py)
• Jinja2 templating (templates/index.html)
• CSS for styling (static/styles.css)
• scikit-learn / pandas / numpy inside model.ipynb + inference code
• Optional: SQLite or CSV for simple persistence