feat(csv-import): Add blood pressure and activity row diagnosis functionality
- Introduced `diagnose_blood_pressure_row` and `diagnose_activity_row` functions to validate and analyze blood pressure and activity data from CSV imports. - Updated the CSV import logic to handle combined datetime columns for blood pressure and activity, improving data integrity during import. - Enhanced type conversion specifications to include `start_time` for blood pressure and activity, ensuring accurate data mapping. - Added tests to validate the new diagnosis functions and their integration with existing import processes, ensuring robustness and reliability. - Updated frontend messages to provide clearer guidance on blood pressure and activity data handling during CSV imports.
This commit is contained in:
1 parent
c5b0540b11
commit
5b96bd4f75
9 files changed
+295
-9
No files matched your search
@@ -210,6 +210,29 @@ def test_int_flexible_thousands():
|
||||
assert convert_value("1.234", "n", {"type": "int", "flexible": True}) == 1234
|
||||
|
||||
|
||||
def test_build_row_after_mapping_column_order_independent():
|
||||
fm = {"Spalte B": "resting_hr", "Spalte A": "date"}
|
||||
tc = {
|
||||
"date": {"type": "date", "format": "yyyy-mm-dd", "flexible": True},
|
||||
"resting_hr": {"type": "int", "flexible": True},
|
||||
}
|
||||
r1 = build_row_after_mapping(
|
||||
{"Spalte A": "2026-01-15", "Spalte B": "58"}, fm, tc, module="vitals_baseline"
|
||||
)
|
||||
r2 = build_row_after_mapping(
|
||||
{"Spalte B": "58", "Spalte A": "2026-01-15"}, fm, tc, module="vitals_baseline"
|
||||
)
|
||||
assert r1 == r2
|
||||
assert r1["resting_hr"] == 58
|
||||
|
||||
|
||||
def test_int_flexible_german_decimal_rounds():
|
||||
"""Apple-DE: HRV/SpO2 als «37,26» / «95,22» — nicht 3726 aus Ziffern konkatenieren."""
|
||||
spec = {"type": "int", "flexible": True}
|
||||
assert convert_value("37,26", "hrv", spec) == 37
|
||||
assert convert_value("95,22", "spo2", spec) == 95
|
||||
|
||||
|
||||
def test_datetime_flexible():
|
||||
spec = {"type": "datetime", "format": "yyyy-mm-dd HH:MM:SS", "flexible": True}
|
||||
dtv = convert_value("15.01.2024 14:30:00", "t", spec)
|
||||
|
||||
Reference in new issue
Block a user