# jlnetosci/astra architecture

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

- Interactive diagram: https://gitdiagram.com/jlnetosci/astra
- Repository: https://github.com/jlnetosci/astra

## Overview

##### Project type and purpose
- ASTRAviewer is a **Streamlit-based web application** for visualizing family trees (GEDCOM files) as 2D or 3D network “star maps.”
- It loads GEDCOM files (either uploaded by users or from the sample `gedcom_files/` folder), parses them into a graph, and renders interactive visualizations in the browser.

##### File structure
- **Top-level files**
- `app.py` – main Streamlit app entry point
- `Dockerfile`, `.streamlit/config.toml`, `requirements.txt` – containerization and config
- `README.md`, `CHANGELOG.md`, `LICENSE` – documentation and metadata
- **Directories**
- `pages/` – Streamlit multipage modules (contact-form, faq, instructions)
- `gedcom_files/` – sample GEDCOM datasets, organized into subfolders
- `img/` – static assets (logo, palette previews, example screenshots)
- There is **no external database**—all parsing and visualization are in-memory on the Python backend.

##### README for additional insights
- **Visualization engines**:
- 2D uses a physics simulation (likely networkx + vis.js)
- 3D uses a static layout + WebGL rotation/zoom

##### Main components & interactions
a. **User (Browser)**
- Interacts via HTTP to the Streamlit server, uploads files, clicks buttons, and views canvases.
b. **Streamlit App Server**
- **app.py + pages/** – renders UI, handles routing between pages.
- **File Upload Handler** – accepts GEDCOM files from users.
- **GEDCOM Parser Module** – reads `.ged` files into an internal graph representation (e.g., via a GEDCOM-parsing library).
- **Graph Processing / Layout Engine** – builds nodes/edges, computes 2D physics layout or 3D coordinates.
- **Visualization Renderer** – outputs interactive network visuals (e.g., via vis.js embed or Plotly).
c. **Static Assets**
- `img/` provides logos and example images used in the UI.
- `gedcom_files/` supplies built-in sample files that can be loaded without upload.
d. **Container & Deployment**
- Docker container (via `Dockerfile`) hosting a Python runtime with dependencies from `requirements.txt`.
- `.streamlit/config.toml` configures server port, credentials, and UI theming.

##### Architectural patterns & design principles
- **Client-Server (Browser ↔ Streamlit)**: all UI and business logic run on the server; the browser is a thin client.
- **Modular multipage design**: Streamlit’s pages/ directory partitions UI concerns (FAQ, Contact, Instructions, main viewer).
- **Event-driven UI**: user actions (file upload, button click, dropdown changes) trigger re-runs of Streamlit scripts.
- **In-memory processing**: no persistence layer—graphs exist only during session.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Tier
    Browser["Browser UI"]:::client

    %% Streamlit Server Tier
    subgraph "Streamlit Server" 
        direction TB
        App["app.py<br/>(Entry Point)"]:::server
        PagesContact["contact-form.py"]:::server
        PagesFAQ["faq.py"]:::server
        PagesInstr["instructions.py"]:::server
        Upload["File Upload Handler"]:::server
        Parser["GEDCOM Parser Module"]:::server
        Processor["Graph Processing & Layout Engine"]:::server
        Renderer["Visualization Renderer"]:::server
    end

    %% Static Assets Tier
    subgraph "Static Assets" 
        direction TB
        Samples["Sample GEDCOMs"]:::storage
        Images["Image Assets (logo, previews)"]:::storage
    end

    %% Documentation Tier
    subgraph "Documentation & Metadata"
        direction TB
        Readme["README.md"]:::docs
        Changelog["CHANGELOG.md"]:::docs
        License["LICENSE"]:::docs
    end

    %% Container & Deployment Tier
    subgraph "Container & Deployment"
        direction TB
        DockerfileNode["Dockerfile"]:::container
        Requirements["requirements.txt"]:::container
        Config[".streamlit/config.toml"]:::container
    end

    %% Connections
    Browser -->|"Upload GEDCOM"| Upload
    Browser -->|"Load Sample"| Samples
    Upload -->|"GEDCOM file"| Parser
    Samples -->|"GEDCOM file"| Parser
    Parser -->|"Graph model"| Processor
    Processor -->|"2D/3D coordinates"| Renderer
    Renderer -->|"HTML/JS network"| Browser
    DockerfileNode -->|hosts| App
    Requirements -->|dependencies| App
    Config -->|configures| App
    App --> PagesContact
    App --> PagesFAQ
    App --> PagesInstr
    Samples -->|read-only| App
    Images -->|served to UI| App
    Readme -->|documentation| App
    Changelog -->|changelog| App
    License -->|license| App

    %% Click Events
    click App "https://github.com/jlnetosci/astra/blob/main/app.py"
    click PagesContact "https://github.com/jlnetosci/astra/blob/main/pages/contact-form.py"
    click PagesFAQ "https://github.com/jlnetosci/astra/blob/main/pages/faq.py"
    click PagesInstr "https://github.com/jlnetosci/astra/blob/main/pages/instructions.py"
    click Samples "https://github.com/jlnetosci/astra/tree/main/gedcom_files/"
    click Images "https://github.com/jlnetosci/astra/tree/main/img/"
    click Readme "https://github.com/jlnetosci/astra/blob/main/README.md"
    click Changelog "https://github.com/jlnetosci/astra/blob/main/CHANGELOG.md"
    click License "https://github.com/jlnetosci/astra/tree/main/LICENSE"
    click DockerfileNode "https://github.com/jlnetosci/astra/tree/main/Dockerfile"
    click Requirements "https://github.com/jlnetosci/astra/blob/main/requirements.txt"
    click Config "https://github.com/jlnetosci/astra/blob/main/.streamlit/config.toml"

    %% Styles
    classDef client fill:#ADD8E6,stroke:#000,color:#000
    classDef server fill:#98FB98,stroke:#000,color:#000
    classDef storage fill:#D3D3D3,stroke:#000,color:#000
    classDef docs fill:#E6E6FA,stroke:#000,color:#000
    classDef container fill:#FFA500,stroke:#000,color:#000
```
