Backend:
- normalization_engine.py (200 Zeilen): Synonym-Mapping, 5 Statuswerte
* normalize_decision_signal(): Kaskade (exact → case → synonym → invalid)
* apply_synonym_mapping(): DB-basierte Synonyme (case-insensitive)
* normalize_all_signals(): Batch-Processing gegen Katalog
* load_question_catalog(): Lädt normalization_rules aus DB
- workflow_executor.py (440 Zeilen): Sequenzielle Workflow-Ausführung
* execute_workflow(): Traversiert DAG in topologischer Reihenfolge
* execute_node(): Führt analysis nodes aus (start/end = no-op)
* aggregate_results(): Kombiniert analysis_core + normalized_signals
* save_execution_state(): Persistiert in workflow_executions
- workflow_models.py: Erweitert um Phase 2 Models
* SignalStatus Enum (valid, normalized, unclear, invalid, not_decidable)
* NormalizedSignal (question_type, raw_value, normalized_value, status)
* NodeExecutionState (node_id, status, analysis_core, normalized_signals)
* ExecutionResult (execution_id, workflow_id, status, node_states, aggregated_result)
- workflow_engine.py: Neue Funktion get_execution_order()
* Flattened topological sort für sequenzielle Execution
* Phase 7: Wird zu levels (parallele Execution)
- prompt_executor.py: execute_workflow_prompt() Implementierung
* Ruft workflow_executor.execute_workflow() auf
* Konvertiert ExecutionResult zu API-Response
- routers/workflows.py (230 Zeilen): Workflow Execution API
* POST /api/workflows/{id}/execute (mit enable_debug)
* GET /api/workflows/executions/{id} (lädt gespeicherten State)
* GET /api/workflows (listet alle aktiven Workflows)
* GET /api/workflows/{id} (lädt einzelnen Workflow mit Graph)
- main.py: Router-Registrierung (workflows.router)
Tests:
- test_phase2_normalization.py (17 Tests): Alle Normalisierungs-Szenarien
* Exact match, case-insensitive, synonym mapping, invalid, whitespace
* Batch-Normalisierung, not_in_catalog, mixed validity
- test_phase2_workflow_executor.py (10 Tests): Executor + Aggregation
* aggregate_results mit verschiedenen Konstellationen
* execute_node für start/end/analysis/unknown
* Integration mit question_augmenter + result_container_parser
Alle 27 Unit-Tests bestanden.
version: 0.9k (backend)
module: workflow 0.3.0
Konzept: .claude/task/Workflow_engine_prompting_engine/anforderungsanalyse_umsetzungsplan.md (Phase 2)
82 lines
3.1 KiB
Python
82 lines
3.1 KiB
Python
"""
|
|
Application Version Information
|
|
|
|
Semantic Versioning: MAJOR.MINOR.PATCH
|
|
- MAJOR: Breaking Change, DB-Migration inkompatibel
|
|
- MINOR: Neues Feature, neues Modul
|
|
- PATCH: Bugfix, kleine Änderung, Refactor
|
|
"""
|
|
|
|
APP_VERSION = "0.9k"
|
|
BUILD_DATE = "2026-04-03"
|
|
DB_SCHEMA_VERSION = "20260403" # Migration 034
|
|
|
|
MODULE_VERSIONS = {
|
|
"auth": "1.2.0",
|
|
"profiles": "1.1.0",
|
|
"weight": "1.0.3",
|
|
"circumference": "1.0.1",
|
|
"caliper": "1.0.1",
|
|
"activity": "1.1.0",
|
|
"nutrition": "1.0.2",
|
|
"photos": "1.0.0",
|
|
"insights": "1.3.0",
|
|
"prompts": "1.1.0",
|
|
"admin": "1.2.0",
|
|
"stats": "1.0.1",
|
|
"exportdata": "1.1.0",
|
|
"importdata": "1.0.0",
|
|
"membership": "2.1.0",
|
|
"workflow": "0.3.0", # Phase 2: Normalisierung + Workflow Executor
|
|
}
|
|
|
|
CHANGELOG = [
|
|
{
|
|
"version": "0.9k",
|
|
"date": "2026-04-03",
|
|
"changes": [
|
|
"Phase 2: Normalisierung + Workflow Executor",
|
|
"normalization_engine.py: Synonym-Mapping, 5 Statuswerte (valid, normalized, unclear, invalid, not_decidable)",
|
|
"workflow_executor.py: Sequenzielle Workflow-Ausführung, Node-State-Tracking, Ergebnis-Aggregation",
|
|
"Integration in prompt_executor.py: Dispatcher für type='workflow'",
|
|
"API-Router workflows.py: POST /workflows/{id}/execute, GET /workflows/executions/{id}",
|
|
"Unit-Tests Phase 2: 27 Tests (normalization_engine + workflow_executor)",
|
|
"Erweitert: workflow_models.py (NormalizedSignal, NodeExecutionState, ExecutionResult)",
|
|
]
|
|
},
|
|
{
|
|
"version": "0.9j",
|
|
"date": "2026-04-03",
|
|
"changes": [
|
|
"Phase 1: Fragenergänzung + Strukturierter Container",
|
|
"question_augmenter.py: Hybrid-Modell (Knotengebundene Fragen überschreiben Prompt-Defaults)",
|
|
"result_container_parser.py: Markdown-Sektionen (Analysekern, Entscheidungsanteil, Begründungsanker)",
|
|
"Integration in execute_base_prompt(): Fragenergänzung vor LLM-Call, Parsing nach LLM-Response",
|
|
"API-Router workflow_questions.py: CRUD für workflow_question_catalog",
|
|
"Unit-Tests Phase 1: 25 Tests (question_augmenter + result_container_parser)",
|
|
]
|
|
},
|
|
{
|
|
"version": "0.9i",
|
|
"date": "2026-04-03",
|
|
"changes": [
|
|
"Phase 0: Workflow Engine Foundation",
|
|
"DB-Migration 034: workflow_definitions, workflow_question_catalog, workflow_executions",
|
|
"Pydantic-Modelle für Workflow-Graph (WorkflowGraph, Node, Edge, Condition)",
|
|
"Graph-Parsing, Topologische Sortierung, DAG-Validierung",
|
|
"Dispatcher-Erweiterung: type='workflow' (Stub-Implementierung)",
|
|
"Unit-Tests für Phase 0 (Graph-Parsing, Zyklen-Erkennung, Erreichbarkeit)",
|
|
]
|
|
},
|
|
{
|
|
"version": "0.9h+",
|
|
"date": "2026-03-28",
|
|
"changes": [
|
|
"Phase 0c: Multi-Layer Data Architecture Complete",
|
|
"Data Layer Migration (97 Funktionen in 6 Modulen)",
|
|
"20 neue Chart Endpoints (E1-E5, A1-A8, R1-R5, C1-C4)",
|
|
"Single Source of Truth für Datenberechnungen",
|
|
]
|
|
},
|
|
]
|