# purnatejeshwarareddyb/driftly architecture

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

- Interactive diagram: https://gitdiagram.com/purnatejeshwarareddyb/driftly
- Repository: https://github.com/purnatejeshwarareddyb/driftly

## Overview

DRIFTLY ingests public or demo job-feed data, validates and preserves it in SQLite, and serves jobs plus operational health through a combined API and dashboard. The main workflow starts with a manual run from the UI or API, passes through adapter fetching and the ingestion pipeline, then records jobs, run status, events, and quarantined records. The dashboard and API also expose health, metrics, history, and Chaos Lab simulations. Relationships use excerpts and README statements; some pipeline details are documented but not fully sampled.

Main entry points: [`ingestion.py`](https://github.com/purnatejeshwarareddyb/driftly/blob/main/ingestion.py) (Ingestion orchestrator), [`services.py`](https://github.com/purnatejeshwarareddyb/driftly/blob/main/services.py) (Read services), [`adapters.py`](https://github.com/purnatejeshwarareddyb/driftly/blob/main/adapters.py) (Source adapters), [`api.py`](https://github.com/purnatejeshwarareddyb/driftly/blob/main/api.py) (JSON API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Source intake"]
  node_fixture["Demo fixture<br/>[demo_fixture.json]"]
  node_adapter["Source adapters<br/>[adapters.py]"]
end

subgraph group_pipeline["Ingestion and resilience"]
  node_ingestion["Ingestion orchestrator<br/>[ingestion.py]"]
  node_resilience["Retry and status<br/>[resilience.py]"]
  node_validation["Record validation<br/>[schemas.py]"]
  node_normalization["Normalize and dedupe<br/>[ingestion.py]"]
  node_quarantine["Drift quarantine<br/>[ingestion.py]"]
  node_configuration["Runtime settings<br/>[config.py]"]
end

subgraph group_state["Persistence and read services"]
  node_database["SQLite sessions<br/>[database.py]"]
  node_records[("Jobs and sources<br/>[models.py]")]
  node_runlog[("Runs and events<br/>[models.py]")]
  node_readservices["Read services<br/>[services.py]"]
end

subgraph group_experience["User interfaces and simulation"]
  node_operatorapi["JSON API<br/>[api.py]"]
  node_dashboard["Dashboard<br/>[ui.py]"]
  node_chaoslab["Chaos Lab<br/>[chaos.py]"]
  node_runtime["Application startup<br/>[main.py]"]
end

node_operator(("Operator"))
node_feed(("Public job feed"))

node_operator -->|"requests"| node_operatorapi
node_operator -->|"uses"| node_dashboard
node_operatorapi -->|"queries"| node_readservices
node_operatorapi -->|"triggers run"| node_readservices
node_operatorapi -->|"starts simulations"| node_chaoslab
node_dashboard -->|"reads status and data"| node_readservices
node_dashboard -->|"offers simulations"| node_chaoslab
node_readservices -->|"opens sessions"| node_database
node_readservices -->|"reads and updates"| node_records
node_readservices -->|"reads metrics and history"| node_runlog
node_readservices -->|"builds source"| node_adapter
node_readservices -->|"invokes run"| node_ingestion
node_ingestion -->|"fetches records"| node_adapter
node_adapter -->|"fetches JSON"| node_feed
node_adapter -->|"loads offline data"| node_fixture
node_ingestion -->|"retries fetch"| node_resilience
node_ingestion -->|"validates records"| node_validation
node_ingestion -->|"normalizes and deduplicates"| node_normalization
node_ingestion -->|"quarantines invalid data"| node_quarantine
node_ingestion -->|"stores jobs and health"| node_records
node_ingestion -->|"records run events"| node_runlog
node_adapter -->|"uses settings"| node_configuration
node_resilience -->|"uses thresholds"| node_configuration
node_database -->|"configures engine"| node_configuration
node_runtime -->|"registers router"| node_operatorapi
node_runtime -->|"registers pages"| node_dashboard
node_runtime -->|"initializes schema"| node_database
node_chaoslab -->|"runs real pipeline"| node_ingestion
node_chaoslab -->|"opens sessions"| node_database

click node_fixture "https://github.com/purnatejeshwarareddyb/driftly/blob/main/data/demo_fixture.json"
click node_adapter "https://github.com/purnatejeshwarareddyb/driftly/blob/main/adapters.py"
click node_ingestion "https://github.com/purnatejeshwarareddyb/driftly/blob/main/ingestion.py"
click node_resilience "https://github.com/purnatejeshwarareddyb/driftly/blob/main/resilience.py"
click node_validation "https://github.com/purnatejeshwarareddyb/driftly/blob/main/schemas.py"
click node_normalization "https://github.com/purnatejeshwarareddyb/driftly/blob/main/ingestion.py"
click node_quarantine "https://github.com/purnatejeshwarareddyb/driftly/blob/main/ingestion.py"
click node_configuration "https://github.com/purnatejeshwarareddyb/driftly/blob/main/config.py"
click node_database "https://github.com/purnatejeshwarareddyb/driftly/blob/main/database.py"
click node_records "https://github.com/purnatejeshwarareddyb/driftly/blob/main/models.py"
click node_runlog "https://github.com/purnatejeshwarareddyb/driftly/blob/main/models.py"
click node_readservices "https://github.com/purnatejeshwarareddyb/driftly/blob/main/services.py"
click node_operatorapi "https://github.com/purnatejeshwarareddyb/driftly/blob/main/api.py"
click node_dashboard "https://github.com/purnatejeshwarareddyb/driftly/blob/main/ui.py"
click node_chaoslab "https://github.com/purnatejeshwarareddyb/driftly/blob/main/chaos.py"
click node_runtime "https://github.com/purnatejeshwarareddyb/driftly/blob/main/main.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_fixture,node_adapter toneBlue
class node_ingestion,node_resilience,node_validation,node_normalization,node_quarantine,node_configuration toneAmber
class node_database,node_records,node_runlog,node_readservices toneMint
class node_operatorapi,node_dashboard,node_chaoslab,node_runtime toneRose
class node_operator,node_feed toneIndigo
```

## Components

### Source intake

- [Demo fixture](https://github.com/purnatejeshwarareddyb/driftly/blob/main/data/demo_fixture.json): `data/demo_fixture.json`
- [Source adapters](https://github.com/purnatejeshwarareddyb/driftly/blob/main/adapters.py): `adapters.py`

### Ingestion and resilience

- [Ingestion orchestrator](https://github.com/purnatejeshwarareddyb/driftly/blob/main/ingestion.py): `ingestion.py`
- [Retry and status](https://github.com/purnatejeshwarareddyb/driftly/blob/main/resilience.py): `resilience.py`
- [Record validation](https://github.com/purnatejeshwarareddyb/driftly/blob/main/schemas.py): `schemas.py`
- [Normalize and dedupe](https://github.com/purnatejeshwarareddyb/driftly/blob/main/ingestion.py): `ingestion.py`
- [Drift quarantine](https://github.com/purnatejeshwarareddyb/driftly/blob/main/ingestion.py): `ingestion.py`
- [Runtime settings](https://github.com/purnatejeshwarareddyb/driftly/blob/main/config.py): `config.py`

### Persistence and read services

- [SQLite sessions](https://github.com/purnatejeshwarareddyb/driftly/blob/main/database.py): `database.py`
- [Jobs and sources](https://github.com/purnatejeshwarareddyb/driftly/blob/main/models.py): `models.py`
- [Runs and events](https://github.com/purnatejeshwarareddyb/driftly/blob/main/models.py): `models.py`
- [Read services](https://github.com/purnatejeshwarareddyb/driftly/blob/main/services.py): `services.py`

### User interfaces and simulation

- [JSON API](https://github.com/purnatejeshwarareddyb/driftly/blob/main/api.py): `api.py`
- [Dashboard](https://github.com/purnatejeshwarareddyb/driftly/blob/main/ui.py): `ui.py`
- [Chaos Lab](https://github.com/purnatejeshwarareddyb/driftly/blob/main/chaos.py): `chaos.py`
- [Application startup](https://github.com/purnatejeshwarareddyb/driftly/blob/main/main.py): `main.py`

### Other components

- **Operator**
- **Public job feed**

## Connections

- Operator → JSON API: requests (evidence: `README.md`)
- Operator → Dashboard: uses (evidence: `README.md`)
- JSON API → Read services: queries (evidence: `api.py`)
- JSON API → Read services: triggers run (evidence: `api.py`)
- JSON API → Chaos Lab: starts simulations (evidence: `api.py`)
- Dashboard → Read services: reads status and data (evidence: `ui.py`)
- Dashboard → Chaos Lab: offers simulations (evidence: `README.md`)
- Read services → SQLite sessions: opens sessions (evidence: `services.py`)
- Read services → Jobs and sources: reads and updates (evidence: `services.py`)
- Read services → Runs and events: reads metrics and history (evidence: `services.py`)
- Read services → Source adapters: builds source (evidence: `services.py`)
- Read services → Ingestion orchestrator: invokes run (evidence: `services.py`)
- Ingestion orchestrator → Source adapters: fetches records (evidence: `README.md`)
- Source adapters → Public job feed: fetches JSON (evidence: `adapters.py`)
- Source adapters → Demo fixture: loads offline data (evidence: `adapters.py`)
- Ingestion orchestrator → Retry and status: retries fetch (evidence: `README.md`)
- Ingestion orchestrator → Record validation: validates records (evidence: `README.md`)
- Ingestion orchestrator → Normalize and dedupe: normalizes and deduplicates (evidence: `README.md`)
- Ingestion orchestrator → Drift quarantine: quarantines invalid data (evidence: `README.md`)
- Ingestion orchestrator → Jobs and sources: stores jobs and health (evidence: `ingestion.py`)
- Ingestion orchestrator → Runs and events: records run events (evidence: `ingestion.py`)
- Source adapters → Runtime settings: uses settings (evidence: `adapters.py`)
- Retry and status → Runtime settings: uses thresholds (evidence: `resilience.py`)
- SQLite sessions → Runtime settings: configures engine (evidence: `database.py`)
- Application startup → JSON API: registers router (evidence: `main.py`)
- Application startup → Dashboard: registers pages (evidence: `main.py`)
- Application startup → SQLite sessions: initializes schema (evidence: `main.py`)
- Chaos Lab → Ingestion orchestrator: runs real pipeline (evidence: `chaos.py`)
- Chaos Lab → SQLite sessions: opens sessions (evidence: `chaos.py`)
