# jzsmoreno/pyorchdb architecture

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

- Interactive diagram: https://gitdiagram.com/jzsmoreno/pyorchdb
- Repository: https://github.com/jzsmoreno/pyorchdb

## Overview

##### Main Components
- ETL Orchestration Core – Represented by the PyOrchDB package (the “PyOrchDB” directory, notably main.py and utility modules) that includes configuration files (catalog.py, config_data.yml, table_names.yml) and common tools.
- Job Execution and Pipelines – Found in the “src” directory which contains:
– Job scripts (inside src/jobs) such as pipeline_job.yml, job_workflow.py, ml_complete_job.py, upload_model.py, and experiment_job.yml. These are the components responsible for launching or coordinating ETL tasks.
– The central pipeline definition (pipeline.py) which likely glues the workflows together.
– Infrastructure and application templates (under src/templates) that manage resource creation, deletion, or configuration (e.g., infra_template.json, func_template.json).
– Supporting scripts, including PowerShell scripts (run.ps1, run_template_infra.ps1) that kick off processes.
- Configuration and Deployment – The project includes multiple Dockerfiles (one in the top-level directory and one in src) and configuration files (config.yml in src, requirements.txt at multiple levels) to ensure the environments are reproducible.
- Logging and Monitoring – A “logs” directory indicates that logging is captured, and it even provides a README to clarify its purpose.
- External Services and Azure Components – As detailed in the README, the system interacts with:
– An Azure Storage account (with a “landing zone” for data, including raw and processed data).
– An Azure SQL Server database where processed (parquet) data is loaded.
– Azure Machine Learning for running some of the ETL processes or experiments.
- Developer/CI Integration – GitHub Actions workflows (in .github) for code-quality and release management.

##### Relationships and Interactions
- The ETL Core (PyOrchDB) acts as the orchestrator of the data pipeline, reading configurations from YAML files and invoking utility functions.
- The “src” module contains the job definitions and the pipeline, which use both local scripts and Azure resources. Data flows from the Storage account through the transformation processes defined in the pipeline and then into the SQL database.
- PowerShell scripts (run.ps1, run_template_infra.ps1) take in parameters and coordinate the setup and execution steps – these scripts directly interface with the Azure CLI and set up the necessary cloud resources.
- Dockerfiles indicate the possibility of packaging the solution for isolation or deployment, with dependencies outlined in requirements.txt.

##### Architectural Patterns and Design Principles
- Separation of Concerns – The project is clearly partitioned between infrastructure deployment, ETL processing, and job orchestration.
- Hybrid Processing – There is a clear division between processes that run locally (Python scripts, PowerShell, Docker) and those managed via Azure ML.
- Modularity – Jobs are grouped in the “jobs” folder and templates in “templates,” making it straightforward to add or modify ETL steps independently.
- Declarative Infrastructure – YAML templates and resource definitions (as seen with .yml files in both jobs and templates) are used to define and automate resource creation.

##### Relevant Technologies and Tools
- Python – For orchestrating ETL workflows and utility operations.
- YAML Configuration Files – To specify job parameters and infrastructure settings.
- Docker – To containerize the environment (ensuring consistent CLI and Python versions).
- Azure CLI/Azure ML – For managing and executing the cloud-based parts of the ETL.
- PowerShell Scripts – For local orchestration and for interfacing with Azure CLI commands.
- GitHub Actions – For CI/CD workflows including code quality checks and releases.

##### Specific Elements
- “ETL Orchestration Core (PyOrchDB)”
- “Job Definitions & Pipeline (src/jobs & pipeline.py)”
- “Infrastructure Templates (src/templates & run.ps1)”
- “Data Sources: Azure Storage Account (Raw & Processed Data)”
- “Data Sink: Azure SQL Server Database”
- “Azure ML for Managed Processes”
- From Storage (raw data) towards ETL processes.
- From ETL processes towards data transformations and finally insertion into SQL.
- Bi-directional interactions when applicable (e.g., configuration feedback loops).
- Local components (e.g., Python scripts, Docker containers) vs. Cloud components (Azure Storage, SQL, ML)
- Configuration and deployment scripts vs. runtime job pipelines.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Azure Cloud Infrastructure"
        A1["Azure Storage (Raw & Processed Data)"]:::cloud
        A2["Azure SQL Database"]:::cloud
        A3["Azure ML (Managed Processes)"]:::cloud
    end

    subgraph "Local Processing"
        B1["ETL Orchestration Core (PyOrchDB)"]:::local
        B2["ETL Utilities"]:::local
        B3["Job Execution & Pipelines (src/jobs)"]:::local
        B4["Central Pipeline (src/pipeline.py)"]:::local
        B5["Infrastructure Deployment (src/templates & run.ps1)"]:::local
        B6["Configuration & Environment Setup (Docker, config, requirements)"]:::local
        B7["Logging & Monitoring (logs)"]:::local
        B8["Developer/CI Integration (.github)"]:::local
    end

    %% Data Flow between Cloud and Local components
    A1 -->|"Ingest"| B1
    B1 -->|"OrchestratesETL"| B3
    B4 -->|"DefinesWorkflow"| B3
    B3 -->|"LoadData"| A2
    B3 -->|"InvokeML"| A3
    B1 -->|"SendsLogs"| B7

    %% Infrastructure Deployment interactions
    B5 -->|"Deploys"| A1
    B5 -->|"Deploys"| A2
    B5 -->|"Deploys"| A3

    %% Configuration support for local processing
    B6 -->|"Configures"| B1
    B6 -->|"Configures"| B3

    %% Utility and CI/CD support
    B2 -->|"Supports"| B1
    B8 -->|"CI/CD"| B1
    B8 -->|"CI/CD"| B5

    %% Click Events for component mapping
    click B1 "https://github.com/jzsmoreno/pyorchdb/blob/main/PyOrchDB/main.py"
    click B2 "https://github.com/jzsmoreno/pyorchdb/tree/main/PyOrchDB/utilities"
    click B3 "https://github.com/jzsmoreno/pyorchdb/tree/main/src/jobs"
    click B4 "https://github.com/jzsmoreno/pyorchdb/blob/main/src/pipeline.py"
    click B5 "https://github.com/jzsmoreno/pyorchdb/tree/main/src/templates"
    click B5 "https://github.com/jzsmoreno/pyorchdb/blob/main/src/run.ps1"
    click B6 "https://github.com/jzsmoreno/pyorchdb/tree/main/Dockerfile"
    click B6 "https://github.com/jzsmoreno/pyorchdb/tree/main/src/Dockerfile"
    click B6 "https://github.com/jzsmoreno/pyorchdb/blob/main/src/config.yml"
    click B6 "https://github.com/jzsmoreno/pyorchdb/blob/main/requirements.txt"
    click B7 "https://github.com/jzsmoreno/pyorchdb/tree/main/logs"
    click B8 "https://github.com/jzsmoreno/pyorchdb/blob/main/.github"

    %% Styles
    classDef cloud fill:#FAD7A0,stroke:#D35400,stroke-width:2px;
    classDef local fill:#D5F5E3,stroke:#229954,stroke-width:2px;
```
