Skip to content

Convert JSON Data to a Clean UI using YAML configuration files

License

Notifications You must be signed in to change notification settings

ThatMattCat/TroubleSight

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TroubleSight Data-to-UI Explorer πŸ”Ž

A powerful, configuration-driven tool that transforms JSON data into interactive dashboards and visualizations. Upload your JSON files, define extraction rules, and instantly create queryable databases with beautiful UI components - all without writing code.

Python Streamlit License

πŸ“‹ Overview

TroubleSight is a flexible ETL (Extract, Transform, Load) and visualization platform that:

  • Extracts structured data from JSON files using configurable YAML rules
  • Transforms the data into SQLite database tables
  • Loads and displays the data through customizable dashboards
  • Visualizes results using various display formats (charts, metrics, tables)

Perfect for analyzing API responses, log files, configuration dumps, or any JSON-structured data.

✨ Features

Core Capabilities

  • πŸ“¦ Batch Processing: Upload multiple JSON files via ZIP archives
  • πŸ”§ Configuration-Driven: Define extraction rules and queries using simple YAML files
  • πŸ—„οΈ SQLite Backend: Automatic database creation and schema generation
  • πŸ“Š Multiple Visualizations: Tables, charts, metrics, and custom displays
  • πŸ” JSONPath Support: Powerful path expressions for complex data extraction
  • 🧹 Auto-Cleanup: Background process to manage temporary files
  • πŸ–₯️ Cross-Platform: Works on Windows, macOS, and Linux

Display Types

  • DataFrames: Interactive, sortable tables
  • Metrics: Single value displays with labels
  • Charts: Line, bar, and area charts
  • One-Row Rotate: Transposed single-row displays
  • HTML Tables: Static HTML-rendered tables
  • Custom Displays: Extensible display system

πŸš€ Quick Start

Prerequisites

  • Python 3.8 or higher
  • pip package manager

Installation

  1. Clone the repository
git clone https://github.com/ThatMattCat/TroubleSight.git
cd TroubleSight
  1. Create a virtual environment
python -m venv venv

# On Windows
venv\Scripts\activate

# On macOS/Linux
source venv/bin/activate
  1. Install dependencies
pip install -r requirements.txt
  1. Run the application
python main.py

The application will start and be available at http://localhost:8080

πŸ“– Usage Guide

Step 1: Prepare Your JSON Files

Place your JSON files in a ZIP archive. Example JSON structure:

{
  "service": "api-gateway",
  "metrics": [
    {
      "timestamp": "2025-01-15T00:00:00Z",
      "requests_per_second": 1250,
      "avg_latency_ms": 45
    }
  ]
}

Step 2: Define Extraction Rules

Create YAML files in the json2ui/extraction/ directory:

# extraction/api-metrics.yml
tables:
  api_metrics:
    file_pattern: "metrics.json"
    root_path: "$.metrics[*]"
    parentFields:
      - name: service_name
        path: "$.service"
        type: TEXT
    fields:
      - name: timestamp
        path: "$.timestamp"
        type: TEXT
      - name: requests_per_second
        path: "$.requests_per_second"
        type: INTEGER

Step 3: Create Query Tabs

Define queries and visualizations in json2ui/tabs/:

# tabs/1-Dashboard.yml
description: "API Performance Dashboard"
queries:
  πŸ“Š Traffic Overview:
    description: "Requests per second over time"
    sql: |
      SELECT timestamp, requests_per_second
      FROM api_metrics
      ORDER BY timestamp
    display:
      type: line_chart
      x: timestamp
      y: requests_per_second

Step 4: Upload and Analyze

  1. Start the application
  2. Upload your ZIP file (or use the provided example-json-files.zip for testing)
  3. Click "Process JSON Files"
  4. Navigate through the generated tabs to view your data

πŸ’‘ Tip: The project includes example JSON files in json2ui/examples/ to help you get started quickly!

πŸ—οΈ Project Structure

TroubleSight/
β”œβ”€β”€ main.py                      # Application manager
β”œβ”€β”€ requirements.txt             # Python dependencies
β”œβ”€β”€ json2ui/
β”‚   β”œβ”€β”€ J2UI.py                 # Main Streamlit application
β”‚   β”œβ”€β”€ extraction/             # JSON extraction configurations
β”‚   β”‚   β”œβ”€β”€ 01-servers.yaml
β”‚   β”‚   β”œβ”€β”€ 02-alerts.yaml
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ tabs/                   # Query and visualization configs
β”‚   β”‚   β”œβ”€β”€ 1-Dashboard-Overview.yaml
β”‚   β”‚   β”œβ”€β”€ 2-Server-Infrastructure.yml
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   β”œβ”€β”€ ConfigDrivenETL.py # ETL engine
β”‚   β”‚   └── FileCleaner.py     # Temporary file management
β”‚   β”œβ”€β”€ examples/               # Sample JSON files
β”‚   β”‚   β”œβ”€β”€ example-json-files/
β”‚   β”‚   └── example-json-files.zip
β”‚   β”œβ”€β”€ pages/                  # Additional Streamlit pages
β”‚   └── static/                 # Static assets
└── tmp/                        # Temporary file storage (created at runtime)

πŸ”§ Configuration Reference

Extraction Configuration

tables:
  table_name:
    file_pattern: "*.json"        # Glob pattern for matching files
    root_path: "$"                # JSONPath to data root
    parentFields:                 # Fields from parent context
      - name: field_name
        path: "$.path.to.field"
        type: TEXT
    fields:                       # Fields to extract
      - name: column_name
        path: "$.field_path"
        type: TEXT|INTEGER|REAL
        default: null             # Optional default value

Query Configuration

description: "Tab description"
queries:
  Query Name:
    description: "Query description"
    sql: |
      SELECT * FROM table_name
    display:
      type: dataframe|metric|line_chart|bar_chart
      x: column_name              # For charts
      y: column_name              # For charts
    post_processing:              # Optional transformations
      - type: rename_columns
        mapping:
          old_name: new_name

🎯 Use Cases

  • API Monitoring: Analyze API performance metrics and response data
  • Log Analysis: Extract and visualize structured log data
  • Configuration Management: Compare and track configuration changes
  • Test Results: Aggregate and report on test execution data
  • IoT Data: Process sensor readings and device telemetry
  • Business Intelligence: Transform JSON exports into dashboards

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

πŸ“§ Contact

Created by ThatMattCat


Note: This project includes sample data files in the examples directory to help you get started quickly. Run the examples to see the full capabilities of the system!

About

Convert JSON Data to a Clean UI using YAML configuration files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages