API Reference — AGATA¶
The AGATA integration layer wraps the AGATA reference library.
Note: AGATA is an optional dependency. Install it with
pip install cgmpy[agata].
Wrapper¶
cgmpy.agata.metrics.AgataAnalysis
¶
Bases: GlucoseData
Object-oriented bridge to the py_agata analysis pipeline.
Inherits from :class:~cgmpy.data.core.GlucoseData so it can
be constructed in exactly the same way (file path, DataFrame, etc.),
and exposes :meth:run / :meth:analyze_one_arm to drive the
py_agata analysis.
Raises:
| Type | Description |
|---|---|
AgataNotInstalledError
|
If |
EmptyDataError
|
If :meth: |
Source code in cgmpy/agata/metrics.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
run
¶
Runs the full py_agata analysis pipeline on the loaded data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
glycemic_target
|
str
|
The glycemic target to use ('diabetes', 'pregnancy', etc.). If None, uses the value defined at class initialization. |
'diabetes'
|
summary
|
bool
|
If True, returns a flat dictionary with summary metrics. If False, returns the complete nested dictionary. |
False
|
**kwargs
|
Any
|
Additional arguments for future use. |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
The results dictionary. |
Raises:
| Type | Description |
|---|---|
EmptyDataError
|
If the underlying data is empty. |
AgataNotInstalledError
|
If |
Source code in cgmpy/agata/metrics.py
Adapter¶
cgmpy.agata.adapter
¶
Adapter to prepare cgmpy data for the py_agata library.
prepare_data_for_agata
¶
prepare_data_for_agata(glucose_data: GlucoseData, resample_freq: str = '5min') -> DataFrame
Prepare a :class:~cgmpy.data.core.GlucoseData for py_agata.
The function aligns the timestamp grid by flooring every measurement to
resample_freq (default "5min"), then re-emits the data on a
homogeneous, gap-aware time grid that py_agata can consume.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
glucose_data
|
GlucoseData
|
The cgmpy data object to adapt. |
required |
resample_freq
|
str
|
Pandas frequency string for the target grid
(e.g. |
'5min'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
pd.DataFrame: A two-column DataFrame with columns:
|
Raises:
| Type | Description |
|---|---|
EmptyDataError
|
If the input is empty, if the timestamp normalization drops every row, if the cleaned data covers a zero-duration interval, or if every glucose value on the regular grid is NaN. |
Notes
The function does not convert mmol/L to mg/dL; the input is
assumed to already be in mg/dL. Unit conversion is a deferred
feature targeted at v0.9.0 (see ROADMAP.md).