feat: enhance revision logic with fuzzy matching, dynamic material loading, and schema automation

- Improved RevisionComparator with fuzzy matching (RapidFuzz) and dynamic DB material loading
- Enhanced regex patterns for better size/material extraction
- Initialized Alembic for schema migrations and created baseline migration
- Added entrypoint.sh for automated migrations in Docker
- Fixed SyntaxError in fitting_classifier.py
- Updated test suite with new functionality tests
This commit is contained in:
Hyungi Ahn
2026-01-09 09:36:40 +09:00
parent afea8428b2
commit f16bc662ad
11 changed files with 1575 additions and 76 deletions

View File

@@ -253,17 +253,28 @@ def classify_fitting(dat_file: str, description: str, main_nom: str,
is_instrument = any(kw in desc_upper for kw in instrument_keywords)
if is_instrument:
fitting_type["category"] = "INSTRUMENT_FITTING"
if "SWAGELOK" in desc_upper: fitting_type["brand"] = "SWAGELOK"
fitting_type_result["category"] = "INSTRUMENT_FITTING"
if "SWAGELOK" in desc_upper: fitting_type_result["brand"] = "SWAGELOK"
# Tube OD 추출 (예: 1/4", 6MM, 12MM)
tube_match = re.search(r'(\d+(?:/\d+)?)\s*(?:\"|INCH|MM)\s*(?:OD|TUBE)', desc_upper)
if tube_match:
fitting_type["tube_od"] = tube_match.group(0)
fitting_type_result["tube_od"] = tube_match.group(0)
return {
"category": "FITTING",
"fitting_type": fitting_type,
"fitting_type": fitting_type_result,
"connection_method": connection_result,
"pressure_rating": pressure_result,
"schedule": schedule_result,
"manufacturing": manufacturing_result,
"overall_confidence": calculate_fitting_confidence({
"material": material_result.get("confidence", 0),
"fitting_type": fitting_type_result.get("confidence", 0),
"connection": connection_result.get("confidence", 0),
"pressure": pressure_result.get("confidence", 0)
})
}
def analyze_size_pattern_for_fitting_type(description: str, main_nom: str, red_nom: str = None) -> Dict: