Version: 0.5.0
Target: Developers / Entwickler
VPB follows a layered architecture with clear separation of concerns.
VPB folgt einer Schichtenarchitektur mit klarer Aufgabentrennung.
┌─────────────────────────────────────────────────────────┐
│ Presentation Layer │
│ (UI / Views / Dialogs) │
├─────────────────────────────────────────────────────────┤
│ Application Layer │
│ (Controllers / Coordinators) │
├─────────────────────────────────────────────────────────┤
│ Business Logic Layer │
│ (Services / Domain Logic) │
├─────────────────────────────────────────────────────────┤
│ Data Layer │
│ (Models / Repositories) │
├─────────────────────────────────────────────────────────┤
│ Infrastructure Layer │
│ (Event Bus / Settings / Persistence) │
└─────────────────────────────────────────────────────────┘
Location: vpb/ui/, vpb/views/
Responsibilities:
- User interface components
- User input handling
- Display logic
- Visual feedback
Key Components:
- Canvas (process visualization)
- Palette (element library)
- Properties panel
- Dialogs and wizards
Technology:
- PyQt6 (GUI framework)
- Custom widgets
- Event-driven UI
Location: vpb/controllers/
Responsibilities:
- Coordinate between layers
- Handle user actions
- Manage application flow
- Event orchestration
Key Controllers:
DocumentController- Document operationsElementController- Element managementConnectionController- Connection handlingValidationController- Process validationExportController- Export operationsAIController- AI featuresLayoutController- Auto-layout
Pattern: Event-driven architecture with message bus
Location: vpb/services/
Responsibilities:
- Business rules
- Process validation
- Export logic
- AI integration
- Layout algorithms
Key Services:
DocumentService- CRUD operationsValidationService- Validation rulesExportService- Multi-format exportLayoutService- Auto-layout algorithmsAIService- AI/ML integrationAutosaveService- Auto-save functionalityBackupService- Backup management
Location: vpb/models/
Responsibilities:
- Data structures
- Domain models
- Validation rules
- Serialization
Key Models:
DocumentModel- Process documentVPBElement- Process elementsVPBConnection- Element connectionsPaletteModel- Element palette
Patterns:
- Observer pattern (model changes)
- Factory pattern (element creation)
- Builder pattern (complex objects)
Location: vpb/infrastructure/, core/
Responsibilities:
- Event bus
- Settings management
- User profiles
- Backend integration
Key Components:
EventBus- Pub/sub messagingSettingsManager- ConfigurationUserProfileManager- User preferencesPolyglotManager- Multi-backend persistence
Event Bus Pattern:
# Publish event
event_bus.publish("element.created", element)
# Subscribe to event
event_bus.subscribe("element.created", handler)Benefits:
- Loose coupling
- Extensibility
- Testability
Separation:
- Model: Data and business logic
- View: UI presentation
- Controller: Coordination
Flow:
User Action → View → Controller → Service → Model
↑ ↓
└──────── Event Bus ───────────┘
Model Changes:
class DocumentModel:
def add_element(self, element):
self.elements.append(element)
self.notify_observers("element_added", element)Observers:
- UI updates automatically
- Validation triggers
- Auto-save activates
Layout Algorithms:
class LayoutService:
def set_strategy(self, strategy):
self.strategy = strategy
def apply_layout(self, document):
return self.strategy.layout(document)Strategies:
- Hierarchical
- Grid
- Circular
- Force-directed
Distributed Transactions:
# UDS3 Backend Integration
transaction = saga_manager.begin_transaction()
try:
saga_manager.save_to_postgres(data)
saga_manager.save_to_neo4j(graph)
saga_manager.save_to_chroma(vectors)
saga_manager.commit()
except:
saga_manager.rollback()Benefits:
- Consistency across backends
- Rollback capability
- Error recovery
Views
├── Controllers
│ ├── Services
│ │ ├── Models
│ │ └── Infrastructure
│ └── Infrastructure (Event Bus)
└── Models (read-only)
API
├── Core (Polyglot Manager)
│ └── Backends (PostgreSQL, Neo4j, ChromaDB)
└── Models
- No circular dependencies
- Depend on abstractions, not implementations
- UI depends on controllers, not services
- Services don't depend on UI
1. User drags element from palette
↓
2. View publishes "element.drop" event
↓
3. ElementController receives event
↓
4. Controller calls ElementService.create()
↓
5. Service creates VPBElement model
↓
6. Service publishes "element.created" event
↓
7. DocumentController updates document
↓
8. Canvas view refreshes display
1. User clicks Save
↓
2. Menu publishes "document.save" event
↓
3. DocumentController receives event
↓
4. Controller calls DocumentService.save()
↓
5. Service serializes DocumentModel to JSON
↓
6. Service writes to file
↓
7. Service publishes "document.saved" event
↓
8. StatusBar shows "Saved" message
Three Backend Systems:
┌──────────────────────────────────────────────────┐
│ VPB Application Layer │
└────────────────┬─────────────────────────────────┘
│
┌───────┴────────┐
│ Polyglot Mgr │ (SAGA Pattern)
└───────┬────────┘
│
┌────────────┼────────────┐
↓ ↓ ↓
┌─────────┐ ┌─────────┐ ┌──────────┐
│PostgreSQL│ │ Neo4j │ │ChromaDB │
│ (Data) │ │(Graph) │ │(Vectors) │
└─────────┘ └─────────┘ └──────────┘
Data Distribution:
- PostgreSQL: Structured process data (CRUD)
- Neo4j: Process graph relationships
- ChromaDB: Vector embeddings for AI search
See: [[UDS3-Backend]] for details
Endpoints:
GET /api/uds3/vpb/processes
POST /api/uds3/vpb/processes
GET /api/uds3/vpb/processes/{id}
PUT /api/uds3/vpb/processes/{id}
DELETE /api/uds3/vpb/processes/{id}
GET /api/uds3/vpb/search
GET /api/uds3/vpb/health
Architecture:
Request → FastAPI → Endpoint Handler → Polyglot Manager
↓
SAGA Transaction
↓
PostgreSQL + Neo4j + ChromaDB
See: [[API-Reference]] for details
Central Message Bus:
class EventBus:
def publish(self, event_type, data):
"""Publish event to all subscribers"""
def subscribe(self, event_type, handler):
"""Subscribe to event type"""Document Events:
document.createddocument.loadeddocument.saveddocument.closed
Element Events:
element.createdelement.modifiedelement.deletedelement.selected
Connection Events:
connection.createdconnection.deleted
Validation Events:
validation.startedvalidation.completedvalidation.error
╱╲
╱ ╲ E2E Tests (10%)
╱────╲
╱ ╲ Integration Tests (20%)
╱────────╲
╱ ╲ Unit Tests (70%)
╱────────────╲
tests/
├── unit/ # Unit tests (isolated components)
├── integration/ # Integration tests (multi-component)
├── e2e/ # End-to-end tests (full workflows)
└── fixtures/ # Test data and mocks
See: [[Testing]] for details
Create new SPS elements:
class CustomElement(VPBElement):
def __init__(self):
super().__init__()
self.type = "CUSTOM"Add export format:
class CustomExporter:
def export(self, document):
# Custom export logic
passAdd layout strategy:
class CustomLayout:
def layout(self, elements):
# Custom layout logic
passAdd validation rules:
class CustomValidator:
def validate(self, element):
# Custom validation logic
passSee: [[Extension-Development]] for details
- PyQt6 - GUI framework
- Python 3.8+ - Programming language
- FastAPI - REST API framework
- Uvicorn - ASGI server
- Pydantic - Data validation
- PostgreSQL - Relational database
- Neo4j - Graph database
- ChromaDB - Vector database
- SQLAlchemy - ORM
- Ollama - Local LLM integration
- LangChain - AI orchestration (planned)
- pytest - Test framework
- pytest-qt - Qt testing
- coverage - Code coverage
-
Lazy Loading
- Load processes on demand
- Defer heavy computations
-
Caching
- Cache validation results
- Cache layout calculations
-
Async Operations
- Background tasks
- Non-blocking UI
-
Batch Updates
- Group UI updates
- Minimize redraws
Security Features:
- Input validation (Pydantic)
- SQL injection prevention (SQLAlchemy ORM)
- Type safety (Python type hints)
Future Enhancements:
- Authentication
- Authorization
- Encryption at rest
- Audit logging
Standalone Deployment:
python vpb_app.pyDevelopment:
uvicorn api.uds3_vpb_fastapi:app --reloadProduction:
uvicorn api.uds3_vpb_fastapi:app --host 0.0.0.0 --port 8000- [[Development-Guide]] - Setup development environment
- [[API-Reference]] - API documentation
- [[UDS3-Backend]] - Backend architecture
- [[Extension-Development]] - Extending VPB
[[Home]] | [[Development-Guide]] | [[API-Reference]]