fix(metadata): Update extraction logic and enhance circumference detection
Deploy Development / deploy (push) Successful in 54s
Build Test / pytest-backend (push) Successful in 3s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 16s

- Adjusted the extract_value_raw function to return failure for unavailable values in strict mode.
- Expanded the circumference detection logic in infer_unit_strict to include additional terms for better accuracy in unit inference.
This commit is contained in:
Lars committed 2026-04-10 11:25:38 +02:00
1 parent fe7a69fb07
commit 8ee9fb84ba
2 files changed
+114 -26

No files matched your search

+4 -2
View File
@@ -30,7 +30,8 @@ def extract_value_raw(value_display: str, output_type: OutputType, placeholder_t
Returns: (raw_value, success)
"""
if not value_display or value_display in ['nicht verfügbar', 'nicht genug Daten']:
return None, True
# V2 strict mode: missing/unavailable value is not a successful extraction
return None, False
# JSON output type
if output_type == OutputType.JSON:
@@ -111,7 +112,8 @@ def infer_unit_strict(key: str, description: str, output_type: OutputType, place
return 'kg'
# Circumferences/lengths
if any(x in key_lower for x in ['umfang', 'waist', 'hip', 'chest', 'arm', 'leg', 'delta']) and 'circumference' in desc_lower:
circumference_terms = ['umfang', 'waist', 'hip', 'chest', 'arm', 'leg', 'taill', 'hueft', 'brust', 'oberarm', 'oberschenkel']
if any(x in key_lower for x in circumference_terms) or any(x in desc_lower for x in ['circumference', 'umfang', 'taill', 'hüft', 'hueft', 'brust', 'oberarm', 'oberschenkel']):
return 'cm'
# Time durations