{"id":27025904,"url":"https://github.com/avrtt/retail-upselling","last_synced_at":"2026-02-21T17:37:07.154Z","repository":{"id":286063545,"uuid":"944037701","full_name":"avrtt/retail-upselling","owner":"avrtt","description":"A pipeline for market basket analysis aimed at identifying product associations to optimize retail promotions and bundle deals using SQLite, mlxtend \u0026 D3.js","archived":false,"fork":false,"pushed_at":"2025-04-04T05:20:38.000Z","size":9,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-09T16:17:34.960Z","etag":null,"topics":["apriori-algorithm","association-rule-learning","association-rule-mining","basket-analysis","business-analytics","business-intelligence","d3","graph-visualization","market-analysis","mlxtend","pandas","python3","retail","sqlite"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/avrtt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2025-03-06T17:20:17.000Z","updated_at":"2025-04-04T05:20:41.000Z","dependencies_parsed_at":"2025-04-04T06:24:33.564Z","dependency_job_id":"22ff2802-2c8d-43ff-84e5-622b9f234654","html_url":"https://github.com/avrtt/retail-upselling","commit_stats":null,"previous_names":["avrtt/retail-upselling"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/avrtt/retail-upselling","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avrtt%2Fretail-upselling","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avrtt%2Fretail-upselling/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avrtt%2Fretail-upselling/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avrtt%2Fretail-upselling/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/avrtt","download_url":"https://codeload.github.com/avrtt/retail-upselling/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avrtt%2Fretail-upselling/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29688417,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T15:51:39.154Z","status":"ssl_error","status_checked_at":"2026-02-21T15:49:03.425Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["apriori-algorithm","association-rule-learning","association-rule-mining","basket-analysis","business-analytics","business-intelligence","d3","graph-visualization","market-analysis","mlxtend","pandas","python3","retail","sqlite"],"created_at":"2025-04-04T22:15:07.656Z","updated_at":"2026-02-21T17:37:02.145Z","avatar_url":"https://github.com/avrtt.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e ⚠️ **The project is under development!**\n\n\u003cbr/\u003e\n\nThis project is a part of my work on association rule mining; it demonstrates a pipeline for market basket analysis aimed at identifying product associations to optimize retail promotions and bundle deals. Although the project was designed using a real company's dataset, the provided example uses simulated data.\n\nTools:\n- **Python** with `mlxtend` for association rule mining; `pandas`, `json`, `random`\n- **SQLite** to simulate a real-world database storing transactional data\n- **D3.js** for network graph visualization of the product associations\n\n## Structure\n\n```\n.\n├── README.md\n├── main.py\n├── d3_visualization.html\n└── data\n    └── (generated SQLite DB and JSON output files)\n```\n\n- **main.py** contains the Python code to generate example transaction data, store it in an SQLite database, apply the Apriori algorithm to extract frequent itemsets and association rules, and generate a JSON file for network visualization\n- **d3_visualization.html**: a D3.js based HTML file that loads the generated JSON data and displays a network graph of product associations\n- **data/**: directory where the SQLite database (`transactions.db`) and the JSON file (`associations.json`) are saved\n\n## Features\n\n1. **Data generation and SQL storage**\n   - simulated transactional data is created with random transactions and a list of example products\n   - the transactions are stored in an SQLite database to mimic a real-world scenario\n   - a SQL query retrieves the transactions to feed the association rule mining process\n\n2. **Association rule mining part**\n   - the Apriori algorithm (from the mlxtend package) is applied on one-hot encoded transaction data\n   - association rules are extracted based on defined support, confidence and lift thresholds\n\n3. **Visualization part**\n   - the extracted rules (with single-item antecedents and consequents) are converted into a network graph JSON format\n   - the D3.js visualization uses force-directed graph techniques to display nodes (products) and edges (associations), allowing interactive exploration of the results\n\n## How to run\n\n1. Ensure you have Python3 and install the required packages:\n     ```bash\n     pip install pandas mlxtend\n     ```\n\n2. Execute:\n    ```bash\n    python main.py\n    ```\n\n3. To view the visualization, open `d3_visualization.html` in your browser. Ensure the JSON file `associations.json` is in the same directory or adjust the file path in the HTML file accordingly.\n\n## Notes\n\n- The simulated data in this project is for demonstration purposes only\n- Parameters for the Apriori algorithm (such as support and confidence thresholds) can be adjusted in `main.py` to fine-tune the association rule mining process.\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favrtt%2Fretail-upselling","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Favrtt%2Fretail-upselling","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favrtt%2Fretail-upselling/lists"}