A-SW Hub / Repositories
Local Gitea · READ ONLY
← 저장소 Repositories
REPOSITORY

tymict/icu-safety-runtime Private

[참조 MVP] ICU 안전·실시간 런타임 — 비상정지, 통신 Watchdog과 치명 고장을 단일 안전상태로 집계합니다.

https://git.agrithing.ai/tymict/icu-safety-runtime.git
8 commits
COMMIT DETAIL

feat: add executable reference MVP

A-SW Reference Factory <[email protected]> · 2026. 8. 2. 오전 7:37:57
ef5795a036a0bb74000c9f467a3d55732e0c667b
5 changed files +39 −0 parent b51bddf
added asw_component/__init__.py +3−0 View file
@@ -0,0 +1,3 @@
1 + from .component import execute
2 +
3 + __all__ = ["execute"]
added asw_component/component.py +12−0 View file
@@ -0,0 +1,12 @@
1 + from __future__ import annotations
2 +
3 + def execute(payload: dict) -> dict:
4 + reasons = []
5 + if payload.get("emergency_stop"):
6 + reasons.append("emergency_stop")
7 + if payload.get("critical_faults"):
8 + reasons.extend(f"fault:{code}" for code in payload["critical_faults"])
9 + if float(payload.get("watchdog_age_ms", 0)) > float(payload.get("watchdog_limit_ms", 100)):
10 + reasons.append("watchdog_timeout")
11 + state = "SAFE_STOP" if reasons else "RUN"
12 + return {"state": state, "traction_enabled": state == "RUN", "reasons": reasons, "reset_required": bool(reasons)}
added examples/input.json +6−0 View file
@@ -0,0 +1,6 @@
1 + {
2 + "emergency_stop": false,
3 + "critical_faults": [],
4 + "watchdog_age_ms": 45,
5 + "watchdog_limit_ms": 100
6 + }
added pyproject.toml +8−0 View file
@@ -0,0 +1,8 @@
1 + [project]
2 + name = "icu_safety_runtime"
3 + version = "0.1.0"
4 + description = "비상정지, 통신 Watchdog과 치명 고장을 단일 안전상태로 집계합니다."
5 + requires-python = ">=3.11"
6 +
7 + [tool.unittest]
8 + test-path = "tests"
added run.py +10−0 View file
@@ -0,0 +1,10 @@
1 + from __future__ import annotations
2 + import json
3 + import sys
4 + from asw_component import execute
5 +
6 + if __name__ == "__main__":
7 + path = sys.argv[1] if len(sys.argv) > 1 else None
8 + with open(path, encoding="utf-8") if path else sys.stdin as source:
9 + payload = json.load(source)
10 + print(json.dumps(execute(payload), ensure_ascii=False, indent=2))