File size: 3,589 Bytes
f2c0bd9
 
 
 
 
 
 
 
 
 
 
366223a
f2c0bd9
366223a
 
 
f2c0bd9
366223a
 
 
 
 
 
 
f2c0bd9
366223a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f2c0bd9
366223a
 
f2c0bd9
366223a
 
 
 
f2c0bd9
366223a
187de79
366223a
187de79
366223a
187de79
366223a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67e3963
366223a
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123

---
title: BizIntel AI Ultra
emoji: πŸ“Š
colorFrom: indigo
colorTo: blue
sdk: docker
app_file: app.py
pinned: false
---

# πŸ“Š BizIntel AI Ultra – Advanced Analytics & Agentic BI

**BizIntel AI Ultra** turns any data tableβ€”whether a quick CSV upload or a live
database tableβ€”into an interactive **insight & forecasting workspace** powered
by:

* **Google Gemini 1.5 Pro** β‡’ natural-language strategy briefs  
* **ARIMA time-series pipeline** β‡’ 90-step (or 3-period) forecasts with
  model explainability, back-testing, residual ACF & CI bands  
* **Plotly Darkβ„’** trend, forecast & EDA visuals  
* **Streamlit** front-end running inside a Hugging Face Space  
* **Modular tools** (`csv_parser`, `plot_generator`, `forecaster`,
  `visuals`, `db_connector`) for quick reuse in your own projects

---

## πŸš€ Live Demo (Hugging Face Space)

<https://huggingface.co/spaces/your-handle/BizIntel_AI>

Upload a CSV or Excel (≀ 500 MB) **or** connect to PostgreSQL / MySQL /
SQL Server / Oracle via a SQLAlchemy URI, select a date column and a numeric
metric, and watch:

1. Trend chart   
2. 90-step forecast with confidence fan, summary stats & interpret-ability  
3. Gemini-generated strategy report  
4. Optional histograms, scatter matrices, correlation heat-maps

---

## ✨ Features

| Area | Details |
| ---- | ------- |
| **Data ingest** | CSV, XLS/XLSX, or DB fetch (`sqlalchemy` URI) |
| **Sampling** | Auto-samples giant CSVs (β‰₯ 1 M rows) to avoid OOM |
| **Quick scan** | Markdown dataset overview: schema, missing %, numeric `describe()` |
| **Trend** | Interactive line + markers (Plotly Dark) |
| **Forecast** | ARIMA(1,1,1) auto-freq, 90-step (daily) or 3-step (monthly, etc) |
| | CI fan, residual ACF plot, 20 % back-test (MAPE, RMSE) |
| | Seasonal decomposition (toggle) |
| **Explainability** | Model summary table, plain-English coef notes |
| **Gemini 1.5 Pro** | 5 insights, 3 strategies, risks, extra-visuals β†’ Markdown + download |
| **EDA** | Histograms (with KDE), box / violin plots, scatter-matrix, corr heat-map |
| **Static images** | All figures also saved to `/tmp/*.png` for downstream reports |
| **Extensible** | Each visual is a standalone helper in `tools/` |

---

## πŸ›  Local Dev Setup

```bash
# 1. Clone
git clone https://github.com/your-handle/BizIntel_AI.git
cd BizIntel_AI

# 2. Python env
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

# 3. Gemini key
export GEMINI_APIKEY="your_google_ai_studio_key"

# 4. Run
streamlit run app.py
Note : ARIMA & seasonal decomposition come from
statsmodels; Plotly PNG export needs kaleido.
These are included in requirements.txt.

πŸ”Œ Database Connect String Examples
text
Copy code
# PostgreSQL
postgresql+psycopg2://user:password@host:port/dbname

# MySQL
mysql+pymysql://user:password@host/dbname

# SQL Server
mssql+pyodbc://user:password@host:1433/db?driver=ODBC+Driver+17+for+SQL+Server

# Oracle
oracle+cx_oracle://user:password@host:1521/?service_name=ORCL
🌐 Deploying to Hugging Face Spaces
Space β–Έ Create β–Έ Docker template

Push repo (Dockerfile, app.py, tools/, requirements.txt)

Add a secret β†’ GEMINI_APIKEY

Space builds ; enjoy!

πŸ—Ί Project Structure
Copy code
β”œβ”€ app.py
β”œβ”€ requirements.txt
β”œβ”€ Dockerfile
β”œβ”€ tools/
β”‚   β”œβ”€ csv_parser.py
β”‚   β”œβ”€ plot_generator.py
β”‚   β”œβ”€ forecaster.py
β”‚   β”œβ”€ visuals.py
β”‚   └─ db_connector.py
└─ README.md
🀝 Contributing
Issues & PRs are welcome!
Please run black -l 88 and ruff before submitting.

πŸ“œ License
MIT Β© 2025 BizIntel AI Ultra Team