-
Notifications
You must be signed in to change notification settings - Fork 0
component risk normalizer
현재 Risk Normalizer는 독립 서비스가 아니라 Lambda Data Processor 내부의
processor/normalizer.py모듈이다.
Risk Normalizer는 IoT 메시지의 payload를 Safety Score 계산과 Dashboard 저장 계약에 맞는 공통 필드로 변환한다.
canonical JSON envelope
-> envelope.parse()
-> processor.normalizer.normalize_*()
-> processor.risk.calculate()
-> DynamoDB / S3 processed
원본은 IoT Rule이 S3 raw/에 별도로 보존한다. Normalizer는 raw object를 다시 읽는 배치 서비스가 아니라, Lambda에 전달된 이벤트 payload를 즉시 정규화한다.
apps/data-processor/processor/normalizer.py
| 함수 | 입력 source_type
|
출력 |
|---|---|---|
normalize_factory_state() |
factory_state |
센서/AI 대표값 |
normalize_infra_state() |
infra_state |
heartbeat, node, workload, device 상태 |
normalize_image_snapshot() |
image_snapshot |
S3 image metadata |
payload.sensor와 payload.ai_result를 아래 필드로 변환한다.
| 출력 필드 | 원본 |
|---|---|
aggregation_window_seconds |
payload.aggregation_window_seconds |
temperature_celsius |
sensor.temperature_celsius_avg |
humidity_percent |
sensor.humidity_percent_avg |
pressure_hpa |
sensor.pressure_hpa_avg |
sample_count |
sensor.sample_count |
fire_score |
ai_result.fire_score |
fall_score |
ai_result.fall_score |
bend_score |
ai_result.bend_score |
abnormal_sound |
ai_result.abnormal_sound |
ai_sample_count |
ai_result.sample_count |
숫자는 float/int로 강제 변환하고, 누락 또는 변환 실패 값은 계산 가능한 기본값으로 처리한다.
payload.heartbeat, cluster, node_summary, workload_summary, nodes, workloads, devices를 통합한다.
| 출력 영역 | 주요 필드 |
|---|---|
| heartbeat |
agent_status, last_successful_publish_at, last_spool_write_status, publish_sequence
|
| cluster |
cluster_name, kubernetes_version
|
| node summary |
nodes_total, nodes_ready, node_summary
|
| workload summary |
pods_total, pods_ready, workload_summary
|
| nodes |
node_id, role, ready, status, CPU/Memory/Disk 사용률, network_reachability
|
| workloads | namespace/name/status/ready/container count/restart count/node_id |
| devices |
available, status, last_seen_at
|
nodes_ready와 pods_ready는 summary가 없으면 node/workload 배열에서 계산한다.
이미지 이벤트는 binary가 아니라 참조 metadata로 정규화한다.
| 출력 필드 | 의미 |
|---|---|
event_type |
이미지 이벤트 유형 |
content_type |
MIME type |
size_bytes |
object 크기 |
sha256 |
content hash |
s3_bucket |
image bucket |
s3_key |
image key |
local_path |
edge local path, 있으면 보존 |
upload_status |
업로드 상태 |
apps/risk-normalizer/ 또는 별도 K8s 서비스 설명은 레거시 설계로 본다. 현재 배포 단위는 data-processor Lambda 하나이며, Terraform infra/data-pipeline/lambda.tf가 apps/data-processor 디렉터리를 zip으로 패키징한다.
관련 문서
- 시스템 아키텍처
- 제어 & 데이터 플레인
- Dashboard VPC 설계
- 하드웨어 배치
- Hub EKS 네임스페이스
- Tailscale Mesh VPN
- 데이터 생명주기
- 데이터 조회 모델
- 실시간 갱신 구조
- IoT 데이터 계약
- Reporting Pipeline
- 로컬 스토리지
- 클라우드 스토리지
- Edge Agent
- Edge AI 탐지
- Factory-A Log Adapter
- Dummy Sensor
- Edge IoT Publisher
- Lambda Data Processor
- Risk Normalizer
- Risk Score Engine
- Pipeline Status Aggregator
- Graph Aggregator 5m
- Cloud Infra Collector
- Daily Report Generator
- Risk Alert Dispatcher
- Image Snapshot Pipeline
- Dashboard Backend
- Dashboard Web
- AI 채팅 어시스턴트