# maharshi25-rgb/dcp architecture

> Architecture diagram of the GitHub repository maharshi25-rgb/dcp, 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/maharshi25-rgb/dcp
- Repository: https://github.com/maharshi25-rgb/dcp

## Overview

DCP is a FastAPI backend for turning user requests into structured, validated workflows, gathering answers, and generating a prompt or AI response. The main workflow passes through security, provenance and validation checks, then evaluates completeness before prompt/response generation; generated responses receive their own validation and repair cycle. The API also saves and retrieves workflows and exposes a separate message endpoint. The README is empty; some service connections are based on sampled imports or documented route intent, so uncertain calls are dashed.

Main entry points: [`routers/workflow.py`](https://github.com/maharshi25-rgb/dcp/blob/main/routers/workflow.py) (Workflow Routes), [`services/workflow_engine.py`](https://github.com/maharshi25-rgb/dcp/blob/main/services/workflow_engine.py) (Workflow Engine), [`models/generic_workflow.py`](https://github.com/maharshi25-rgb/dcp/blob/main/models/generic_workflow.py) (Workflow Model), [`services/output_engine.py`](https://github.com/maharshi25-rgb/dcp/blob/main/services/output_engine.py) (Output Processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and Requests"]
  node_app["FastAPI App<br/>[main.py]"]
  node_workflow_api["Workflow Routes<br/>[workflow.py]"]
  node_message_api["Message Route<br/>[message.py]"]
end

subgraph group_workflow["Workflow Processing"]
  node_workflow_model["Workflow Model"]
  node_security["Input Security"]
  node_provenance["Provenance Validation"]
  node_normalizer["Workflow Normalizer"]
  node_workflow_validation["Workflow Validation"]
  node_field_validation["Field Validation"]
  node_workflow_engine["Workflow Engine<br/>[workflow_engine.py]"]
  node_evaluation["Workflow Evaluation"]
end

subgraph group_generation["AI Generation"]
  node_ai_workflow["AI Workflow Generation"]
  node_prompt["Prompt Generation<br/>[prompt_service.py]"]
  node_ai_response["AI Response Generation"]
  node_output_engine["Output Processing<br/>[output_engine.py]"]
  node_output_validation["Output Validation"]
  node_output_check["AI Output Check"]
  node_output_repair["Output Repair"]
end

subgraph group_storage["Workflow Storage"]
  node_repository["Workflow Repository"]
  node_workflow_record[("Workflow Record<br/>[workflow_db.py]")]
  node_database[("Database Setup<br/>[database.py]")]
end

subgraph group_support["Supporting Features"]
  node_suggestions["Suggestion Management"]
  node_suggestion_filter["Suggestion Filtering"]
  node_message_service["Message Processing<br/>[message_service.py]"]
end

node_user(("User"))

node_user -->|"sends requests"| node_app
node_app -->|"registers routes"| node_workflow_api
node_app -->|"registers routes"| node_message_api
node_user -->|"submits workflow"| node_workflow_api
node_workflow_api -->|"checks input"| node_security
node_workflow_api -.->|"generates workflow"| node_ai_workflow
node_workflow_api -->|"processes workflow"| node_workflow_engine
node_workflow_api -->|"builds prompt"| node_prompt
node_workflow_api -->|"generates response"| node_ai_response
node_workflow_api -->|"checks response"| node_output_engine
node_workflow_api -->|"reads and saves"| node_repository
node_workflow_api -->|"accepts workflow"| node_workflow_model
node_workflow_engine -->|"checks request"| node_security
node_workflow_engine -->|"checks provenance"| node_provenance
node_workflow_engine -->|"normalizes workflow"| node_normalizer
node_workflow_engine -->|"validates structure"| node_workflow_validation
node_workflow_engine -->|"validates values"| node_field_validation
node_workflow_engine -->|"evaluates workflow"| node_evaluation
node_workflow_engine -->|"processes model"| node_workflow_model
node_output_engine -->|"validates output"| node_output_validation
node_output_engine -->|"checks semantics"| node_output_check
node_output_engine -->|"repairs failures"| node_output_repair
node_output_repair -->|"uses workflow facts"| node_workflow_model
node_repository -.->|"stores records"| node_workflow_record
node_workflow_record -->|"uses database base"| node_database
node_user -->|"sends message"| node_message_api
node_message_api -->|"processes message"| node_message_service
node_suggestion_filter -->|"filters suggestions"| node_workflow_model
node_suggestions -->|"updates suggestions"| node_workflow_model

click node_app "https://github.com/maharshi25-rgb/dcp/blob/main/main.py"
click node_workflow_api "https://github.com/maharshi25-rgb/dcp/blob/main/routers/workflow.py"
click node_message_api "https://github.com/maharshi25-rgb/dcp/blob/main/routers/message.py"
click node_workflow_model "https://github.com/maharshi25-rgb/dcp/blob/main/models/generic_workflow.py"
click node_security "https://github.com/maharshi25-rgb/dcp/blob/main/services/input_security_service.py"
click node_provenance "https://github.com/maharshi25-rgb/dcp/blob/main/services/workflow_provenance_validator.py"
click node_normalizer "https://github.com/maharshi25-rgb/dcp/blob/main/services/workflow_normalizer.py"
click node_workflow_validation "https://github.com/maharshi25-rgb/dcp/blob/main/services/workflow_validator.py"
click node_field_validation "https://github.com/maharshi25-rgb/dcp/blob/main/services/workflow_field_validator.py"
click node_workflow_engine "https://github.com/maharshi25-rgb/dcp/blob/main/services/workflow_engine.py"
click node_evaluation "https://github.com/maharshi25-rgb/dcp/blob/main/services/generic_workflow_service.py"
click node_ai_workflow "https://github.com/maharshi25-rgb/dcp/blob/main/services/ai_workflow_service.py"
click node_prompt "https://github.com/maharshi25-rgb/dcp/blob/main/services/prompt_service.py"
click node_ai_response "https://github.com/maharshi25-rgb/dcp/blob/main/services/ai_response_service.py"
click node_output_engine "https://github.com/maharshi25-rgb/dcp/blob/main/services/output_engine.py"
click node_output_validation "https://github.com/maharshi25-rgb/dcp/blob/main/services/output_validator.py"
click node_output_check "https://github.com/maharshi25-rgb/dcp/blob/main/services/ai_output_checker.py"
click node_output_repair "https://github.com/maharshi25-rgb/dcp/blob/main/services/output_repair_service.py"
click node_repository "https://github.com/maharshi25-rgb/dcp/blob/main/services/workflow_repository.py"
click node_workflow_record "https://github.com/maharshi25-rgb/dcp/blob/main/models/workflow_db.py"
click node_database "https://github.com/maharshi25-rgb/dcp/blob/main/database.py"
click node_suggestions "https://github.com/maharshi25-rgb/dcp/blob/main/services/suggestion_service.py"
click node_suggestion_filter "https://github.com/maharshi25-rgb/dcp/blob/main/services/suggestion_engine.py"
click node_message_service "https://github.com/maharshi25-rgb/dcp/blob/main/services/message_service.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_app,node_workflow_api,node_message_api,node_user toneBlue
class node_workflow_model,node_security,node_provenance,node_normalizer,node_workflow_validation,node_field_validation,node_workflow_engine,node_evaluation toneAmber
class node_ai_workflow,node_prompt,node_ai_response,node_output_engine,node_output_validation,node_output_check,node_output_repair toneMint
class node_repository,node_workflow_record,node_database toneRose
class node_suggestions,node_suggestion_filter,node_message_service toneIndigo
```

## Components

### API and Requests

- [FastAPI App](https://github.com/maharshi25-rgb/dcp/blob/main/main.py): `main.py`
- [Workflow Routes](https://github.com/maharshi25-rgb/dcp/blob/main/routers/workflow.py): `routers/workflow.py`
- [Message Route](https://github.com/maharshi25-rgb/dcp/blob/main/routers/message.py): `routers/message.py`

### Workflow Processing

- [Workflow Model](https://github.com/maharshi25-rgb/dcp/blob/main/models/generic_workflow.py): `models/generic_workflow.py`
- [Input Security](https://github.com/maharshi25-rgb/dcp/blob/main/services/input_security_service.py): `services/input_security_service.py`
- [Provenance Validation](https://github.com/maharshi25-rgb/dcp/blob/main/services/workflow_provenance_validator.py): `services/workflow_provenance_validator.py`
- [Workflow Normalizer](https://github.com/maharshi25-rgb/dcp/blob/main/services/workflow_normalizer.py): `services/workflow_normalizer.py`
- [Workflow Validation](https://github.com/maharshi25-rgb/dcp/blob/main/services/workflow_validator.py): `services/workflow_validator.py`
- [Field Validation](https://github.com/maharshi25-rgb/dcp/blob/main/services/workflow_field_validator.py): `services/workflow_field_validator.py`
- [Workflow Engine](https://github.com/maharshi25-rgb/dcp/blob/main/services/workflow_engine.py): `services/workflow_engine.py`
- [Workflow Evaluation](https://github.com/maharshi25-rgb/dcp/blob/main/services/generic_workflow_service.py): `services/generic_workflow_service.py`

### AI Generation

- [AI Workflow Generation](https://github.com/maharshi25-rgb/dcp/blob/main/services/ai_workflow_service.py): `services/ai_workflow_service.py`
- [Prompt Generation](https://github.com/maharshi25-rgb/dcp/blob/main/services/prompt_service.py): `services/prompt_service.py`
- [AI Response Generation](https://github.com/maharshi25-rgb/dcp/blob/main/services/ai_response_service.py): `services/ai_response_service.py`
- [Output Processing](https://github.com/maharshi25-rgb/dcp/blob/main/services/output_engine.py): `services/output_engine.py`
- [Output Validation](https://github.com/maharshi25-rgb/dcp/blob/main/services/output_validator.py): `services/output_validator.py`
- [AI Output Check](https://github.com/maharshi25-rgb/dcp/blob/main/services/ai_output_checker.py): `services/ai_output_checker.py`
- [Output Repair](https://github.com/maharshi25-rgb/dcp/blob/main/services/output_repair_service.py): `services/output_repair_service.py`

### Workflow Storage

- [Workflow Repository](https://github.com/maharshi25-rgb/dcp/blob/main/services/workflow_repository.py): `services/workflow_repository.py`
- [Workflow Record](https://github.com/maharshi25-rgb/dcp/blob/main/models/workflow_db.py): `models/workflow_db.py`
- [Database Setup](https://github.com/maharshi25-rgb/dcp/blob/main/database.py): `database.py`

### Supporting Features

- [Suggestion Management](https://github.com/maharshi25-rgb/dcp/blob/main/services/suggestion_service.py): `services/suggestion_service.py`
- [Suggestion Filtering](https://github.com/maharshi25-rgb/dcp/blob/main/services/suggestion_engine.py): `services/suggestion_engine.py`
- [Message Processing](https://github.com/maharshi25-rgb/dcp/blob/main/services/message_service.py): `services/message_service.py`

### Other components

- **User**

## Connections

- User → FastAPI App: sends requests (evidence: `main.py`)
- FastAPI App → Workflow Routes: registers routes (evidence: `main.py`)
- FastAPI App → Message Route: registers routes (evidence: `main.py`)
- User → Workflow Routes: submits workflow (evidence: `routers/workflow.py`)
- Workflow Routes → Input Security: checks input (evidence: `routers/workflow.py`)
- Workflow Routes → AI Workflow Generation: generates workflow (evidence: `routers/workflow.py`)
- Workflow Routes → Workflow Engine: processes workflow (evidence: `routers/workflow.py`)
- Workflow Routes → Prompt Generation: builds prompt (evidence: `routers/workflow.py`)
- Workflow Routes → AI Response Generation: generates response (evidence: `routers/workflow.py`)
- Workflow Routes → Output Processing: checks response (evidence: `routers/workflow.py`)
- Workflow Routes → Workflow Repository: reads and saves (evidence: `routers/workflow.py`)
- Workflow Routes → Workflow Model: accepts workflow
- Workflow Engine → Input Security: checks request (evidence: `services/workflow_engine.py`)
- Workflow Engine → Provenance Validation: checks provenance (evidence: `services/workflow_engine.py`)
- Workflow Engine → Workflow Normalizer: normalizes workflow (evidence: `services/workflow_engine.py`)
- Workflow Engine → Workflow Validation: validates structure (evidence: `services/workflow_engine.py`)
- Workflow Engine → Field Validation: validates values (evidence: `services/workflow_engine.py`)
- Workflow Engine → Workflow Evaluation: evaluates workflow (evidence: `services/workflow_engine.py`)
- Workflow Engine → Workflow Model: processes model (evidence: `services/workflow_engine.py`)
- Output Processing → Output Validation: validates output (evidence: `services/output_engine.py`)
- Output Processing → AI Output Check: checks semantics (evidence: `services/output_engine.py`)
- Output Processing → Output Repair: repairs failures (evidence: `services/output_engine.py`)
- Output Repair → Workflow Model: uses workflow facts (evidence: `services/output_repair_service.py`)
- Workflow Repository → Workflow Record: stores records
- Workflow Record → Database Setup: uses database base (evidence: `models/workflow_db.py`)
- User → Message Route: sends message (evidence: `routers/message.py`)
- Message Route → Message Processing: processes message (evidence: `routers/message.py`)
- Suggestion Filtering → Workflow Model: filters suggestions (evidence: `services/suggestion_engine.py`)
- Suggestion Management → Workflow Model: updates suggestions (evidence: `services/suggestion_service.py`)
