A lightweight data visualization tool that allows engineers and analysts to quickly retrieve data from PostgreSQL databases and generate visualizations using simple text prompts.
This tool was generated based on specific technical requirements to create a minimal, efficient data analysis and visualization interface. It combines a Flask backend with a Vue.js frontend to provide a straightforward way to query databases and visualize results.
- Simple Text-Based Interface: Enter SQL queries and visualization commands through a clean web interface
- Direct PostgreSQL Integration: Connect directly to PostgreSQL databases
- Multiple Visualization Types: Support for various chart types including:
- Line charts
- Bar charts
- Scatter plots
- Histograms
- Pie charts
- Real-Time Visualization: Instantly generate and display visualizations based on query results
- Error Handling: Clear error messages for invalid queries or visualization requests
This tool is designed for:
-
Data Analysts:
- Quick data exploration without writing visualization code
- Rapid prototyping of different visualization approaches
- Ad-hoc analysis of database contents
-
Engineers:
- Debugging data-related issues
- Monitoring data patterns
- Generating quick visualizations for reports
-
Database Administrators:
- Visualizing query results
- Analyzing data distributions
- Checking data relationships
project/
├── app.py # Flask backend application
├── requirements.txt # Python dependencies
├── .env.example # Example environment variables
├── .gitignore # Git ignore rules
├── templates/
│ └── index.html # Main HTML template
└── static/
└── app.js # Vue.js frontend application
- Python 3.x
- PostgreSQL database
- pip (Python package manager)
-
Clone the repository:
git clone <repository-url> cd <project-directory>
-
Create and activate a virtual environment (recommended):
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
cp .env.example .env
Edit
.envwith your actual credentials and configuration:# Database Configuration DB_HOST=your_actual_host DB_PORT=5432 DB_NAME=your_actual_database DB_USER=your_actual_username DB_PASSWORD=your_actual_password # Server Configuration SERVER_HOST=0.0.0.0 SERVER_PORT=5000 # OpenAI API Key OPENAI_API_KEY=your_openai_api_key- Default server configuration will run on all interfaces (0.0.0.0) on port 5000
- You can obtain an OpenAI API key from OpenAI's website
-
Start the Flask server:
python app.py
-
Access the application: Open your web browser and navigate to:
http://localhost:5000
Enter your request in natural language in the prompt field. Describe the data you want to retrieve and how you want it visualized.
Example Prompts:
- "Show me a bar chart of total sales per region for the last quarter."
- "Plot a line graph of daily active users over the past month."
- "Visualize the distribution of order amounts with a histogram."
- Enter your natural language prompt.
- Click "Generate Visualization".
- View the result below the form.
Warning: Executing code generated from natural language prompts can pose significant security risks. This tool is intended for use in secure, controlled environments. Do not expose this functionality to untrusted users or over the internet without proper security measures.
- The application attempts to mitigate risks by restricting available functions during code execution.
- Despite precautions, there is still potential for malicious code execution.
- Only supports PostgreSQL databases
- Limited to static visualizations
- Basic styling and formatting options
- No data export features
- No interactive visualization features
This project was generated based on specific requirements focusing on:
- Minimal file structure
- Simple user interface
- Core functionality without unnecessary complexity
- Easy setup and deployment
While this is primarily a demonstration project, contributions are welcome:
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is open-source and available under the MIT License.
This project was generated based on specific technical requirements outlined in the task documentation, with a focus on simplicity and functionality for data analysis needs.
