# danieljohnevans/vt-elastic architecture

> Architecture diagram of the GitHub repository danieljohnevans/vt-elastic, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/danieljohnevans/vt-elastic
- Repository: https://github.com/danieljohnevans/vt-elastic

## Overview

##### Project type and purpose
- This is a full-stack web application (“vt-elastic”) built with Python 3.11 and Flask 3.0, using Elasticsearch 8.12 as its search/index backend.
- It serves a templated site (HTML/CSS/JS) to users and supports full-text search via Elasticsearch. A set of command-line scripts handle ingestion, indexing, and data preparation.

##### File structure
- Top level:
- app.py, wsgi.py: Flask application entrypoints
- search.py, combine_json.py: application utilities
- Dockerfile, entrypoint.sh, gunicorn_config.py: deployment configs
- requirements.txt, .flaskenv: environment and dependency specs
- static/, templates/: frontend assets and Jinja templates
- scripts/:
- scripts/ingest.py, create_map.py, distribute_files.py: data-pipeline steps for pushing content into Elasticsearch
- scripts/vt/elastic.py: wraps Elasticsearch operations
- YAML files (ingest_job.yaml, taiga-busybox.yaml): Kubernetes job definitions or Kubernetes-style configs
- This layout suggests:
- A presentation layer (templates + static assets)
- A web service layer (Flask app + Gunicorn/WGSI)
- A search/index layer (Elasticsearch cluster)
- A batch-ingest/ETL pipeline (scripts directory)

##### README for additional insights
- Minimal instructions: “pip install”, “flask reindex”, “flask --app app run” or “gunicorn …”

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Clients Layer
    subgraph "Clients / Users"
        direction TB
        Browser["Client (Browser)"]:::frontend
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        Static["static/"]:::frontend
        Templates["templates/"]:::frontend
    end

    %% Web Service Container
    subgraph "Web Service Container"
        direction TB
        Docker["Docker Container"]:::deployment
        Dockerfile["Dockerfile"]:::deployment
        Env[".flaskenv"]:::deployment
        ReqWeb["requirements.txt"]:::deployment
        ReqScripts["scripts/requirements.txt"]:::deployment
        Entrypoint["entrypoint.sh"]:::deployment
        Gunicorn["gunicorn_config.py"]:::deployment
        FlaskApp["app.py"]:::application
        SearchMod["search.py"]:::application
        CombineJSON["combine_json.py"]:::application
        WSGI["wsgi.py"]:::application

        Docker --> Entrypoint
        Docker --> Dockerfile
        Docker --> Env
        Docker --> ReqWeb
        Docker --> ReqScripts
        Entrypoint --> Gunicorn
        Gunicorn --> WSGI
        Gunicorn --> FlaskApp
        FlaskApp --> SearchMod
        FlaskApp --> CombineJSON
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        ESCluster["Elasticsearch Cluster"]:::data
        ESWrapper["scripts/vt/elastic.py"]:::application
        SearchMod --> ESWrapper
        ESWrapper --> ESCluster
    end

    %% ETL / Batch Pipeline
    subgraph "ETL / Batch Pipeline"
        direction TB
        IngestScript["scripts/ingest.py"]:::etl
        CreateMap["scripts/create_map.py"]:::etl
        Distribute["scripts/distribute_files.py"]:::etl
        JobYAML["scripts/ingest_job.yaml"]:::etl
        BusyboxYAML["scripts/taiga-busybox.yaml"]:::etl

        Distribute --> IngestScript
        CreateMap --> IngestScript
        IngestScript --> ESCluster
        JobYAML --> IngestScript
        BusyboxYAML --> IngestScript
    end

    %% Interactions
    Browser --> Static
    Browser --> Templates
    Browser -->|"HTTP GET/POST"| FlaskApp
    FlaskApp -->|"Render Templates"| Templates
    FlaskApp -->|"Serve Static"| Static
    FlaskApp -->|"Elasticsearch Query (JSON)"| ESCluster

    %% Click Events
    click Static "https://github.com/danieljohnevans/vt-elastic/tree/main/static/"
    click Templates "https://github.com/danieljohnevans/vt-elastic/tree/main/templates/"
    click FlaskApp "https://github.com/danieljohnevans/vt-elastic/blob/main/app.py"
    click SearchMod "https://github.com/danieljohnevans/vt-elastic/blob/main/search.py"
    click CombineJSON "https://github.com/danieljohnevans/vt-elastic/blob/main/combine_json.py"
    click WSGI "https://github.com/danieljohnevans/vt-elastic/blob/main/wsgi.py"
    click ESWrapper "https://github.com/danieljohnevans/vt-elastic/blob/main/scripts/vt/elastic.py"
    click IngestScript "https://github.com/danieljohnevans/vt-elastic/blob/main/scripts/ingest.py"
    click CreateMap "https://github.com/danieljohnevans/vt-elastic/blob/main/scripts/create_map.py"
    click Distribute "https://github.com/danieljohnevans/vt-elastic/blob/main/scripts/distribute_files.py"
    click JobYAML "https://github.com/danieljohnevans/vt-elastic/blob/main/scripts/ingest_job.yaml"
    click BusyboxYAML "https://github.com/danieljohnevans/vt-elastic/blob/main/scripts/taiga-busybox.yaml"
    click Dockerfile "https://github.com/danieljohnevans/vt-elastic/tree/main/Dockerfile"
    click Entrypoint "https://github.com/danieljohnevans/vt-elastic/blob/main/entrypoint.sh"
    click Gunicorn "https://github.com/danieljohnevans/vt-elastic/blob/main/gunicorn_config.py"
    click ReqWeb "https://github.com/danieljohnevans/vt-elastic/blob/main/requirements.txt"
    click ReqScripts "https://github.com/danieljohnevans/vt-elastic/blob/main/scripts/requirements.txt"
    click Env "https://github.com/danieljohnevans/vt-elastic/blob/main/.flaskenv"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#339,stroke-width:1px;
    classDef application fill:#d4edda,stroke:#2a5,stroke-width:1px;
    classDef data fill:#ffe5b4,stroke:#e68a00,stroke-width:1px;
    classDef etl fill:#e2e3e5,stroke:#999,stroke-width:1px;
    classDef deployment fill:#f0e6ff,stroke:#7030a0,stroke-width:1px;
```
