Files
TK-BOM-Project/backend/app/services/test_pipe_classifier.py
Hyungi Ahn 12ecb93741 feat: 완전한 자재 분류 시스템 구현 (v1.0)
🎯 주요 기능:
- 재질 분류 모듈 (ASTM/ASME 규격 자동 인식)
- PIPE 분류 시스템 (제조방법, 끝가공, 스케줄, 절단계획)
- FITTING 분류 시스템 (10가지 타입, 연결방식, 압력등급)
- FLANGE 분류 시스템 (SPECIAL/STANDARD 구분, 면가공)
- 스풀 관리 시스템 (도면별 A,B,C 넘버링, 에리어 관리)

📁 새로 추가된 파일들:
- app/services/materials_schema.py (재질 규격 데이터베이스)
- app/services/material_classifier.py (공통 재질 분류 엔진)
- app/services/pipe_classifier.py (파이프 전용 분류기)
- app/services/fitting_classifier.py (피팅 전용 분류기)
- app/services/flange_classifier.py (플랜지 전용 분류기)
- app/services/spool_manager_v2.py (수정된 스풀 관리)
- app/services/test_*.py (각 시스템별 테스트 파일)

🔧 기술적 특징:
- 정규표현식 기반 패턴 매칭
- 신뢰도 점수 시스템 (0.0-1.0)
- 증거 기반 분류 (evidence tracking)
- 모듈화된 구조 (재사용 가능)

🎯 분류 정확도:
- 재질 분류: 90-95% 신뢰도
- PIPE 분류: 85-95% 신뢰도
- FITTING 분류: 85-95% 신뢰도
- FLANGE 분류: 85-95% 신뢰도

💾 데이터베이스 연동:
- 모든 분석 결과 자동 저장
- 프로젝트/도면 정보 자동 연결
- 스풀 정보 사용자 입력 대기

🧪 테스트 커버리지:
- 실제 BOM 데이터 기반 테스트
- 예외 케이스 처리
- 10+ 개 테스트 시나리오

Version: v1.0
Date: 2024-07-15
Author: hyungiahn
2025-07-15 09:43:39 +09:00

56 lines
1.7 KiB
Python

"""
PIPE 분류 테스트
"""
from .pipe_classifier import classify_pipe, generate_pipe_cutting_plan
def test_pipe_classification():
"""PIPE 분류 테스트"""
test_cases = [
{
"dat_file": "PIP_PE",
"description": "PIPE, SMLS, SCH 80, ASTM A106 GR B BOE-POE",
"main_nom": "1\"",
"length": 798.1965
},
{
"dat_file": "NIP_TR",
"description": "NIPPLE, SMLS, SCH 80, ASTM A106 GR B PBE",
"main_nom": "1\"",
"length": 75.0
},
{
"dat_file": "PIPE_SPOOL",
"description": "PIPE SPOOL, WELDED, SCH 40, CS",
"main_nom": "2\"",
"length": None
}
]
print("🔧 PIPE 분류 테스트 시작\n")
for i, test in enumerate(test_cases, 1):
result = classify_pipe(
test["dat_file"],
test["description"],
test["main_nom"],
test["length"]
)
cutting_plan = generate_pipe_cutting_plan(result)
print(f"테스트 {i}:")
print(f" 입력: {test['description']}")
print(f" 재질: {result['material']['standard']} | {result['material']['grade']}")
print(f" 제조방법: {result['manufacturing']['method']}")
print(f" 끝가공: {result['end_preparation']['cutting_note']}")
print(f" 스케줄: {result['schedule']['schedule']}")
print(f" 절단치수: {result['cutting_dimensions']['length_mm']}mm")
print(f" 전체신뢰도: {result['overall_confidence']}")
print(f" 절단지시: {cutting_plan['cutting_instruction']}")
print()
if __name__ == "__main__":
test_pipe_classification()