feat: 자재 분류 시스템 대폭 개선

🔧 주요 개선사항:
- EXCLUDE 분류기 추가 (WELD GAP 등 제외 대상 처리)
- FITTING 분류기 키워드 확장 (ELL, RED 추가)
- PIPE 재질 중복 문제 해결 (material_grade 파싱 개선)
- NIPPLE 특별 처리 추가 (스케줄 + 길이 정보 포함)
- OLET 타입 중복 표시 제거

📊 분류 정확도:
- UNKNOWN: 0개 (100% 분류 성공)
- EXCLUDE: 1,014개 (제외 대상)
- 실제 자재: 1,823개 정확 분류

🎯 해결된 문제:
- PIPE 재질 'ASTM A106 ASTM A106' → 'ASTM A106 GR B'
- WELD GAP 오분류 → EXCLUDE 카테고리
- FITTING 키워드 인식 실패 → ELL, RED 키워드 추가
- 프론트엔드 중복 표시 제거
This commit is contained in:
Hyungi Ahn
2025-07-18 10:28:02 +09:00
parent 82f057a0c9
commit 25ce3590ee
11 changed files with 857 additions and 1923 deletions

View File

@@ -374,15 +374,13 @@ async def upload_file(
pipe_insert_query = text("""
INSERT INTO pipe_details (
material_id, file_id, size_inches, schedule_type, material_spec,
manufacturing_method, length_mm, outer_diameter_mm, wall_thickness_mm,
weight_per_meter_kg, classification_confidence, additional_info
material_id, file_id, outer_diameter, schedule,
material_spec, manufacturing_method, length_mm
)
VALUES (
(SELECT id FROM materials WHERE file_id = :file_id AND original_description = :description AND row_number = :row_number),
:file_id, :size_inches, :schedule_type, :material_spec,
:manufacturing_method, :length_mm, :outer_diameter_mm, :wall_thickness_mm,
:weight_per_meter_kg, :classification_confidence, :additional_info
:file_id, :outer_diameter, :schedule,
:material_spec, :manufacturing_method, :length_mm
)
""")
@@ -390,16 +388,12 @@ async def upload_file(
"file_id": file_id,
"description": material_data["original_description"],
"row_number": material_data["row_number"],
"size_inches": pipe_info.get('nominal_diameter', ''),
"schedule_type": pipe_info.get('schedule', ''),
"outer_diameter": pipe_info.get('nominal_diameter', ''),
"schedule": pipe_info.get('schedule', ''),
"material_spec": pipe_info.get('material_spec', ''),
"manufacturing_method": pipe_info.get('manufacturing_method', ''),
"length_mm": length_mm,
"outer_diameter_mm": pipe_info.get('outer_diameter_mm'),
"wall_thickness_mm": pipe_info.get('wall_thickness_mm'),
"weight_per_meter_kg": pipe_info.get('weight_per_meter_kg'),
"classification_confidence": classification_result.get('overall_confidence', 0.0),
"additional_info": json.dumps(pipe_info, ensure_ascii=False)
})
print(f"PIPE 상세정보 저장 완료: {material_data['original_description']}")
@@ -713,7 +707,7 @@ async def get_materials(
try:
query = """
SELECT m.id, m.file_id, m.original_description, m.quantity, m.unit,
m.size_spec, m.material_grade, m.line_number, m.row_number,
m.size_spec, m.main_nom, m.red_nom, m.material_grade, m.line_number, m.row_number,
m.classified_category, m.classification_confidence, m.classification_details,
m.created_at,
f.original_filename, f.project_id, f.job_no, f.revision,