File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,6 +54,9 @@ def load_libre(file_path: str) -> pd.Series:
5454 # Convert 'time' column to datetime
5555 df ['time' ] = pd .to_datetime (df ['time' ], format = format )
5656
57+ # Convert glucose values to numeric
58+ df ['glc' ] = pd .to_numeric (df ['glc' ], errors = 'coerce' )
59+
5760 # convert to mg/dL if needed
5861 if convert :
5962 df ['glc' ] = df ['glc' ] * 18.01559
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44
55[project ]
66name = " iglu_python"
7- version = " 0.2.1 "
7+ version = " 0.2.4 "
88description = " Python implementation of the iglu package for continuous glucose monitoring data analysis"
99readme = " README.md"
1010requires-python = " >=3.11"
Original file line number Diff line number Diff line change @@ -197,4 +197,18 @@ def test_load_dexcom_time_interval(test_data_paths):
197197 tolerance = pd .Timedelta (minutes = 2 ) # Allow some variation
198198 # Check that most intervals are close to expected
199199 close_intervals = time_diffs [abs (time_diffs - expected_interval ) <= tolerance ]
200- assert len (close_intervals ) / len (time_diffs ) > 0.8 # At least 80% should be close
200+ assert len (close_intervals ) / len (time_diffs ) > 0.8 # At least 80% should be close
201+
202+ def test_load_libre_numeric_values (test_data_paths ):
203+ timeseries = load_libre (str (test_data_paths ['libre_amer_01' ]))
204+ # Check that all values are numeric
205+ assert pd .api .types .is_numeric_dtype (timeseries )
206+ # Check that there are no NaN values (all should be valid numbers)
207+ assert not timeseries .isna ().any ()
208+
209+ def test_load_dexcom_numeric_values (test_data_paths ):
210+ timeseries = load_dexcom (str (test_data_paths ['dexcom_eur_01' ]))
211+ # Check that all values are numeric
212+ assert pd .api .types .is_numeric_dtype (timeseries )
213+ # Check that there are no NaN values (all should be valid numbers)
214+ assert not timeseries .isna ().any ()
You can’t perform that action at this time.
0 commit comments