System Architecture

RACE Framework Architecture

Visual overview of the Rule-Action-Cognition-Events framework showing component interactions and data flow.

RACE MES Management Console Architecture

Advanced Manufacturing Execution System with AI-powered Rule-Action-Cognition-Events framework, featuring Event-Driven Workflows, Variable Cascade Engine, Workflow Visualizer, and Multi-Provider AI Function Calling for intelligent industrial automation.

RACE Framework Overview

The RACE (Rule-Action-Cognition-Events) Management Console is built on a sophisticated event-driven architecture that enables AI-powered industrial monitoring and automation. The system follows ISA-95 standards and provides comprehensive workflow orchestration with REST API microservice actions, real-time event enrichment, and dynamic system tags resolution.

Rule Engine

AI-powered rule creation and evaluation with dynamic condition matching

Action Engine

Event-driven REST API microservice execution with automatic enrichment updates

Cognition Engine

Agentic AI investigation for autonomous MES operations analysis

Events Engine

Complete event lifecycle with real-time enrichment and action result persistence

Backend Architecture
Framework & Core
  • Flask Web Framework - Main application server
  • SQLAlchemy ORM - Database abstraction and modeling
  • APScheduler - Background task scheduling
  • Gunicorn - WSGI HTTP server for production
Data Persistence
  • PostgreSQL - Production database
  • SQLite - Development database
  • JSON Fields - Dynamic configuration storage
External Integration
  • CONNECT Data Services - AVEVA industrial data platform
  • OAuth2 Client Credentials - Secure API authentication
  • REST API - Standardized data exchange
Frontend Architecture
Template Engine
  • Jinja2 Templates - Server-side rendering
  • Template Inheritance - Consistent layout structure
  • Dynamic Content - Real-time data integration
UI Framework
  • Bootstrap 5 - Responsive design system
  • Dark Theme - Professional industrial interface
  • Custom CSS - Brand-specific styling
Interactive Components
  • Vanilla JavaScript - Core functionality
  • Chart.js - Data visualization
  • Feather Icons - Consistent iconography
Data Model Architecture
Core Configuration Models
  • Package - Logical grouping of templates
  • RuleTemplate - Reusable rule definitions
  • TemplatePlaceholder - Dynamic mapping points
  • TemplateInstance - Deployed template configurations
  • Rule - Individual rule definitions
Monitoring Models
  • MonitoredStream - Data source definitions
  • MonitoringEvent - System operation logs
  • APIConfiguration - External service settings
Event-Driven Models
  • RuleExecution - Rule evaluation history
  • RuleEvent - Business event lifecycle with enrichment
  • ActionExecution - REST API action execution tracking
  • ActionTemplate - Reusable action definitions
  • EventAuditLog - Complete change audit trails
Plant & Integration Models
  • PlantModel - ISA-95 hierarchy structure
  • AIProvider - Cognition engine configurations
  • SystemSettings - Application configuration
  • Parameter - Dynamic system parameters
Service Layer Components
Core Services
  • ConfigManager - Application configuration management
  • AVEVAClient - External API communication
  • SystemTags - Dynamic placeholder resolution
Event-Driven Processing
  • RuleEngine - Instance-based rule evaluation
  • ActionExecutor - REST API microservice orchestration
  • EventEnrichment - Dynamic data enhancement
  • PlaceholderResolver - System tags resolution
  • MonitoringEngine - Background stream monitoring
Workflow Orchestration
  • Event Lifecycle - Create, enrich, execute, persist
  • Action Execution - Automatic API calls with context
  • Result Integration - Action outputs → Event enrichment
  • Force Evaluation - Manual trigger capabilities
  • Audit Trail - Complete workflow tracking
Event-Driven Workflow Architecture

The core innovation of RACE v2.1 is the complete Event-Driven workflow orchestration that automatically executes REST API actions and enriches events with real-time data:

Rule Triggers

Stream data evaluation

Event Creation

With system tags enrichment

Action Execution

REST API microservice calls

Result Integration

Action outputs → Event enrichment

Key Workflow Features
  • Automatic System Tags: <EQUIPMENT>, <LINE> resolution
  • Dynamic Enrichment: Variables like LOTCODE populated by actions
  • REST API Integration: External microservice orchestration
  • SQLAlchemy Persistence: Action results persist to database
  • Real-time Updates: Events enriched with live action outputs
  • Force Evaluation: Manual trigger for testing and debugging
Template-Instance Architecture

The system employs a sophisticated Template-Instance pattern that enables maximum reusability and flexibility:

Templates

Generic rule definitions with placeholders like <EQUIPMENT>, <LEVEL>

Placeholder Mapping

Dynamic binding to actual data streams and equipment

Instances

Deployed, executable rule configurations with real data connections

Key Benefits
  • Reusability: One template can be deployed across multiple equipment units
  • Maintainability: Template updates automatically affect all instances
  • Flexibility: Instance-specific configurations without template modification
  • Deployment Protection: Running instances are protected from accidental changes
  • Event-Driven: Each instance automatically executes actions and enriches events
System Tags & Enrichment Architecture

Advanced dynamic placeholder resolution system that automatically enriches events with contextual data from multiple sources:

Automatic System Tags
Tag Source Example Value
<EQUIPMENT> Plant Model FLOC Roaster022
<LINE> Plant Model hierarchy Line02
<DATE> System timestamp 2025-08-17
<TIME> System timestamp 16:05:30
<SHIFT> Shift calculation Evening
Event Enrichment Variables

Variables that get populated by Action execution results:

  • LOTCODE: Production lot identifier from external systems
  • EQUIPMENT: Auto-resolved from Plant Model context
  • LINE: Production line identifier from FLOC hierarchy
  • Custom Variables: Define additional enrichment variables in rules
Action → Enrichment Flow
  1. Event created with system tag defaults
  2. Actions execute with event context
  3. Action API returns enrichment data
  4. Event enrichment updated with results
  5. Changes persisted with SQLAlchemy flag_modified()
External System Integration
CONNECT Data Services Integration
  • OAuth2 Authentication - Secure token-based access
  • Tenant/Namespace Model - Multi-tenant data isolation
  • Real-time Data Streams - Live industrial data access
  • Asset Discovery - Automatic stream detection
Data Flow Architecture
  1. Configuration setup and API authentication
  2. Asset discovery and stream registration
  3. Background monitoring with scheduled polling
  4. Rule evaluation on value changes
  5. Event creation and lifecycle management
  6. Real-time dashboard updates
ISA-95 Compliance

The system architecture follows ISA-95 standards for manufacturing operations management:

  • Plant Model Hierarchy - Enterprise → Site → Area → Line → Equipment
  • Manufacturing Operations - Production, maintenance, quality control
  • Information Integration - Bidirectional data flow between levels
  • Event Management - Standardized event classification and tracking
Security Considerations
  • Environment Variables - Sensitive data protection
  • Session Management - Secure user sessions
  • API Rate Limiting - External service protection
  • Data Validation - Input sanitization and validation