feat: Update reference values and introduce pilot visualization module
- Bumped version of reference_values module to 1.3.0. - Added new imports and functionality for reference values in the backend, enhancing data retrieval. - Introduced a new PilotVizPage in the frontend for visualizing data, linked from the SettingsPage for easy access. - Updated routing in App.jsx to include the new pilot visualization route.
This commit is contained in:
1 parent
3e916c082c
commit
932bceb1e1
10 files changed
+428
-146
No files matched your search
@@ -0,0 +1,48 @@
|
||||
"""Unit tests for data_layer.reference_values (summary assembly, no DB)."""
|
||||
|
||||
from data_layer.reference_values import build_summary_tiles_from_ranked_rows
|
||||
|
||||
|
||||
def test_build_summary_tiles_single_type_two_rows():
|
||||
raw = [
|
||||
{
|
||||
"type_key": "hr_max",
|
||||
"type_label": "HF max",
|
||||
"type_sort_order": 1,
|
||||
"value_data_type": "decimal",
|
||||
"rn": 1,
|
||||
"id": 2,
|
||||
"effective_date": "2026-04-01",
|
||||
"value_numeric": 180.0,
|
||||
"value_text": None,
|
||||
"unit": "bpm",
|
||||
},
|
||||
{
|
||||
"type_key": "hr_max",
|
||||
"type_label": "HF max",
|
||||
"type_sort_order": 1,
|
||||
"value_data_type": "decimal",
|
||||
"rn": 2,
|
||||
"id": 1,
|
||||
"effective_date": "2026-03-01",
|
||||
"value_numeric": 175.0,
|
||||
"value_text": None,
|
||||
"unit": "bpm",
|
||||
},
|
||||
]
|
||||
tiles = build_summary_tiles_from_ranked_rows(raw)
|
||||
assert len(tiles) == 1
|
||||
t = tiles[0]
|
||||
assert t["type_key"] == "hr_max"
|
||||
assert t["latest"]["value_numeric"] == 180.0
|
||||
assert t["previous"]["value_numeric"] == 175.0
|
||||
assert "sort_key" not in t
|
||||
|
||||
|
||||
def test_build_summary_tiles_multi_type_order():
|
||||
raw = [
|
||||
{"type_key": "b", "type_label": "B", "type_sort_order": 2, "value_data_type": "decimal", "rn": 1, "id": 1},
|
||||
{"type_key": "a", "type_label": "A", "type_sort_order": 1, "value_data_type": "decimal", "rn": 1, "id": 2},
|
||||
]
|
||||
tiles = build_summary_tiles_from_ranked_rows(raw)
|
||||
assert [x["type_key"] for x in tiles] == ["a", "b"]
|
||||
Reference in new issue
Block a user