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

tymict/agri-hmi Private

[참조 MVP] 농기계 운용 HMI — ICU 텔레메트리를 운전자용 상태·경보·진행률 View Model로 변환합니다.

https://git.agrithing.ai/tymict/agri-hmi.git
6 commits
COMMIT DETAIL

feat: add executable reference MVP

A-SW Reference Factory <[email protected]> · 2026. 8. 2. 오전 7:37:58
781167fe8e38aa818a88704a19c246309797ef32
6 changed files +43 −0 parent 7b0c599
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 +13−0 View file
@@ -0,0 +1,13 @@
1 + from __future__ import annotations
2 +
3 + def execute(payload: dict) -> dict:
4 + total = max(float(payload.get("total_area_ha", 0)), 0)
5 + completed = max(float(payload.get("completed_area_ha", 0)), 0)
6 + progress = 0 if total == 0 else min(100, round(completed / total * 100))
7 + faults = payload.get("faults", [])
8 + return {
9 + "header": {"mode": payload.get("mode", "MANUAL"), "system": "ALERT" if faults else "NORMAL"},
10 + "motion": {"speed_mps": float(payload.get("speed_mps", 0)), "target_speed_mps": float(payload.get("target_speed_mps", 0))},
11 + "work": {"completed_area_ha": completed, "progress_percent": progress},
12 + "alerts": [{"code": fault, "severity": "critical"} for fault in faults],
13 + }
added examples/input.json +8−0 View file
@@ -0,0 +1,8 @@
1 + {
2 + "mode": "AUTO",
3 + "speed_mps": 1.4,
4 + "target_speed_mps": 1.5,
5 + "completed_area_ha": 2.1,
6 + "total_area_ha": 3,
7 + "faults": []
8 + }
added pyproject.toml +8−0 View file
@@ -0,0 +1,8 @@
1 + [project]
2 + name = "agri_hmi"
3 + version = "0.1.0"
4 + description = "ICU 텔레메트리를 운전자용 상태·경보·진행률 View Model로 변환합니다."
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))
added web/index.html +1−0 View file
@@ -0,0 +1 @@
1 + <!doctype html><html lang="ko"><meta charset="utf-8"><title>Agricultural HMI MVP</title><style>body{margin:0;background:#09090b;color:#fafafa;font:16px system-ui}.shell{max-width:900px;margin:40px auto}.top{display:flex;justify-content:space-between}.grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}.card{background:#18181b;border:1px solid #3f3f46;border-radius:12px;padding:24px}b{font-size:36px;color:#86efac}.ok{color:#4ade80}</style><div class="shell"><div class="top"><h1>농기계 운용 HMI</h1><strong class="ok">● NORMAL</strong></div><div class="grid"><div class="card">운전 모드<br><b>AUTO</b></div><div class="card">주행 속도<br><b>1.4</b> m/s</div><div class="card">작업 진행률<br><b>70%</b></div></div></div></html>
\ No newline at end of file