# dev-strzx9/dev architecture

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

- Interactive diagram: https://gitdiagram.com/dev-strzx9/dev
- Repository: https://github.com/dev-strzx9/dev

## Overview

ER MAP is an entity-extraction API/workflow: a user submits a query, the system extracts and repairs identifiers, then the workflow attempts a data load and can present results for human selection before building an artifact. The data-load module is currently a stub that always returns an empty result. The README describes extraction-only scope, while the sampled workflow and API implement additional selection and artifact stages; unsampled prompt files are not mapped.

Main entry points: [`ermap_workflow.py`](https://github.com/dev-strzx9/dev/blob/main/ermap_workflow.py) (Workflow graph), [`llm_api.py`](https://github.com/dev-strzx9/dev/blob/main/llm_api.py) (Structured LLM client), [`app.py`](https://github.com/dev-strzx9/dev/blob/main/app.py) (Chat API), [`ermap_agent.py`](https://github.com/dev-strzx9/dev/blob/main/ermap_agent.py) (Entity extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API entry"]
  node_api["Chat API<br/>[app.py]"]
  node_result["API response<br/>[app.py]"]
end

subgraph group_extraction["Entity extraction"]
  node_extract["Entity extraction<br/>[ermap_agent.py]"]
  node_repair["Identifier repair<br/>[ermap_agent.py]"]
end

subgraph group_workflow["Workflow stages"]
  node_orchestrator["Workflow graph<br/>[ermap_workflow.py]"]
  node_load["Data load<br/>[ermap_data_load.py]"]
  node_selection["HITL selection<br/>[ermap_workflow.py]"]
  node_selection_logic["Selection parsing<br/>[ermap_selection.py]"]
  node_artifact["Artifact builder<br/>[ermap_workflow.py]"]
end

subgraph group_integration["LLM integration"]
  node_llm["Structured LLM client<br/>[llm_api.py]"]
end

node_user(("User"))
node_openrouter{{"OpenRouter"}}
node_db[("ER MAP database")]

node_user -->|"submits query"| node_api
node_api -->|"invokes or resumes"| node_orchestrator
node_orchestrator -->|"dispatches"| node_extract
node_extract -->|"extracts entities"| node_llm
node_llm -->|"sends request"| node_openrouter
node_orchestrator -->|"dispatches"| node_repair
node_repair -->|"repairs identifiers"| node_llm
node_orchestrator -->|"dispatches"| node_load
node_load -.->|"queries &#40;unimplemented&#41;"| node_db
node_orchestrator -->|"routes results"| node_selection
node_selection -->|"resolves reply"| node_selection_logic
node_selection_logic -->|"parses selection"| node_llm
node_orchestrator -->|"dispatches"| node_artifact
node_orchestrator -->|"returns outcome"| node_result
node_result -->|"responds"| node_user

click node_api "https://github.com/dev-strzx9/dev/blob/main/app.py"
click node_orchestrator "https://github.com/dev-strzx9/dev/blob/main/ermap_workflow.py"
click node_extract "https://github.com/dev-strzx9/dev/blob/main/ermap_agent.py"
click node_repair "https://github.com/dev-strzx9/dev/blob/main/ermap_agent.py"
click node_llm "https://github.com/dev-strzx9/dev/blob/main/llm_api.py"
click node_load "https://github.com/dev-strzx9/dev/blob/main/ermap_data_load.py"
click node_selection "https://github.com/dev-strzx9/dev/blob/main/ermap_workflow.py"
click node_selection_logic "https://github.com/dev-strzx9/dev/blob/main/ermap_selection.py"
click node_artifact "https://github.com/dev-strzx9/dev/blob/main/ermap_workflow.py"
click node_result "https://github.com/dev-strzx9/dev/blob/main/app.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_api,node_result,node_user toneBlue
class node_extract,node_repair,node_db toneAmber
class node_orchestrator,node_load,node_selection,node_selection_logic,node_artifact,node_openrouter toneMint
class node_llm toneRose
```

## Components

### API entry

- [Chat API](https://github.com/dev-strzx9/dev/blob/main/app.py): `app.py`
- [API response](https://github.com/dev-strzx9/dev/blob/main/app.py): `app.py`

### Entity extraction

- [Entity extraction](https://github.com/dev-strzx9/dev/blob/main/ermap_agent.py): `ermap_agent.py`
- [Identifier repair](https://github.com/dev-strzx9/dev/blob/main/ermap_agent.py): `ermap_agent.py`

### Workflow stages

- [Workflow graph](https://github.com/dev-strzx9/dev/blob/main/ermap_workflow.py): `ermap_workflow.py`
- [Data load](https://github.com/dev-strzx9/dev/blob/main/ermap_data_load.py): `ermap_data_load.py`
- [HITL selection](https://github.com/dev-strzx9/dev/blob/main/ermap_workflow.py): `ermap_workflow.py`
- [Selection parsing](https://github.com/dev-strzx9/dev/blob/main/ermap_selection.py): `ermap_selection.py`
- [Artifact builder](https://github.com/dev-strzx9/dev/blob/main/ermap_workflow.py): `ermap_workflow.py`

### LLM integration

- [Structured LLM client](https://github.com/dev-strzx9/dev/blob/main/llm_api.py): `llm_api.py`

### Other components

- **User**
- **OpenRouter**
- **ER MAP database**

## Connections

- User → Chat API: submits query (evidence: `app.py`)
- Chat API → Workflow graph: invokes or resumes (evidence: `app.py`)
- Workflow graph → Entity extraction: dispatches (evidence: `ermap_workflow.py`)
- Entity extraction → Structured LLM client: extracts entities (evidence: `ermap_agent.py`)
- Structured LLM client → OpenRouter: sends request (evidence: `llm_api.py`)
- Workflow graph → Identifier repair: dispatches (evidence: `ermap_workflow.py`)
- Identifier repair → Structured LLM client: repairs identifiers (evidence: `ermap_agent.py`)
- Workflow graph → Data load: dispatches (evidence: `ermap_workflow.py`)
- Data load → ER MAP database: queries (unimplemented)
- Workflow graph → HITL selection: routes results (evidence: `ermap_workflow.py`)
- HITL selection → Selection parsing: resolves reply (evidence: `ermap_workflow.py`)
- Selection parsing → Structured LLM client: parses selection (evidence: `ermap_selection.py`)
- Workflow graph → Artifact builder: dispatches (evidence: `ermap_workflow.py`)
- Workflow graph → API response: returns outcome (evidence: `app.py`)
- API response → User: responds (evidence: `app.py`)
