Initial commit: HC900 Crawler
Honeywell HC900을 Modbus TCP로 직접 폴링 → gRPC → C# 크롤러 → PostgreSQL. 기존 Experion OPC UA 데이터 경로를 HC900 직접 통신으로 대체. - industrial-comm/cpp: C++ Modbus 게이트웨이 (gRPC 서버) - src: C# .NET 8 ASP.NET Core 크롤러 + 웹 UI (3-Layer) - mcp-server: Python FastMCP (RAG/NL2SQL/P&ID) - 다중 컨트롤러(N-Controller) 지원 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
47
mcp-server/instrument_inference/rules.py
Normal file
47
mcp-server/instrument_inference/rules.py
Normal file
@@ -0,0 +1,47 @@
|
||||
"""YAML 룰 로더 — prompts/instrument_inference.yaml을 읽고 캐싱."""
|
||||
from __future__ import annotations
|
||||
import os
|
||||
import yaml
|
||||
from functools import lru_cache
|
||||
|
||||
_RULES_PATH = os.path.join(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"..", "..", "prompts", "instrument_inference.yaml",
|
||||
)
|
||||
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
def load_rules() -> dict:
|
||||
"""YAML 룰 파일 로드 (lru_cache로 1회만 로드)."""
|
||||
with open(_RULES_PATH, "r", encoding="utf-8") as f:
|
||||
return yaml.safe_load(f)
|
||||
|
||||
|
||||
def get_measurement(letter: str) -> str | None:
|
||||
"""첫 글자 → 측정량 반환."""
|
||||
return load_rules().get("measurement", {}).get(letter)
|
||||
|
||||
|
||||
def get_modifier(letter: str) -> dict | None:
|
||||
"""수식어 글자 → role 정보 반환."""
|
||||
return load_rules().get("modifiers", {}).get(letter)
|
||||
|
||||
|
||||
def get_special_prefix(head: str) -> dict | None:
|
||||
"""특수 prefix → role 정보 반환."""
|
||||
return load_rules().get("special_prefixes", {}).get(head)
|
||||
|
||||
|
||||
def get_all_measurements() -> dict:
|
||||
"""측정량 전체 표 반환 (naming_convention 시트용)."""
|
||||
return load_rules().get("measurement", {})
|
||||
|
||||
|
||||
def get_all_modifiers() -> dict:
|
||||
"""수식어 전체 표 반환 (naming_convention 시트용)."""
|
||||
return load_rules().get("modifiers", {})
|
||||
|
||||
|
||||
def get_all_special_prefixes() -> dict:
|
||||
"""특수 prefix 전체 표 반환 (naming_convention 시트용)."""
|
||||
return load_rules().get("special_prefixes", {})
|
||||
Reference in New Issue
Block a user