lk-inside 0.3.1

A terminal user interface (TUI) application for interactive data analysis.
Documentation
# Look Inside - Data Analysis TUI (Version 0.3.1)

## Introduction

Look Inside is a Terminal User Interface (TUI) application built with Rust, designed for interactive data analysis. It allows users to load datasets, perform various statistical analyses, filter data, and manage their workspace state directly from the command line. This version (0.3.1) focuses on providing a stable set of core data analysis features with a polished and responsive UI.

## Features

This application provides the following key functionalities:

*   **Data Loading**: Load datasets from CSV and JSON files. The application intelligently detects file formats based on extension.
*   **Statistical Analysis**: Access a suite of statistical tools including:
    *   Descriptive Statistics
    *   Null Value Analysis
    *   Histograms for numerical columns
*   **Interactive Data Filtering**: Apply sophisticated filters to your datasets based on column names, operators (==, !=, >, >=, <, <=), and values (numerical or string). The guided input system simplifies the filtering process.
*   **Workspace Management**: Save and load the entire application state (workspace), including loaded data, applied filters, and generated analysis results, for seamless continuation of work.
*   **Responsive & Themed TUI**: Built using `ratatui` with a consistent color theme and responsive layouts that adapt to various terminal sizes, providing a dynamic and interactive command-line experience.
*   **Enhanced Visualizations**: Heatmaps now feature improved color gradients.
*   **Interactive Input Fields**: Input fields provide clear visual feedback (highlighted borders, cursor positioning) when focused, enhancing user experience during data entry.
*   **Optimized Performance**: UI rendering is now optimized to minimize redraws, reducing flicker and improving responsiveness.

## Installation

To install and run Look Inside, you need to have Rust and Cargo installed on your system.

1.  **Clone the repository**:
    ```bash
    git clone https://github.com/your_repo/lk-inside.git # Replace with actual repo URL
    cd lk-inside
    ```
2.  **Build the project**:
    ```bash
    cargo build --release
    ```
3.  **Run the application**:
    ```bash
    cargo run --release
    ```

## Usage

Navigate through the application using your keyboard. The bottom bar provides context-sensitive help and keybindings for the current screen.

### Global Keybindings

These keybindings are active across most screens:

*   **`Alt+Q`**: Return to the Start Menu.
*   **`Ctrl+S`**: Navigate to the Save Workspace screen.
*   **`Ctrl+O`**: Navigate to the Load Workspace screen.
*   **`?`**: Toggle the Help screen (this documentation).
*   **`Esc`**: Exit the application.

### Screens Overview

#### Start Menu

The initial screen, offering main navigation options.

*   **Structure**: Four sections: Title (ASCII art), Description, Options list, and a Help Bar.
*   **Navigation**:
    *   **`↑↓`**: Navigate through menu items.
    *   **`Enter`**: Select a highlighted menu item (e.g., Load Data, Statistics, Filter, Exit).

#### Load Data Screen

Allows selection of a data file to load.

*   **Navigation**:
    *   **`↑↓←→`**: Navigate through files and directories.
    *   **`Enter`**: Select a file to load or enter a directory.
    *   **`Esc`**: Go back to the Start Menu.

#### Statistics View Screen

Displays various statistical analyses of your loaded dataset. Input fields will highlight when focused.

*   **Actions**:
    *   **`s`**: Generate Descriptive Statistics and Null Analysis. (Automatically attempts to generate a default histogram if applicable).
    *   **`u`**: Generate Null Analysis.
    *   **`h`**: Enter input mode for Histogram column selection.
    *   **`m`**: Enter input mode for Correlation Matrix column selection.
    *   **`a`**: For Anomaly Detection (WIP).
    *   **`c`**: Enter input mode for Clustering column selection.
*   **Input Modes (for h, m, a, c)**:
    *   **Any character**: Type input.
    *   **`Backspace`**: Delete character.
    *   **`Enter`**: Confirm input.
    *   **`Esc`**: Cancel input.

#### Filter View Screen

