🔧 볼트 재질 정보 개선 및 A320/A194M 패턴 지원
Some checks failed
SonarQube Analysis / SonarQube Scan (push) Has been cancelled
Some checks failed
SonarQube Analysis / SonarQube Scan (push) Has been cancelled
- bolt_classifier.py: A320/A194M 조합 패턴 처리 로직 추가 - material_grade_extractor.py: A320/A194M 패턴 추출 개선 - integrated_classifier.py: SPECIAL, U_BOLT 카테고리 우선 분류 - 데이터베이스: 492개 볼트의 material_grade를 완전한 형태로 업데이트 - A320/A194M GR B8/8: 78개 - A193/A194 GR B7/2H: 414개 - 프론트엔드: BOLT 카테고리 전용 UI (길이 표시) - Excel 내보내기: BOLT용 컬럼 순서 및 재질 정보 개선 - SPECIAL, U_BOLT 카테고리 지원 추가
This commit is contained in:
@@ -129,6 +129,83 @@ CREATE INDEX IF NOT EXISTS idx_support_details_material_id ON support_details(ma
|
||||
CREATE INDEX IF NOT EXISTS idx_support_details_file_id ON support_details(file_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_support_details_support_type ON support_details(support_type);
|
||||
|
||||
-- 8. SPECIAL 카테고리 지원 추가
|
||||
-- ================================
|
||||
|
||||
-- SPECIAL 카테고리 관련 인덱스 추가 (성능 최적화)
|
||||
CREATE INDEX IF NOT EXISTS idx_materials_special_category
|
||||
ON materials(classified_category)
|
||||
WHERE classified_category = 'SPECIAL';
|
||||
|
||||
-- SPECIAL 키워드 패턴 테이블
|
||||
CREATE TABLE IF NOT EXISTS special_classification_patterns (
|
||||
id SERIAL PRIMARY KEY,
|
||||
pattern_type VARCHAR(20) NOT NULL, -- 'KEYWORD', 'REGEX', 'EXACT'
|
||||
pattern_value VARCHAR(200) NOT NULL,
|
||||
description TEXT,
|
||||
priority INTEGER DEFAULT 1, -- 우선순위 (낮을수록 높은 우선순위)
|
||||
is_active BOOLEAN DEFAULT TRUE,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- 기본 SPECIAL 키워드 패턴 삽입
|
||||
INSERT INTO special_classification_patterns (pattern_type, pattern_value, description, priority) VALUES
|
||||
('KEYWORD', 'SPECIAL', '영문 SPECIAL 키워드', 1),
|
||||
('KEYWORD', '스페셜', '한글 스페셜 키워드', 1),
|
||||
('KEYWORD', 'SPEC', '영문 SPEC 축약어', 2),
|
||||
('KEYWORD', 'SPL', '영문 SPL 축약어', 2)
|
||||
ON CONFLICT DO NOTHING;
|
||||
|
||||
-- SPECIAL 자재 상세 정보 테이블 (도면 업로드 관련)
|
||||
CREATE TABLE IF NOT EXISTS special_material_details (
|
||||
id SERIAL PRIMARY KEY,
|
||||
material_id INTEGER REFERENCES materials(id) ON DELETE CASCADE,
|
||||
file_id INTEGER REFERENCES files(id) ON DELETE CASCADE,
|
||||
|
||||
-- 도면 정보
|
||||
drawing_number VARCHAR(100), -- 도면 번호
|
||||
drawing_revision VARCHAR(20), -- 도면 리비전
|
||||
drawing_uploaded BOOLEAN DEFAULT FALSE, -- 도면 업로드 여부
|
||||
drawing_file_path TEXT, -- 도면 파일 경로
|
||||
|
||||
-- 특수 요구사항
|
||||
special_requirements TEXT, -- 특수 제작 요구사항
|
||||
manufacturing_notes TEXT, -- 제작 참고사항
|
||||
approval_required BOOLEAN DEFAULT TRUE, -- 승인 필요 여부
|
||||
approved_by VARCHAR(100), -- 승인자
|
||||
approved_at TIMESTAMP, -- 승인 일시
|
||||
|
||||
-- 분류 정보
|
||||
classification_confidence FLOAT DEFAULT 1.0,
|
||||
classification_reason TEXT, -- 분류 근거
|
||||
|
||||
-- 관리 정보
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- SPECIAL 관련 인덱스
|
||||
CREATE INDEX IF NOT EXISTS idx_special_patterns_type ON special_classification_patterns(pattern_type);
|
||||
CREATE INDEX IF NOT EXISTS idx_special_patterns_active ON special_classification_patterns(is_active);
|
||||
CREATE INDEX IF NOT EXISTS idx_special_details_material ON special_material_details(material_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_special_details_drawing_uploaded ON special_material_details(drawing_uploaded);
|
||||
|
||||
-- 기존 자재 중 SPECIAL 키워드가 포함된 자재를 SPECIAL 카테고리로 재분류
|
||||
UPDATE materials
|
||||
SET
|
||||
classified_category = 'SPECIAL',
|
||||
classification_confidence = 1.0,
|
||||
classified_at = CURRENT_TIMESTAMP
|
||||
WHERE
|
||||
(
|
||||
UPPER(original_description) LIKE '%SPECIAL%' OR
|
||||
UPPER(original_description) LIKE '%스페셜%' OR
|
||||
UPPER(original_description) LIKE '%SPEC%' OR
|
||||
UPPER(original_description) LIKE '%SPL%'
|
||||
)
|
||||
AND (classified_category IS NULL OR classified_category != 'SPECIAL');
|
||||
|
||||
-- 7. 기존 데이터 정리 (선택사항)
|
||||
-- ================================
|
||||
|
||||
|
||||
Reference in New Issue
Block a user