# anika-roy/legal-database-analysis architecture

> Architecture diagram of the GitHub repository anika-roy/legal-database-analysis, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/anika-roy/legal-database-analysis
- Repository: https://github.com/anika-roy/legal-database-analysis

## Overview

##### Main Components
- Data Source: Represent the legal database CSV files as an external source (since the CSVs are not stored locally, reference the external links mentioned in the README). Although they’re not in the repository, include them as an essential part of the workflow.
- Classification Module: Represent the “classification” directory with two notebooks:
- One for traditional machine learning models (trad-ml-models.ipynb)
- One for the neural network approach (neural-network.ipynb)
- Visualization/Plots Layer: Include the “plots” directory with its subfolders (insight_1, insight_2, insight_3) where all images generated from the notebooks are stored. This shows the output visualization component.

##### Relationships and Interactions
- Analysis to Visualization: From each “insight” notebook, indicate output flows that generate plots (save a copy into their respective subfolders in the “plots” directory).

##### Architectural Patterns and Design Principles
- Separation of Concerns: The division into analysis and classification ensures that each notebook runs its part independently. This minimizes cascading errors and simplifies parallel execution.
- Modularity: Emphasize that the notebooks are self-contained (each analysis or ML routine is in its own file), making the system resilient and easier to maintain.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Legal CSV Data (External)"]:::external

    subgraph "Data Analysis (EDA)"
        A1["Insight 1 Notebook"]:::analysis
        A2["Insight 2 Notebook"]:::analysis
        A3["Insight 3 Notebook"]:::analysis
    end

    F["Extracted Features"]:::feature

    subgraph "Classification"
        C1["Traditional ML Notebook"]:::classification
        C2["Neural Network Notebook"]:::classification
    end

    subgraph "Visualization/Plots"
        P1["Plots Insight 1"]:::visualization
        P2["Plots Insight 2"]:::visualization
        P3["Plots Insight 3"]:::visualization
    end

    D["External Libraries/Dependencies"]:::dependencies

    %% Data flow from external CSV data to analysis notebooks
    A --> A1
    A --> A2
    A --> A3

    %% Analysis notebooks generate visualizations
    A1 --> P1
    A2 --> P2
    A3 --> P3

    %% Analysis outputs feed into feature extraction
    A1 --> F
    A2 --> F
    A3 --> F

    %% Dotted flow from extracted features to classification notebooks
    F -.-> C1
    F -.-> C2

    %% External libraries support analysis and classification
    D -.-> A1
    D -.-> A2
    D -.-> A3
    D -.-> C1
    D -.-> C2

    %% Click Events for Component Mapping
    click A1 "https://github.com/anika-roy/legal-database-analysis/blob/main/analysis/insight_1.ipynb"
    click A2 "https://github.com/anika-roy/legal-database-analysis/blob/main/analysis/insight_2.ipynb"
    click A3 "https://github.com/anika-roy/legal-database-analysis/blob/main/analysis/insight_3.ipynb"
    click C1 "https://github.com/anika-roy/legal-database-analysis/blob/main/classification/trad-ml-models.ipynb"
    click C2 "https://github.com/anika-roy/legal-database-analysis/blob/main/classification/neural-network.ipynb"
    click P1 "https://github.com/anika-roy/legal-database-analysis/tree/main/plots/insight_1"
    click P2 "https://github.com/anika-roy/legal-database-analysis/tree/main/plots/insight_2"
    click P3 "https://github.com/anika-roy/legal-database-analysis/tree/main/plots/insight_3"

    %% Style definitions
    classDef external fill:#ccf,stroke:#33f,stroke-width:2px;
    classDef analysis fill:#cfc,stroke:#393,stroke-width:2px;
    classDef classification fill:#ff9,stroke:#990,stroke-width:2px;
    classDef visualization fill:#f9c,stroke:#d96,stroke-width:2px;
    classDef dependencies fill:#eee,stroke:#999,stroke-width:2px;
    classDef feature fill:#e9e9ff,stroke:#888,stroke-width:2px;
```
