Skip to content

Commit 6b806c5

Browse files
author
Tom Softreck
committed
update
1 parent e046fe4 commit 6b806c5

15 files changed

+1394
-88
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
.idea
2-
2+
.old
3+
old
4+
cleanup_old_repo.sh
5+
poetry.lock
36
# Byte-compiled / optimized / DLL files
47
__pycache__/
58
*.py[cod]

MANIFEST.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
include README.md
2+
include LICENSE
3+
include CHANGELOG.md
4+
include requirements.txt
5+
recursive-include dialogchain *.py
6+
recursive-include examples *
7+
recursive-include tests *
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# Advanced Camera Processing Routes
2+
# Demonstrates multi-stage processing with different languages
3+
4+
routes:
5+
- name: "advanced_camera_detection"
6+
from: "rtsp://{{CAMERA_USER}}:{{CAMERA_PASS}}@{{CAMERA_IP}}/stream1"
7+
8+
processors:
9+
# Stage 1: Python YOLO object detection
10+
- type: "external"
11+
command: "python scripts/detect_objects.py"
12+
input_format: "json"
13+
output_format: "json"
14+
config:
15+
confidence_threshold: 0.6
16+
model: "yolov8n.pt"
17+
target_objects: ["person", "car", "motorcycle", "bicycle"]
18+
batch_processing: false
19+
20+
# Stage 2: Go-based risk assessment and zone analysis
21+
- type: "external"
22+
command: "go run scripts/image_processor.go"
23+
input_format: "json"
24+
output_format: "json"
25+
config:
26+
zone_mapping: "entrance:critical,parking:medium,garden:low"
27+
threat_threshold: 0.7
28+
risk_factors: "time_of_day,object_type,zone,confidence"
29+
30+
# Stage 3: C++ performance optimization and NMS
31+
- type: "external"
32+
command: "./bin/cpp_postprocessor"
33+
input_format: "json"
34+
output_format: "json"
35+
config:
36+
algorithm: "fast_nms"
37+
nms_threshold: 0.5
38+
confidence_threshold: 0.7
39+
40+
# Stage 4: Filter only high-risk detections
41+
- type: "filter"
42+
condition: "{{threat_level}} in ['high', 'critical']"
43+
44+
# Stage 5: Node.js business rules engine
45+
- type: "external"
46+
command: "node scripts/business_rules.js"
47+
input_format: "json"
48+
output_format: "json"
49+
config:
50+
rules_file: "security_rules.json"
51+
business_hours: "09:00-17:00"
52+
escalation_time: 300
53+
54+
# Stage 6: Transform to alert format
55+
- type: "transform"
56+
template: |
57+
🚨 SECURITY ALERT - {{camera_name}}
58+
59+
Threat Level: {{threat_level}} ({{business_priority}})
60+
Time: {{timestamp}}
61+
Location: {{zone}} ({{position}})
62+
63+
Detections:
64+
{{#enhanced_detections}}
65+
• {{object_type}} - Confidence: {{confidence}}% - Risk: {{risk_score}}
66+
Recommended Action: {{recommended_action}}
67+
{{/enhanced_detections}}
68+
69+
Business Context:
70+
Business Hours: {{#business_context.is_business_hours}}Yes{{/business_context.is_business_hours}}{{^business_context.is_business_hours}}No{{/business_context.is_business_hours}}
71+
Zone Risk: {{business_context.zone_risk_level}}
72+
Immediate Response Required: {{business_context.requires_immediate_response}}
73+
74+
to:
75+
- "email://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{SECURITY_EMAIL}}"
76+
- "http://{{SECURITY_WEBHOOK}}/critical-alert"
77+
- "mqtt://{{MQTT_BROKER}}:1883/security/alerts/{{CAMERA_NAME}}"
78+
- "log://logs/security_{{CAMERA_NAME}}.log"
79+
80+
- name: "camera_health_monitoring"
81+
from: "timer://2m"
82+
83+
processors:
84+
- type: "external"
85+
command: "python scripts/camera_health_check.py"
86+
config:
87+
camera_endpoints: "{{CAMERA_HEALTH_ENDPOINTS}}"
88+
timeout: 10
89+
expected_fps: 25
90+
91+
- type: "filter"
92+
condition: "{{status}} != 'healthy'"
93+
94+
to: "email://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{ADMIN_EMAIL}}"
95+
96+
- name: "motion_detection_backup"
97+
from: "rtsp://{{BACKUP_CAMERA_USER}}:{{BACKUP_CAMERA_PASS}}@{{BACKUP_CAMERA_IP}}/stream1"
98+
99+
processors:
100+
- type: "external"
101+
command: "python scripts/motion_detector.py"
102+
config:
103+
sensitivity: 0.3
104+
min_area: 5000
105+
background_subtraction: true
106+
107+
- type: "aggregate"
108+
strategy: "collect"
109+
timeout: "30s"
110+
max_size: 5
111+
112+
- type: "transform"
113+
template: "Motion detected on backup camera: {{count}} events in last 30s"
114+
115+
to: "log://logs/motion_backup.log"
116+
117+
env_vars:
118+
- CAMERA_USER
119+
- CAMERA_PASS
120+
- CAMERA_IP
121+
- CAMERA_NAME
122+
- BACKUP_CAMERA_USER
123+
- BACKUP_CAMERA_PASS
124+
- BACKUP_CAMERA_IP
125+
- SMTP_SERVER
126+
- SMTP_PORT
127+
- SMTP_USER
128+
- SMTP_PASS
129+
- SECURITY_EMAIL
130+
- ADMIN_EMAIL
131+
- SECURITY_WEBHOOK
132+
- MQTT_BROKER
133+
- CAMERA_HEALTH_ENDPOINTS
134+
135+
settings:
136+
max_concurrent_routes: 5
137+
default_timeout: 60
138+
log_level: "info"
139+
metrics_enabled: true
140+
health_check_port: 8080
141+
frame_skip_ratio: 3
142+
max_memory_usage: "2GB"
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# gRPC-based ML Pipeline Routes
2+
# Demonstrates microservices architecture with gRPC communication
3+
4+
routes:
5+
- name: "ml_inference_pipeline"
6+
from: "grpc://0.0.0.0:50051/ImageProcessingService/ProcessBatch"
7+
8+
processors:
9+
# Rust preprocessing for performance
10+
- type: "external"
11+
command: "cargo run --bin data_preprocessor"
12+
input_format: "json"
13+
output_format: "json"
14+
config:
15+
batch_size: 32
16+
normalize: true
17+
parallel: true
18+
simd_enabled: true
19+
20+
# Python ML inference
21+
- type: "external"
22+
command: "python scripts/grpc_ml_client.py"
23+
input_format: "json"
24+
output_format: "json"
25+
config:
26+
grpc_server: "{{ML_GRPC_SERVER}}"
27+
model_name: "{{ML_MODEL_NAME}}"
28+
timeout: 30
29+
batch_mode: true
30+
31+
# Go post-processing and validation
32+
- type: "external"
33+
command: "go run scripts/inference_validator.go"
34+
config:
35+
validation_rules: "{{VALIDATION_RULES}}"
36+
confidence_threshold: 0.8
37+
38+
# C++ optimization for real-time requirements
39+
- type: "external"
40+
command: "./bin/cpp_postprocessor"
41+
config:
42+
algorithm: "fast_nms"
43+
optimization: "speed"
44+
max_latency_ms: 100
45+
46+
to:
47+
- "grpc://{{RESULT_GRPC_SERVER}}/ResultService/StoreResults"
48+
- "mqtt://{{MQTT_BROKER}}:1883/ml/results"
49+
50+
- name: "model_performance_monitoring"
51+
from: "timer://5m"
52+
53+
processors:
54+
- type: "external"
55+
command: "python scripts/model_metrics_collector.py"
56+
config:
57+
models: "{{MONITORED_MODELS}}"
58+
metrics: "accuracy,latency,throughput,error_rate"
59+
60+
- type: "filter"
61+
condition: "{{accuracy}} < 0.9 or {{latency_ms}} > 500"
62+
63+
- type: "transform"
64+
template: |
65+
Model Performance Alert:
66+
Model: {{model_name}}
67+
Accuracy: {{accuracy}}
68+
Latency: {{latency_ms}}ms
69+
Error Rate: {{error_rate}}%
70+
71+
to: "email://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{ML_TEAM_EMAIL}}"
72+
73+
- name: "distributed_batch_processing"
74+
from: "file:///data/batch_queue/*.json"
75+
76+
processors:
77+
- type: "aggregate"
78+
strategy: "collect"
79+
timeout: "1m"
80+
max_size: 100
81+
82+
- type: "external"
83+
command: "python scripts/batch_distributor.py"
84+
config:
85+
worker_nodes: "{{WORKER_NODES}}"
86+
distribution_strategy: "round_robin"
87+
max_workers: 10
88+
89+
to: "grpc://{{BATCH_RESULT_SERVER}}/BatchService/ProcessResults"
90+
91+
env_vars:
92+
- ML_GRPC_SERVER
93+
- ML_MODEL_NAME
94+
- RESULT_GRPC_SERVER
95+
- MQTT_BROKER
96+
- VALIDATION_RULES
97+
- MONITORED_MODELS
98+
- ML_TEAM_EMAIL
99+
- WORKER_NODES
100+
- BATCH_RESULT_SERVER
101+
102+
settings:
103+
grpc_max_message_size: "100MB"
104+
grpc_keepalive_time: "30s"
105+
grpc_keepalive_timeout: "5s"
106+
grpc_keepalive_permit_without_calls: true
107+
max_concurrent_routes: 3
108+
default_timeout: 120

0 commit comments

Comments
 (0)