# escoto/dbx-flame architecture

> Architecture diagram of the GitHub repository escoto/dbx-flame, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/escoto/dbx-flame
- Repository: https://github.com/escoto/dbx-flame

## Overview

dbx-flame is a configuration-driven Databricks medallion data framework. A task’s YAML is validated into run context; a source reader supplies data, which is preprocessed, enriched, type-cast, checked by policies, then written to a Delta target using one of five verbs. The README documents this five-layer workflow; sampled source confirms the pipeline composition and several internal calls. Audit logging and Delta table configuration are supporting runtime concerns. Some source readers, startup wiring, and verb implementations were not sampled, so their links reflect README documentation or indexed imports rather than inspected call bodies.

Main entry points: [`src/dbx_flame/entrypoints/pipeline.py`](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/entrypoints/pipeline.py) (Pipeline runner), [`src/dbx_flame/output/registry.py`](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/output/registry.py) (Verb registry), [`src/dbx_flame/entrypoints/run.py`](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/entrypoints/run.py) (Task entrypoint), [`src/dbx_flame/pipelines/registry.py`](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/pipelines/registry.py) (Source registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_start["Configuration and start"]
  node_entry["Task entrypoint<br/>[run.py]"]
  node_config["Typed config<br/>[config.py]"]
  node_loader["Context builder<br/>[loader.py]"]
  node_context["Run context<br/>[context.py]"]
end

subgraph group_ingest["Source and preparation"]
  node_pipeline["Pipeline runner<br/>[pipeline.py]"]
  node_csv["CSV source<br/>[csv_source.py]"]
  node_json["JSON source<br/>[json_source.py]"]
  node_delta["Delta source<br/>[delta_source.py]"]
  node_source_registry["Source registry<br/>[registry.py]"]
  node_preprocessors["Preprocessors<br/>[preprocessors.py]"]
  node_enrichment["Enrichment<br/>[enrichment.py]"]
end

subgraph group_quality["Typing and policies"]
  node_typing["Type casting<br/>[service.py]"]
  node_policies["DQ policy runner<br/>[runner.py]"]
  node_platform_policy["Platform policies<br/>[platform.py]"]
end

subgraph group_write["Delta output"]
  node_output_base["Writer contract<br/>[base.py]"]
  node_output_registry["Verb registry<br/>[registry.py]"]
  node_append["Append writer<br/>[append.py]"]
  node_full["Full writer<br/>[full.py]"]
  node_upsert["Upsert writer<br/>[upsert.py]"]
  node_scd2["SCD2 writer<br/>[scd2.py]"]
  node_complete_delta["Complete-delta writer<br/>[complete_delta.py]"]
  node_mechanics["Write mechanics<br/>[mechanics.py]"]
  node_table_config["Delta table config<br/>[table_config.py]"]
end

subgraph group_observe["Run observability"]
  node_audit["Audit logger<br/>[audit_logger.py]"]
  node_kpi["Write KPIs<br/>[kpi.py]"]
  node_tagging["Table tagging<br/>[tagging.py]"]
end

node_author(("Workflow author"))
node_workflow["Workflow YAML"]
node_dqx["Databricks DQX"]
node_delta_tables[("Delta tables")]

node_author -->|"defines"| node_workflow
node_workflow -->|"configures"| node_entry
node_entry -.->|"validates"| node_config
node_entry -.->|"builds context"| node_loader
node_loader -.->|"creates"| node_context
node_context -->|"holds logger"| node_audit
node_entry -.->|"runs task"| node_pipeline
node_pipeline -->|"selects source"| node_source_registry
node_source_registry -->|"dispatches"| node_csv
node_source_registry -->|"dispatches"| node_json
node_source_registry -->|"dispatches"| node_delta
node_pipeline -->|"prepares batch"| node_preprocessors
node_pipeline -->|"enriches batch"| node_enrichment
node_pipeline -->|"casts batch"| node_typing
node_pipeline -->|"gates batch"| node_policies
node_policies -->|"evaluates checks"| node_dqx
node_typing -->|"rejects invalid casts"| node_platform_policy
node_pipeline -->|"selects verb"| node_output_registry
node_output_registry -->|"uses contract"| node_output_base
node_output_registry -->|"dispatches"| node_append
node_output_registry -->|"dispatches"| node_full
node_output_registry -->|"dispatches"| node_upsert
node_output_registry -->|"dispatches"| node_scd2
node_output_registry -->|"dispatches"| node_complete_delta
node_pipeline -->|"prepares writes"| node_mechanics
node_pipeline -->|"configures target"| node_table_config
node_mechanics -->|"enforces constraints"| node_platform_policy
node_mechanics -->|"records write metrics"| node_kpi
node_pipeline -->|"writes batch"| node_delta_tables
node_table_config -.->|"configures table"| node_delta_tables
node_audit -->|"writes audit trail"| node_delta_tables
node_table_config -->|"applies tags"| node_tagging

click node_entry "https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/entrypoints/run.py"
click node_config "https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/context/config.py"
click node_loader "https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/context/loader.py"
click node_context "https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/context/context.py"
click node_pipeline "https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/entrypoints/pipeline.py"
click node_csv "https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/pipelines/csv_source.py"
click node_json "https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/pipelines/json_source.py"
click node_delta "https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/pipelines/delta_source.py"
click node_source_registry "https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/pipelines/registry.py"
click node_preprocessors "https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/pipelines/preprocessors.py"
click node_enrichment "https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/pipelines/enrichment.py"
click node_typing "https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/typecast/service.py"
click node_policies "https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/policies/runner.py"
click node_platform_policy "https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/policies/platform.py"
click node_output_base "https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/output/base.py"
click node_output_registry "https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/output/registry.py"
click node_append "https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/output/delta/append.py"
click node_full "https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/output/delta/full.py"
click node_upsert "https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/output/delta/upsert.py"
click node_scd2 "https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/output/delta/scd2.py"
click node_complete_delta "https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/output/delta/complete_delta.py"
click node_mechanics "https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/output/mechanics.py"
click node_table_config "https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/output/table_config.py"
click node_audit "https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/observability/audit_logger.py"
click node_kpi "https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/observability/kpi.py"
click node_tagging "https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/observability/tagging.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_config,node_loader,node_context toneBlue
class node_pipeline,node_csv,node_json,node_delta,node_source_registry,node_preprocessors,node_enrichment,node_delta_tables toneAmber
class node_typing,node_policies,node_platform_policy toneMint
class node_output_base,node_output_registry,node_append,node_full,node_upsert,node_scd2,node_complete_delta,node_mechanics,node_table_config toneRose
class node_audit,node_kpi,node_tagging,node_author,node_workflow,node_dqx toneIndigo
```

## Components

### Configuration and start

- [Task entrypoint](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/entrypoints/run.py): `src/dbx_flame/entrypoints/run.py`
- [Typed config](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/context/config.py): `src/dbx_flame/context/config.py`
- [Context builder](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/context/loader.py): `src/dbx_flame/context/loader.py`
- [Run context](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/context/context.py): `src/dbx_flame/context/context.py`

### Source and preparation

- [Pipeline runner](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/entrypoints/pipeline.py): `src/dbx_flame/entrypoints/pipeline.py`
- [CSV source](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/pipelines/csv_source.py): `src/dbx_flame/pipelines/csv_source.py`
- [JSON source](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/pipelines/json_source.py): `src/dbx_flame/pipelines/json_source.py`
- [Delta source](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/pipelines/delta_source.py): `src/dbx_flame/pipelines/delta_source.py`
- [Source registry](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/pipelines/registry.py): `src/dbx_flame/pipelines/registry.py`
- [Preprocessors](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/pipelines/preprocessors.py): `src/dbx_flame/pipelines/preprocessors.py`
- [Enrichment](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/pipelines/enrichment.py): `src/dbx_flame/pipelines/enrichment.py`

### Typing and policies

- [Type casting](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/typecast/service.py): `src/dbx_flame/typecast/service.py`
- [DQ policy runner](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/policies/runner.py): `src/dbx_flame/policies/runner.py`
- [Platform policies](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/policies/platform.py): `src/dbx_flame/policies/platform.py`

### Delta output

- [Writer contract](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/output/base.py): `src/dbx_flame/output/base.py`
- [Verb registry](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/output/registry.py): `src/dbx_flame/output/registry.py`
- [Append writer](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/output/delta/append.py): `src/dbx_flame/output/delta/append.py`
- [Full writer](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/output/delta/full.py): `src/dbx_flame/output/delta/full.py`
- [Upsert writer](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/output/delta/upsert.py): `src/dbx_flame/output/delta/upsert.py`
- [SCD2 writer](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/output/delta/scd2.py): `src/dbx_flame/output/delta/scd2.py`
- [Complete-delta writer](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/output/delta/complete_delta.py): `src/dbx_flame/output/delta/complete_delta.py`
- [Write mechanics](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/output/mechanics.py): `src/dbx_flame/output/mechanics.py`
- [Delta table config](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/output/table_config.py): `src/dbx_flame/output/table_config.py`

### Run observability

- [Audit logger](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/observability/audit_logger.py): `src/dbx_flame/observability/audit_logger.py`
- [Write KPIs](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/observability/kpi.py): `src/dbx_flame/observability/kpi.py`
- [Table tagging](https://github.com/escoto/dbx-flame/blob/main/src/dbx_flame/observability/tagging.py): `src/dbx_flame/observability/tagging.py`

### Other components

- **Workflow author**
- **Workflow YAML**
- **Databricks DQX**
- **Delta tables**

## Connections

- Workflow author → Workflow YAML: defines (evidence: `README.md`)
- Workflow YAML → Task entrypoint: configures (evidence: `README.md`)
- Task entrypoint → Typed config: validates
- Task entrypoint → Context builder: builds context
- Context builder → Run context: creates
- Run context → Audit logger: holds logger (evidence: `src/dbx_flame/context/context.py`)
- Task entrypoint → Pipeline runner: runs task
- Pipeline runner → Source registry: selects source (evidence: `src/dbx_flame/entrypoints/pipeline.py`)
- Source registry → CSV source: dispatches (evidence: `src/dbx_flame/pipelines/registry.py`)
- Source registry → JSON source: dispatches (evidence: `src/dbx_flame/pipelines/registry.py`)
- Source registry → Delta source: dispatches (evidence: `src/dbx_flame/pipelines/registry.py`)
- Pipeline runner → Preprocessors: prepares batch (evidence: `src/dbx_flame/entrypoints/pipeline.py`)
- Pipeline runner → Enrichment: enriches batch (evidence: `src/dbx_flame/entrypoints/pipeline.py`)
- Pipeline runner → Type casting: casts batch (evidence: `src/dbx_flame/entrypoints/pipeline.py`)
- Pipeline runner → DQ policy runner: gates batch (evidence: `src/dbx_flame/entrypoints/pipeline.py`)
- DQ policy runner → Databricks DQX: evaluates checks (evidence: `src/dbx_flame/policies/runner.py`)
- Type casting → Platform policies: rejects invalid casts (evidence: `src/dbx_flame/typecast/service.py`)
- Pipeline runner → Verb registry: selects verb (evidence: `src/dbx_flame/entrypoints/pipeline.py`)
- Verb registry → Writer contract: uses contract (evidence: `src/dbx_flame/output/registry.py`)
- Verb registry → Append writer: dispatches (evidence: `src/dbx_flame/output/registry.py`)
- Verb registry → Full writer: dispatches (evidence: `src/dbx_flame/output/registry.py`)
- Verb registry → Upsert writer: dispatches (evidence: `src/dbx_flame/output/registry.py`)
- Verb registry → SCD2 writer: dispatches (evidence: `src/dbx_flame/output/registry.py`)
- Verb registry → Complete-delta writer: dispatches (evidence: `src/dbx_flame/output/registry.py`)
- Pipeline runner → Write mechanics: prepares writes (evidence: `src/dbx_flame/entrypoints/pipeline.py`)
- Pipeline runner → Delta table config: configures target (evidence: `src/dbx_flame/entrypoints/pipeline.py`)
- Write mechanics → Platform policies: enforces constraints (evidence: `src/dbx_flame/output/mechanics.py`)
- Write mechanics → Write KPIs: records write metrics (evidence: `src/dbx_flame/output/mechanics.py`)
- Pipeline runner → Delta tables: writes batch (evidence: `README.md`)
- Delta table config → Delta tables: configures table
- Audit logger → Delta tables: writes audit trail (evidence: `README.md`)
- Delta table config → Table tagging: applies tags (evidence: `src/dbx_flame/output/table_config.py`)
