Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .coverage
Binary file not shown.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ Related to #
- [ ] I have searched existing issues/PRs for similar feature requests
- [ ] I have provided a clear use case for this feature
- [ ] I have considered how this fits with PlotSense's mission
- [ ] I have provided example usage code
- [ ] I have provided example usage code.
7 changes: 3 additions & 4 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install pytest pytest-cov pytest-mock flake8
pip install -e ".[test]"
pip install flake8

- name: Lint with flake8
run: |
Expand Down Expand Up @@ -68,8 +68,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install pytest pytest-mock
pip install -e ".[test]"

- name: Run unit tests only (fast)
run: |
Expand Down
49 changes: 43 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,48 @@
# Virtual environments
/venv
/.venv
venv/
env/
ENV/

# Environment variables
.env
*.env
/__pycache__
/.venv
*.egg-info

# Python cache
__pycache__/
*.py[cod]
*$py.class
*.so

# Distribution / packaging
*.egg-info/
*.egg
*.pyc
*.pyo
*.pyd
build/
dist/
wheels/
*.whl

# Testing
.pytest_cache/
.coverage
coverage.xml
htmlcov/
.tox/
test_logs/

# IDE
.vscode/
.idea/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db

# Database
*.db
*.sqlite
*.sqlite3
204 changes: 183 additions & 21 deletions plotsense.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Metadata-Version: 2.4
Name: plotsense
Version: 0.1.0
Version: 0.1.3
Summary: An intelligent plotting package with suggestions and explanations
Author-email: Christian Chimezie <chimeziechristiancc@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/christianchimezie/PlotSenseAI
Home-page: https://github.com/christianchimezie/PlotSenseAI
Author: Christian Chimezie, Toluwaleke Ogidan, Grace Farayola, Amaka Iduwe, Nelson Ogbeide, Onyekachukwu Ojumah, Olamilekan Ajao
Author-email: chimeziechristiancc@gmail.com, gbemilekeogidan@gmail.com, gracefarayola@gmail.com, nwaamaka_iduwe@yahoo.com, Ogbeide331@gmail.com, Onyekaojumah22@gmail.com, olamilekan011@gmail.com
License: Apache License 2.0
Project-URL: Documentation, https://github.com/christianchimezie/PlotSenseAI/blob/main/README.md
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Expand All @@ -21,19 +22,53 @@ Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENCE
License-File: NOTICE
Requires-Dist: matplotlib>=3.0
Requires-Dist: matplotlib>=3.8.0
Requires-Dist: seaborn>=0.11
Requires-Dist: pandas>=1.0
Requires-Dist: numpy>=1.18
Requires-Dist: python-dotenv
Requires-Dist: groq
Requires-Dist: requests
Requires-Dist: Pillow>=9.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Requires-Dist: pytest-mock>=3.10; extra == "dev"
Requires-Dist: flake8>=6.0; extra == "dev"
Requires-Dist: autopep8>=2.0; extra == "dev"
Provides-Extra: test
Requires-Dist: pytest>=7.0; extra == "test"
Requires-Dist: pytest-cov>=4.0; extra == "test"
Requires-Dist: pytest-mock>=3.10; extra == "test"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: project-url
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# 🌟 PlotSense: AI-Powered Data Visualization Assistant

[![Python Tests](https://github.com/PlotSenseAI/PlotSenseAI/actions/workflows/python-tests.yml/badge.svg)](https://github.com/PlotSenseAI/PlotSenseAI/actions/workflows/python-tests.yml)
[![Frontend Tests](https://github.com/PlotSenseAI/PlotSenseAI/actions/workflows/frontend-tests.yml/badge.svg)](https://github.com/PlotSenseAI/PlotSenseAI/actions/workflows/frontend-tests.yml)
[![codecov](https://codecov.io/gh/PlotSenseAI/PlotSenseAI/branch/main/graph/badge.svg)](https://codecov.io/gh/PlotSenseAI/PlotSenseAI)
[![Python Version](https://img.shields.io/badge/python-3.9%2B-blue.svg)](https://www.python.org/downloads/)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Code style: flake8](https://img.shields.io/badge/code%20style-flake8-black.svg)](https://flake8.pycqa.org/)

## 📌 Overview

**PlotSense** is an AI-powered assistant that helps data professionals and analysts make smarter, faster, and more explainable data visualizations. Whether you're exploring a new dataset or building dashboards, PlotSense simplifies the process with:

- ✅ Smart Visualization Suggestions - Recommends the best plots based on your data structure and relationships.
- 📊 Visualization Plot - Generates suggested plot with ease.
- 🧠 Natural Language Explanations – Automatically explains charts in plain English.
- 🔗 Seamless Integration – Works out of the box with pandas, matplotlib, and seaborn.

Expand All @@ -51,7 +86,7 @@ pip install plotsense

```bash
import plotsense as ps
from plotsense import recommender, generate_plot, explainer,
from plotsense import recommender, plotgen, explainer
```
### 🔐 Authenticate with Groq API:
Get your free API key from Groq Cloud https://console.groq.com/home
Expand All @@ -77,24 +112,55 @@ import pandas as pd
df = pd.read_csv("data.csv")

# Get AI-recommended visualizations
suggestions = ps.recommender(df) # default number of suggestions is 5
suggestions = recommender(df) # default number of suggestions is 5
print(suggestions)
```
### 📊 Sample Output:

![alt text](suggestions_table.png)
![alt text](image.png)

🎛️ Want more suggestions?

``` bash
suggestions = ps.recommender(df, n=10)
suggestions = recommender(df, n=10)
```

### 📈 2. One-Click Plot Generation
Generate recommended charts instantly using .iloc

```bash
plot1 = plotgen(df, suggestions.iloc[0]) # This will plot a bar chart with variables 'survived', 'pclass'
plot2 = plotgen(df, suggestions.iloc[1]) # This will plot a bar chart with variables 'survived', 'sex'
plot3 = plotgen(df, suggestions.iloc[2]) # This will plot a histogram with variable 'age'
```

### 🧾 2. AI-Powered Plot Explanation
or Generate recommended charts instantly using three argurments

```bash
plot1 = plotgen(df, 0, suggestions) # This will plot a bar chart with variables 'survived', 'pclass'
plot2 = plotgen(df, 1, suggestions) # This will plot a bar chart with variables 'survived', 'sex'
plot3 = plotgen(df, 2, suggestions) # This will plot a histogram with variable 'age'
```
🎛️ Want more control?

``` bash
plot1 = plotgen(df, suggestions.iloc[0], x='pclass', y='survived')
```
Supported Plots
- scatter
- bar
- barh
- histogram
- boxplot
- violinplot
- pie
- hexbin

### 🧾 3. AI-Powered Plot Explanation
Turn your visualizations into stories with natural language insights:

``` bash
explanation = ps.explainer(plot1)
explanation = explainer(plot1)

print(explanation)
```
Expand All @@ -103,41 +169,134 @@ print(explanation)
- Custom Prompts: You can provide your own prompt to guide the explanation

``` bash
explanation = refine_plot_explanation(
explanation = explainer(
fig,
prompt="Explain the key trends in this sales data visualization"
)
```
- Multiple Refinement Iterations: Increase the number of refinement cycles for more polished explanations:

```bash
explanation = refine_plot_explanation(fig, iterations=3) # Default is 2
explanation = explainer(fig, max_iterations=3) # Default is 2
```

## 🔄 Combined Workflow: Suggest → Plot → Explain
``` bash
suggestions = recommender(df)
plot = plotgen(df, suggestions.iloc[0])
insight = explainer(plot)
```

## 🧪 Testing

PlotSenseAI has comprehensive test coverage for both Python and frontend code.

### Quick Test Commands

**Python Tests:**
```bash
# Run all tests
pytest

# Run with coverage
pytest --cov=plotsense --cov-report=html

# Run fast tests only (skip slow tests)
pytest -m "not slow"
```

**Frontend Tests:**
```bash
cd web

# Run all tests
npm test

# Run with coverage
npm run test:coverage

# Run in watch mode
npm test -- --watch
```

### Test Infrastructure

- **Backend**: pytest with 950+ lines of tests covering:
- Unit tests for individual functions
- Integration tests for component interaction
- End-to-end workflow tests
- Mock external API calls (Groq)

- **Frontend**: Vitest + React Testing Library
- Component tests for UI elements
- User interaction testing
- Accessibility testing

- **CI/CD**: GitHub Actions runs tests automatically on every push and PR
- **Pre-commit Hooks**: Automated linting and quick tests before commits

For detailed testing documentation, see [TESTING.md](TESTING.md).

### Setting Up Development Environment

```bash
# Install Python dependencies
pip install -e .
pip install pytest pytest-cov pytest-mock

# Install frontend dependencies
cd web && npm install

# Install pre-commit hooks (optional but recommended)
pip install pre-commit
pre-commit install
```

## 🤝 Contributing
We welcome contributions!

We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.

### Quick Start for Contributors

1. **Fork and clone** the repository
2. **Set up development environment:**
```bash
pip install -e .
pip install pytest pytest-cov pytest-mock pre-commit
pre-commit install
```
3. **Create a feature branch:** `git checkout -b feature/your-feature`
4. **Make changes and add tests**
5. **Run tests:** `pytest` and `cd web && npm test`
6. **Submit a Pull Request**

### Branching Strategy
- main → The stable production-ready version of PlotSense.
- dev → Active development
- feature/<feature-name> → Branches for specific features (e.g., feature/ai-visualization-suggestions).
- `main` → Production-ready version
- `dev` → Active development
- `feature/<feature-name>` → New features
- `fix/<bug-name>` → Bug fixes

### 💡 How to Help
- 🐞 **Bug Reports** → GitHub Issues
- 💡 **Suggest features** → Open a discussion
- 🚀 **Submit PRs** → Fork → Branch → Test → Pull Request
- 🐞 **Bug Reports** → [Open an issue](https://github.com/PlotSenseAI/PlotSenseAI/issues/new?template=bug_report.md)
- 💡 **Feature Requests** → [Request a feature](https://github.com/PlotSenseAI/PlotSenseAI/issues/new?template=feature_request.md)
- ❓ **Questions** → [Ask a question](https://github.com/PlotSenseAI/PlotSenseAI/issues/new?template=question.md)
- 🚀 **Submit PRs** → See [CONTRIBUTING.md](CONTRIBUTING.md)

### 📅 Roadmap
- More model integrations
- Automated insight highlighting
- Jupyter widget support
- Features/target analysis
- More supported plots
- PlotSense web interface
- PlotSense customised notebook template

### 📥 Install or Update
``` bash
pip install --upgrade plotsense # Get the latest features!
```
## 🛡 License
MIT License (Open Source)
Apache License 2.0

## 🔐 API & Privacy Notes
- Your API key is securely held in memory for your current Python session.
Expand All @@ -146,3 +305,6 @@ MIT License (Open Source)

Let your data speak—with clarity, power, and PlotSense.
📊✨

## Your Feedback
[Feedback Form](https://forms.gle/QEjipzHiMagpAQU99)
10 changes: 9 additions & 1 deletion plotsense.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
LICENCE
NOTICE
README.md
pyproject.toml
setup.cfg
setup.py
plotsense/__init__.py
plotsense.egg-info/PKG-INFO
Expand All @@ -11,5 +14,10 @@ plotsense/explanations/__init__.py
plotsense/explanations/explanations.py
plotsense/plot_generator/__init__.py
plotsense/plot_generator/generator.py
plotsense/visual_suggestion/suggestions.py
plotsense/visual_suggestion/__init__.py
plotsense/visual_suggestion/suggestions.py
test/__init__.py
test/conftest.py
test/test_explanations.py
test/test_plotgen.py
test/test_suggestions.py
Loading