Streamlit app for uploading CSV or Excel files, inferring a dashboard mapping, filtering and lightly cleaning the data, visualizing two charts, and generating cached AI chart insights.
app.py: final deployable dashboardrequirements.txt: Python dependenciesREADME.md: setup, deployment notes, and learning journalproject_instructions.md: assignment prompt
- Upload
csv,xlsx,xls, orxlsm - AI-first dataset mapping with rule-based fallback
- Editable mapping for datetime, grouping, category, and metrics
- Sidebar filters based on the chosen chart fields
- Lightweight data prep:
- drop null rows by selected columns
- drop zero rows by selected numeric columns
- impute missing values using mode, mean, median, zero-fill, or forward-fill
- KPI summary row
- Time-series chart with configurable:
- time grain
- chart style
- aggregation method
- Bar chart with configurable top-category limit
- Quick insights panel
- AI chart analysis with caching and reusable history
- Create and activate a virtual environment.
- Install dependencies:
pip install -r requirements.txt- Add your API key locally in
.env:
OPENAI_API_KEY=your_key_here- Run the app:
streamlit run app.pyDeploy app.py as the entrypoint.
Do not commit .env or .streamlit/secrets.toml.
For deployment, set OPENAI_API_KEY in the host platform's secret manager.
Examples:
- Streamlit Community Cloud: add
OPENAI_API_KEYin appSecrets - Render / Railway / Hugging Face Spaces: add
OPENAI_API_KEYas an environment variable
The app checks for OPENAI_API_KEY in this order:
- Streamlit secrets
- Environment variables loaded from
.env
If your current key has ever been committed, shared, or exposed publicly, rotate it before deploying.