{"id":29261207,"url":"https://github.com/philiptitus/hex-","last_synced_at":"2025-07-04T08:07:18.407Z","repository":{"id":298478396,"uuid":"1000103883","full_name":"philiptitus/HEX-","owner":"philiptitus","description":"This project uses K-Means clustering and Google Gemini AI to analyze and categorize M-PESA transaction data, delivering automated spending pattern discovery, interactive insights, and personalized financial recommendations.","archived":false,"fork":false,"pushed_at":"2025-06-11T09:55:23.000Z","size":115,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-11T10:36:19.691Z","etag":null,"topics":["budgeting","clustering","financial-analysis","gemini-api","k-means-clustering","machine-learning","mpesa","python","unsupervised-machine-learning"],"latest_commit_sha":null,"homepage":"https://hexxai.streamlit.app/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/philiptitus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-11T09:13:59.000Z","updated_at":"2025-06-11T09:59:46.000Z","dependencies_parsed_at":"2025-06-11T10:37:46.936Z","dependency_job_id":"2410a2e1-4256-4d74-84af-6ef39c43cafb","html_url":"https://github.com/philiptitus/HEX-","commit_stats":null,"previous_names":["philiptitus/hex-"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/philiptitus/HEX-","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philiptitus%2FHEX-","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philiptitus%2FHEX-/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philiptitus%2FHEX-/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philiptitus%2FHEX-/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/philiptitus","download_url":"https://codeload.github.com/philiptitus/HEX-/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philiptitus%2FHEX-/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263472275,"owners_count":23471812,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["budgeting","clustering","financial-analysis","gemini-api","k-means-clustering","machine-learning","mpesa","python","unsupervised-machine-learning"],"created_at":"2025-07-04T08:07:17.085Z","updated_at":"2025-07-04T08:07:18.396Z","avatar_url":"https://github.com/philiptitus.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HEX Model Project\n\n## Overview\n\nHEX is an advanced, AI-powered analytics and assistant system for M-PESA transaction data. It enables users to upload their M-PESA statements (XLSX or PDF), automatically processes and categorizes transactions, applies machine learning clustering, and provides deep insights, visualizations, and interactive AI-driven assistance. HEX is designed for both technical and non-technical users who want to understand, manage, and optimize their financial behavior using real transaction data.\n\n## Key Features\n\n- **Automated Data Ingestion:**\n  - Upload M-PESA statements in XLSX or PDF format (with optional password support for PDFs).\n  - Robust extraction and cleaning of transaction data, including handling missing values and standardizing columns.\n\n- **Intelligent Categorization:**\n  - Transactions are automatically categorized (e.g., Airtime, Power, Rent, Shopping, Restaurant, Transport, etc.) using rule-based logic and can be enhanced with AI (Gemini API) for more nuanced categorization.\n\n- **Feature Engineering:**\n  - Extracts time-based features (hour, day of week, month) and encodes them for analysis.\n  - Computes net transaction amounts and prepares data for clustering.\n\n- **Clustering \u0026 Pattern Discovery:**\n  - Uses K-Means clustering to group transactions by behavioral patterns (optimal cluster count is determined automatically).\n  - Summarizes each cluster by average, median, and total amounts, and highlights top categories, times, and days.\n  - Calculates and displays the Silhouette Score to assess clustering quality.\n\n- **Visual Analytics:**\n  - Interactive bar charts for total spending by hour, day of week, and category.\n  - Cluster summary tables for quick pattern recognition.\n\n- **AI-Powered Insights (Gemini):**\n  - Natural language summaries and explanations for each cluster.\n  - Automated anomaly/outlier detection and explanations.\n  - Conversational interface: Ask questions about your spending, clusters, or graphs and get AI-generated answers.\n\n- **Budgeting Assistant:**\n  - Personalized budget creation based on your transaction history, clusters, and financial goals, with actionable recommendations.\n\n- **Modular \u0026 Extensible:**\n  - Core logic is split into reusable modules (e.g., `mpesa.py`, `time_category_insights.py`).\n  - Easily extendable for new features, categories, or data sources.\n\n## Folder Structure\n\n- `final.ipynb` - Jupyter notebook for step-by-step analysis, clustering, and AI-powered insights.\n- `mpesa.py` - Core logic for data ingestion, cleaning, categorization, clustering, and Streamlit dashboard.\n- `time_category_insights.py` - Module for time-based transaction insights.\n- `requirements.txt` - Python dependencies for this project.\n\n## Setup\n\n1. Create and activate a virtual environment (optional but recommended):\n   ```powershell\n   python -m venv env\n   .\\env\\Scripts\\Activate.ps1\n   ```\n2. Install dependencies:\n   ```powershell\n   pip install -r requirements.txt\n   ```\n\n## Usage\n\n- Run the Jupyter notebook for interactive, step-by-step analysis:\n  ```powershell\n  jupyter notebook final.ipynb\n  ```\n- Or launch the Streamlit dashboard (if available in your setup):\n  ```powershell\n  streamlit run mpesa.py\n  ```\n- Use the scripts for data processing, clustering, and AI-powered insights.\n\n## Model Name\n\nThe main model in this project is called **HEX**.\n\n## Who Is This For?\n\n- Individuals seeking to understand and optimize their M-PESA spending.\n- Data scientists and students learning about clustering, feature engineering, and AI-powered analytics.\n- Anyone interested in building intelligent financial dashboards and assistants.\n\n## License\n\nThis Project Is Licensed under the MIT License","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphiliptitus%2Fhex-","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphiliptitus%2Fhex-","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphiliptitus%2Fhex-/lists"}