Guides you through applying filters to your data. Input fields will highlight when focused.

*   **Input Process**:
    *   **`f`**: Initiate the filtering process.
    *   **Step 1 - Column Selection**: Enter the column name you wish to filter by. The input field will be focused.
        *   **`Enter`**: Confirm column name and proceed to condition input.
        *   **`Esc`**: Cancel and return to normal mode.
    *   **Step 2 - Condition Input**: Enter the filter condition (e.g., `>10`, `=="text"`, `<5.5`). The input field will be focused.
        *   **`Enter`**: Apply the filter.
        *   **`Esc`**: Cancel condition input and return to normal mode.

#### Save State / Load State Screens

These screens allow you to save or load the application's current workspace. Input fields will highlight when focused.

*   **Navigation**: Accessible via global keybindings (`Ctrl+S` and `Ctrl+O`).
*   **Input Modes**: Follows standard input mode for file paths.
    *   **Any character**: Type file path.
    *   **`Backspace`**: Delete character.
    *   **`Enter`**: Confirm file path.
    *   **`Esc`**: Cancel input.

#### Help Screen

Provides context-sensitive keybinding information and general application help, now with improved readability and themed styling.

*   **Navigation**: Toggle with global `?` key.

## Project Structure

The project is organized into several directories, each with a specific purpose.

-   `src`: Contains all the source code for the application.
    -   `main.rs`: The entry point of the application.
    -   `lib.rs`: The main library crate.
    -   `analytics.rs`: Core analytics functions.
    -   `capture.rs`: Data capture and loading.
    -   `parser.rs`: Data parsing utilities.
    -   `analysis`: Statistical and data analysis modules.
        -   `filtering.rs`: Data filtering logic.
        -   `statistics.rs`: Statistical calculations.
    -   `data_core`: Core data handling and workspace management.
        -   `analyzer.rs`: Data analysis orchestration.
        -   `loader.rs`: Data loading mechanisms.
        -   `workspace.rs`: Workspace state management.
    -   `ui`: User interface components and screens.
        -   `components`: Reusable TUI components.
            -   `data_preview.rs`: Data preview widgets.
            -   `file_browser.rs`: File browser components.
            -   `help_bar.rs`: Help bar display.
            -   `input_widget.rs`: User input widgets.
            -   `stats_panel.rs`: Statistics display panel.
            -   `heatmap.rs`: Heatmap visualization component.
        -   `screens`: Different screens of the application.
            -   `filter_view_screen.rs`: Screen for data filtering.
            -   `help_screen.rs`: Help screen.
            -   `load_data_screen.rs`: Screen for loading data.
            -   `load_state_screen.rs`: Screen for loading workspace state.
            -   `save_screen.rs`: Screen for saving workspace state.
            -   `start_menu.rs`: The initial start menu.
            -   `statistics_screen.rs`: Screen for displaying statistics.
        -   `visualizations`: (Note: Components like heatmap and pie_chart are now directly under `components` for better reusability and explicit declaration.)
        -   `theme.rs`: Centralized theming constants and styles.
    -   `utils`: Utility modules.
        -   `config.rs`: Configuration handling.
-   `examples`: Sample data files for testing.
-   `config`: Default configuration files.
-   `tests`: Integration and unit tests.
-   `artifacts`: Build artifacts and other generated files.

## Work In Progress / Future Plans

-   **Pie Chart Visualization**: Planned for a future release to visualize categorical data distributions.
-   **Correlation Matrix**: Functionality is implemented and integrated into the Statistics View.
-   **Anomaly Detection**: Basic functionality present in Statistics View, but will be improved with more advanced algorithms and visualization.
-   **Clustering**: Basic K-Means implementation present in Statistics View, with plans for more clustering algorithms.
-   **Export Screen**: Functionality to export processed data to various formats.
-   **Further UI Enhancements**: Continuous improvements to table rendering, chart visualizations, and overall user feedback.

## Contributing

Please read `CONTRIBUTION.md` for details on our code of conduct, and the process for submitting pull requests to us.

## License

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