Skip to content

A full-stack application for processing and analyzing MoMo SMS transactions. The project extracts data from XML, cleans and categorizes it, stores it in MySQL using SQLAlchemy, and provides an interactive dashboard for insights.

License

Notifications You must be signed in to change notification settings

Miranics/MoMo-full-stack-application

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MTN MoMo Data Analytics Platform πŸ“Š

(image )

A comprehensive full-stack web application for analyzing MTN Mobile Money (MoMo) transaction data. This platform provides real-time insights, interactive visualizations, and detailed transaction analysis for mobile payment data.

πŸ“Œ Table of Contents

πŸš€ Features

Dashboard Analytics

  • Real-time transaction monitoring and analysis
  • Interactive charts using Chart.js
  • Transaction volume visualization
  • Distribution analysis by transaction type
  • Key metrics overview (total transactions, amounts, trends)

Transaction Management

  • Comprehensive transaction listing with pagination
  • Advanced filtering system by:
    • Transaction type
    • Date range
    • Amount
    • User/Phone number
  • Detailed transaction view with historical data

Data Visualization

  • Bar charts for transaction volume analysis
  • Pie charts for transaction type distribution
  • Time-series analysis
  • Custom date range selection
  • Export capabilities

User Interface

  • Modern, responsive design
  • Intuitive navigation
  • Mobile-friendly layout
  • Real-time data updates
  • Interactive components

πŸ› οΈ Technology Stack

Backend (Python)

  • Framework: Flask 2.0+
  • Database: MySQL (Aiven Cloud Database)
  • ORM: SQLAlchemy
  • API: RESTful Architecture
  • Security: CORS, SSL/TLS
  • Documentation: OpenAPI/Swagger

Frontend (JavaScript)

  • HTML5/CSS3: Modern layout and responsive design
  • JavaScript: ES6+ features
  • Charts: Chart.js for data visualization
  • API Integration: Fetch API
  • Styling: Custom CSS with responsive design

DevOps & Infrastructure

  • Hosting: AWS EC2
  • Database: Aiven MySQL Cloud
  • Web Server: Nginx
  • SSL/TLS: Required for database connections
  • Version Control: Git

πŸ“‚ Project Structure

MoMo-full-stack-application
│── backend/                # Backend (Flask) application
β”‚   β”œβ”€β”€ app.py              # Main Flask application
β”‚   β”œβ”€β”€ config.py           # Configuration settings (DB connection)
β”‚   β”œβ”€β”€ models.py           # SQLAlchemy models
β”‚   β”œβ”€β”€ database.py         # Database initialization
β”‚   β”œβ”€β”€ sms_parser.py       # XML Parsing and processing
β”‚   β”œβ”€β”€ data_loader.py      # Insert parsed data into MySQL
β”‚   β”œβ”€β”€ routes.py           # API routes
β”‚   β”œβ”€β”€ requirements.txt    # Required Python libraries
β”‚   β”œβ”€β”€ logs/               # Store logs of ignored/unprocessed messages
β”‚   └── tests/              # Unit tests for backend
β”‚
│── frontend/               # Frontend dashboard (HTML, CSS, JavaScript)
β”‚   β”œβ”€β”€ index.html          # Main dashboard page
β”‚   β”œβ”€β”€ style.css           # Stylesheet
β”‚   β”œβ”€β”€ app.js              # JavaScript logic for fetching & displaying data
β”‚   β”œβ”€β”€ charts.js           # Chart.js integration for visualizations
β”‚   β”œβ”€β”€ assets/             # Images, icons, etc.
β”‚
│── migrations/             # Database migration files (if needed)
β”‚
│── data/                   # Store provided XML data file
β”‚   β”œβ”€β”€ momo_sms.xml        # Sample XML file
β”‚
│── docs/                   # Documentation files
β”‚   β”œβ”€β”€ report.pdf          # 2-3 page project report
β”‚
│── .gitignore              # Ignore unnecessary files (logs, venv, etc.)
│── README.md               # Project description & setup instructions
│── AUTHORS                 # List of contributors
│── run.sh                  # Shell script to start the application

πŸ”§ Installation

  1. Clone the repository:
git clone https://github.com/Miranics/MoMo-full-stack-application.git
cd MoMo-full-stack-application
  1. Set up the backend:
cd backend
python -m venv mimi
source mimi/bin/activate  # Windows: mimi\Scripts\activate
pip install -r requirements.txt
  1. Configure environment variables:
# Create .env file in backend directory
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_HOST=your_db_host
DB_PORT=3306
DB_NAME=your_db_name
  1. Initialize the database:
from backend.database import Base, engine
Base.metadata.create_all(bind=engine)

βš™οΈ Configuration

Backend Configuration (config.py)

class Config:
    SQLALCHEMY_DATABASE_URI = "mysql+pymysql://..."
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    SSL_ARGS = {"ssl": {"ssl_mode": "REQUIRED"}}

Frontend Configuration (api.js)

const API_BASE_URL = 'http://your-api-domain:8000/api';
const CACHE_DURATION = 5 * 60 * 1000; // 5 minutes cache

πŸ“‘ API Documentation

Transaction Endpoints

GET /api/transactions          # Get all transactions
GET /api/transactions/stats    # Get transaction statistics
GET /api/users                # Get all users
GET /api/health               # Health check endpoint

Response Format

{
  "transactions": [
    {
      "id": 1,
      "phone_number": "123456789",
      "amount": 1000.00,
      "transaction_type": "PAYMENT",
      "timestamp": "2024-02-18T15:52:58"
    }
  ]
}

πŸ’Ύ Database Schema

Users Table

CREATE TABLE users (
    id INTEGER PRIMARY KEY AUTO_INCREMENT,
    name VARCHAR(100) NOT NULL,
    phone_number VARCHAR(15) UNIQUE NOT NULL
);

Transactions Table

CREATE TABLE transactions (
    id INTEGER PRIMARY KEY AUTO_INCREMENT,
    phone_number VARCHAR(15) NOT NULL,
    amount FLOAT NOT NULL,
    transaction_type VARCHAR(50) NOT NULL,
    timestamp DATETIME NOT NULL,
    FOREIGN KEY (phone_number) REFERENCES users(phone_number)
);

🎨 Frontend Components

Transaction Types

  • Incoming Money
  • Payments to Code Holders
  • Transfers to Mobile Numbers
  • Bank Deposits
  • Airtime Bill Payments
  • Cash Power Bill Payments
  • Third Party Transactions
  • Agent Withdrawals
  • Bank Transfers
  • Internet/Voice Bundles

Visualization Components

  • Transaction Volume Chart
  • Distribution Pie Chart
  • Time Series Analysis
  • Custom Date Range Selector

πŸ”’ Security

  • SSL/TLS encryption for database connections
  • CORS protection
  • Environment variable management
  • SQL injection prevention
  • Input validation and sanitization
  • Rate limiting
  • Error handling and logging

πŸ”§ Development

Running Locally

# Backend
cd backend
flask run --debug

# Frontend
cd frontend
# Use live server or open HTML files directly

Testing

# Run Python tests
python -m pytest

# Check API endpoints
curl http://localhost:5000/api/health

πŸš€ Deployment

AWS EC2 Deployment

  1. Configure EC2 instance
  2. Set up Nginx
  3. Configure SSL/TLS
  4. Set up environment variables
  5. Run application with gunicorn

Database Setup

mysql -h your-aiven-host -u your-user -p

🀝 Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add AmazingFeature')
  4. Push to branch (git push origin feature/AmazingFeature)
  5. Open Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘€ Authors

Nanen Miracle - Miranics Akachi David Nwanze d.akachi@alustudent.com Abraham Chan Deng a.garang@alustudent.com Joan Kariza j.kariza@alustudent.com

πŸ“ž Support

For support:

πŸ™ Acknowledgments

  • MTN for inspiration and support
  • Chart.js team for visualization library
  • Flask and SQLAlchemy communities

πŸ”— Link to application


Last updated: 2025-02-18

About

A full-stack application for processing and analyzing MoMo SMS transactions. The project extracts data from XML, cleans and categorizes it, stores it in MySQL using SQLAlchemy, and provides an interactive dashboard for insights.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •