U_Agentix Data Explorer Extension
Interactive data analysis and visualization VS Code extension for PostgreSQL, MongoDB, and CSV files.
Overview
The U_Agentix Data Explorer Extension provides a comprehensive data analysis toolkit directly within VS Code. It enables data analysts and developers to explore databases, visualize data, and validate CSV files without leaving their development environment.
Features
Database Explorer
- PostgreSQL Integration: Connect to PostgreSQL databases, browse tables, view schemas
- MongoDB Integration: Connect to MongoDB, browse collections, query documents
- Visual Query Builder: Build SQL queries with autocomplete and syntax highlighting
- Schema Visualization: View table relationships and database structure
- Export Data: Export query results to CSV, JSON, or Excel formats
Chart Builder
- Multiple Chart Types: Create line, bar, pie, and scatter charts
- Battle Performance Charts: Visualize agent battle performance over time
- User Engagement Graphs: Track user activity and engagement metrics
- Revenue Analytics: Analyze revenue trends and patterns
- Interactive Charts: Powered by Chart.js with responsive design
CSV Operations
- Import Historical Data: Load CSV files into databases
- Data Cleaning Tools: Remove duplicates, handle missing values, standardize formats
- Merge Datasets: Combine multiple CSV files
- Data Validation: Check data quality and integrity
- Preview Mode: View CSV data before importing
Installation
Prerequisites
- VS Code 1.85.0 or higher
- Node.js 18.0 or higher
- PostgreSQL 14+ (optional)
- MongoDB 6+ (optional)
Install from VSIX
- Download the latest
.vsix file from releases
- Open VS Code
- Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
- Click "..." menu → "Install from VSIX..."
- Select the downloaded file
Install from Marketplace
# Search for "U_Agentix Data Explorer" in VS Code Extensions Marketplace
# Click Install
Build from Source
# Clone repository
git clone https://github.com/u-agentix/data-explorer-extension.git
cd u-agentix-data-explorer-extension
# Install dependencies
npm install
# Build extension
npm run compile
# Package extension (optional)
npm run package
Configuration
Database Connection Settings
Access settings via File → Preferences → Settings → Extensions → Data Explorer
{
"dataExplorer.postgres.defaultHost": "localhost",
"dataExplorer.postgres.defaultPort": 5432,
"dataExplorer.mongodb.defaultHost": "localhost",
"dataExplorer.mongodb.defaultPort": 27017,
"dataExplorer.query.maxRows": 1000,
"dataExplorer.query.timeout": 30000,
"dataExplorer.csv.maxFileSize": 104857600,
"dataExplorer.cache.enabled": true,
"dataExplorer.cache.ttl": 300000
}
PostgreSQL Connection
- Click the Database icon in the sidebar
- Click "Connect to PostgreSQL"
- Enter connection details:
- Host: localhost
- Port: 5432
- Database: u_agentix
- User: postgres
- Password: your_password
MongoDB Connection
- Click the Database icon in the sidebar
- Click "Connect to MongoDB"
- Enter connection URI:
mongodb://localhost:27017/u_agentix_battles
Usage Guide
Querying Databases
Open Query Editor
- Click "Open Query Editor" in the Saved Queries panel
- Write your SQL query:
SELECT * FROM users_progress
WHERE lessons_completed > 10
ORDER BY total_score DESC
LIMIT 100;
- Click "Execute" or press Ctrl+Enter
- View results in the data table
Browse Tables
- Expand PostgreSQL or MongoDB connection in sidebar
- See all available tables/collections
- Right-click a table → "Open Query Editor" for quick queries
- Right-click a table → "Export Data" to export entire table
Creating Charts
From Query Results
- Execute a query that returns numerical data
- Click "Create Chart" button in results panel
- Select chart type (line, bar, pie, scatter)
- Configure axes and labels
- View interactive chart
// Query battle data
SELECT
DATE(created_at) as date,
AVG(win_rate) as avg_win_rate,
COUNT(*) as battles
FROM agent_battle_results
WHERE created_at >= NOW() - INTERVAL '30 days'
GROUP BY DATE(created_at)
ORDER BY date;
// Create line chart showing win rate trend
CSV Operations
Import CSV File
- Click "Import CSV" in the Data Explorer panel
- Select CSV file from your computer
- Preview data in import wizard:
- View first 100 rows
- Check column types
- See data quality warnings
- Configure import options:
- Target table name
- Skip duplicates
- Create new table if needed
- Click "Import to Database"
- Wait for import completion
Validate CSV Data
- Click "Validate CSV Data"
- Select CSV file
- View validation report:
- Schema consistency check
- Missing value detection
- Duplicate header warnings
- Data type validation
- Fix issues and re-validate
Merge CSV Files
- Select multiple CSV files
- Click "Merge Datasets"
- Choose merge strategy:
- Append rows (union)
- Join on key column
- Specify output file path
- Review merged data
Database Schemas
PostgreSQL Tables
users_progress
CREATE TABLE users_progress (
id SERIAL PRIMARY KEY,
user_id VARCHAR(255) UNIQUE NOT NULL,
lessons_completed INTEGER DEFAULT 0,
total_score INTEGER DEFAULT 0,
achievements JSONB DEFAULT '[]',
current_level INTEGER DEFAULT 1,
last_active TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
lesson_completions
CREATE TABLE lesson_completions (
id SERIAL PRIMARY KEY,
user_id VARCHAR(255) NOT NULL,
lesson_id VARCHAR(255) NOT NULL,
completed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
time_spent INTEGER,
score INTEGER,
perfect_score BOOLEAN DEFAULT false,
UNIQUE(user_id, lesson_id)
);
agent_battle_results
CREATE TABLE agent_battle_results (
id SERIAL PRIMARY KEY,
battle_id VARCHAR(255) NOT NULL,
user_id VARCHAR(255) NOT NULL,
agent_name VARCHAR(255) NOT NULL,
opponent_name VARCHAR(255) NOT NULL,
result VARCHAR(50),
profit_loss DECIMAL(10,2),
win_rate DECIMAL(5,2),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
MongoDB Collections
battles
{
_id: ObjectId,
battleId: String,
userId: String,
agents: [{
agentId: String,
agentName: String,
position: Number
}],
status: String, // "pending", "in_progress", "completed"
startTime: Date,
endTime: Date,
winner: String,
results: {
totalTrades: Number,
profitLoss: Number,
winRate: Number,
sharpeRatio: Number,
maxDrawdown: Number
},
createdAt: Date,
updatedAt: Date
}
MCP Integration
The extension integrates with U_Agentix MCPs:
Data Ops MCP
- Database queries
- User progress tracking
- Battle data retrieval
Analytics MCP
- ML model access
- Performance metrics
- Churn prediction
Redis MCP
- Query result caching
- Real-time data updates
Examples
Example 1: Analyze User Engagement
-- Get top 10 most engaged users
SELECT
user_id,
lessons_completed,
total_score,
EXTRACT(DAY FROM NOW() - last_active) as days_inactive
FROM users_progress
ORDER BY total_score DESC
LIMIT 10;
Create a bar chart showing top users by score.
-- Agent win rates over last 30 days
SELECT
agent_name,
COUNT(*) as total_battles,
SUM(CASE WHEN result = 'win' THEN 1 ELSE 0 END) as wins,
ROUND(100.0 * SUM(CASE WHEN result = 'win' THEN 1 ELSE 0 END) / COUNT(*), 2) as win_rate
FROM agent_battle_results
WHERE created_at >= NOW() - INTERVAL '30 days'
GROUP BY agent_name
ORDER BY win_rate DESC;
Example 3: CSV Import - Historical Market Data
Download market data CSV:
date,open,high,low,close,volume
2025-01-01,100.50,102.30,99.80,101.75,1000000
2025-01-02,101.75,103.50,101.20,103.00,1200000
Import via extension
Query imported data:
SELECT * FROM market_data
WHERE date >= '2025-01-01'
ORDER BY date DESC;
Keyboard Shortcuts
Ctrl+Shift+D (Cmd+Shift+D on Mac): Open Data Explorer
Ctrl+Enter: Execute current query
Ctrl+S: Save query
Ctrl+Shift+E: Export current results
Ctrl+Shift+C: Create chart from results
Troubleshooting
Cannot Connect to PostgreSQL
Issue: "Failed to connect: Connection refused"
Solutions:
- Verify PostgreSQL is running:
psql -U postgres -c "SELECT 1"
- Check host and port are correct
- Ensure firewall allows connections
- Verify credentials are correct
MongoDB Connection Timeout
Issue: "MongoDB connection timeout"
Solutions:
- Check MongoDB is running:
mongosh --eval "db.version()"
- Verify connection URI is correct
- Check network connectivity
- Ensure MongoDB is accepting connections
CSV Import Failed
Issue: "CSV import validation failed"
Solutions:
- Check CSV file format (UTF-8 encoding)
- Ensure headers are present
- Verify no duplicate column names
- Check file size is within limit (100MB default)
Query Timeout
Issue: "Query exceeded timeout"
Solutions:
- Increase timeout in settings
- Optimize query with indexes
- Add LIMIT clause to large queries
- Use pagination for large datasets
Query Optimization
Use LIMIT: Always limit large result sets
SELECT * FROM large_table LIMIT 100;
Create Indexes: Index frequently queried columns
CREATE INDEX idx_user_id ON users_progress(user_id);
Use Pagination: For large datasets
SELECT * FROM battles LIMIT 100 OFFSET 0;
Caching
- Enable query result caching in settings
- Cached results expire after 5 minutes (default)
- Clear cache to see latest data
CSV Operations
- Keep files under 100MB for best performance
- Use data cleaning before import
- Validate data before importing large files
Development
Build Extension
npm install
npm run compile
Watch Mode
npm run watch
Run Tests
npm test
Package Extension
npm run package
Architecture
src/
├── extension.ts # Main entry point
├── providers/
│ ├── postgresProvider.ts # PostgreSQL connection
│ ├── mongoProvider.ts # MongoDB connection
│ ├── csvProvider.ts # CSV operations
│ └── databaseTreeProvider.ts # Tree view
├── services/
│ ├── queryExecutor.ts # Query execution
│ ├── chartService.ts # Chart creation
│ └── dataValidator.ts # Data validation
├── models/
│ ├── queryResult.ts # Query result model
│ └── dataset.ts # Dataset model
└── utils/
├── sqlBuilder.ts # SQL query builder
├── dataTransformer.ts # Data transformation
└── logger.ts # Logging utility
Contributing
- Fork the repository
- Create feature branch
- Make changes
- Add tests
- Submit pull request
License
Proprietary License — All Rights Reserved. See LICENSE file.
Support
- Documentation: See MCP_VSCODE_ENHANCEMENT_ANALYSIS.md
- Issues: GitHub Issues
- Contact: U_Agentix Spec Team
Version History
1.0.0 (2025-10-18)
- Initial release
- PostgreSQL and MongoDB support
- CSV import/export
- Chart visualization
- ML model integration
- Data validation
- Query builder
- 20+ comprehensive tests
Credits
Built by the U_Agentix Spec Team - Backend Developer
Powered by Chart.js, PostgreSQL, MongoDB, and csv-parse
U_Agentix Data Explorer - Interactive data analysis for developers