netiob 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- netiob-0.1.0/LICENSE +201 -0
- netiob-0.1.0/PKG-INFO +17 -0
- netiob-0.1.0/README.md +191 -0
- netiob-0.1.0/netiob/__init__.py +0 -0
- netiob-0.1.0/netiob/tandem/__init__.py +1 -0
- netiob-0.1.0/netiob/tandem/helper.py +61 -0
- netiob-0.1.0/netiob/utils/__init__.py +0 -0
- netiob-0.1.0/netiob.egg-info/PKG-INFO +17 -0
- netiob-0.1.0/netiob.egg-info/SOURCES.txt +12 -0
- netiob-0.1.0/netiob.egg-info/dependency_links.txt +1 -0
- netiob-0.1.0/netiob.egg-info/requires.txt +11 -0
- netiob-0.1.0/netiob.egg-info/top_level.txt +1 -0
- netiob-0.1.0/pyproject.toml +21 -0
- netiob-0.1.0/setup.cfg +4 -0
netiob-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2024 CeADAR Connect Group @ CeADAR - Ireland's Centre for AI
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
netiob-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: netiob
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: NET IOB
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Requires-Dist: Flask==3.0.3
|
|
7
|
+
Requires-Dist: flask_cors==4.0.0
|
|
8
|
+
Requires-Dist: numpy==1.26.4
|
|
9
|
+
Requires-Dist: pandas<1.4,>=1.3.5
|
|
10
|
+
Requires-Dist: pyreadstat==1.2.6
|
|
11
|
+
Requires-Dist: python_dateutil==2.8.2
|
|
12
|
+
Requires-Dist: pytz==2023.3.post1
|
|
13
|
+
Requires-Dist: Requests==2.32.0
|
|
14
|
+
Requires-Dist: six==1.16.0
|
|
15
|
+
Requires-Dist: xlsxwriter==3.2.0
|
|
16
|
+
Requires-Dist: xport==3.6.1
|
|
17
|
+
Dynamic: license-file
|
netiob-0.1.0/README.md
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# T1DEXI Processing Utilities
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
This repository contains a collection of Python scripts designed to process the T1DEXI dataset, which is used for exercise data analysis in individuals with Type 1 Diabetes. These utilities are essential for researchers and clinicians interested in understanding insulin dynamics and other metabolic parameters during exercise.
|
|
5
|
+
|
|
6
|
+
<img src="./Flow_of_functionalities.svg?sanitize=true">
|
|
7
|
+
|
|
8
|
+
## Getting Started
|
|
9
|
+
|
|
10
|
+
### Prerequisites
|
|
11
|
+
- Python 3.6 or newer
|
|
12
|
+
- Required Python packages:
|
|
13
|
+
- pandas 2.2.0 or newer
|
|
14
|
+
- numpy
|
|
15
|
+
- pyreadstat
|
|
16
|
+
- xport xpot.v56
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Installation
|
|
20
|
+
Clone the repository to your local machine:
|
|
21
|
+
```bash
|
|
22
|
+
git clone https://gitlab.com/CeADARIreland_Public/netiob.git
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Utility Scripts
|
|
26
|
+
Each script in the repository serves a specific function in the processing of the T1DEXI dataset. Below are detailed descriptions and usage instructions for each utility.
|
|
27
|
+
|
|
28
|
+
### 1. `base_utils.py`
|
|
29
|
+
**Description:** This script is responsible for pre-processing and loading data from the T1DEXI dataset for further analysis. It includes functions to retrieve exercise, glucose, insulin, meal, demographics, and device data, including our specially processed insulin data which is chunked into 5-minutes delivery intervals (insulin data chunk). It is a comprehensive tool for initial data handling.
|
|
30
|
+
|
|
31
|
+
**Key Functions:**
|
|
32
|
+
- `get_exercise_data()`: Retrieves exercise-related data.
|
|
33
|
+
- `get_glucose_data()`: Pulls glucose measurements.
|
|
34
|
+
- `get_insulin_data()`: Fetches insulin administration details.
|
|
35
|
+
- `get_meal_data()`: Fetches data on meal intakes.
|
|
36
|
+
- `get_demographics_data()`: Provides demographic information of subjects.
|
|
37
|
+
- `get_device_data()`: Extracts device usage details.
|
|
38
|
+
- `get_insulin_data_chunk()`: Retrieves insulin administration with delivery timestamps chunked into 5-minutes intervals.
|
|
39
|
+
|
|
40
|
+
**How to Use:**
|
|
41
|
+
1. Make sure to enter the correct path to the T1DEXI Dataset folder on your local machine in the main `base_utils.py` script
|
|
42
|
+
2. Import the utilities:
|
|
43
|
+
```python
|
|
44
|
+
from base_utils import T1DEXI_Utils
|
|
45
|
+
```
|
|
46
|
+
3. Create an instance of `T1DEXI_Utils` and call the desired function. For instance, to fetch meal data:
|
|
47
|
+
```python
|
|
48
|
+
utils = T1DEXI_Utils()
|
|
49
|
+
meal_data = utils.get_meal_data()
|
|
50
|
+
# Note that, either of 'aid' or 'non_aid' can be passed as an argument to the function.
|
|
51
|
+
# For example, utils.get_meal_data('aid'), and it would filter the records based on the
|
|
52
|
+
# category of device (e.g., AID or NON-AID). Otherwise, all data is returned without
|
|
53
|
+
# any filter.
|
|
54
|
+
```
|
|
55
|
+
Alternatively, you can directly use:
|
|
56
|
+
```python
|
|
57
|
+
meal_data = T1DEXI_Utils().get_meal_data()
|
|
58
|
+
```
|
|
59
|
+
3. For accessing other data files not covered by predefined functions, use:
|
|
60
|
+
```python
|
|
61
|
+
custom_data = T1DEXI_Utils()._get_data('DM')[0]
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 2. `insulin_processing.py`
|
|
65
|
+
**Description:** This script processes insulin data from Automated Insulin Delivery (AID) pumps used in the T1DEXI dataset, specifically chunking the data into 5-minute intervals for each type of AID pump. This precision is critical for subsequent analysis steps, ensuring that the insulin data is uniformly prepared for time-series analysis or other statistical methods.
|
|
66
|
+
|
|
67
|
+
**How to Use:**
|
|
68
|
+
This utility can be executed as a command-line interface (CLI) tool or imported and run within a Jupyter notebook.
|
|
69
|
+
**As a CLI:**
|
|
70
|
+
```bash
|
|
71
|
+
python insulin_processing.py
|
|
72
|
+
```
|
|
73
|
+
After running the command, you will be prompted to enter your T1DEXI folder path.
|
|
74
|
+
**In a notebook:**
|
|
75
|
+
```python
|
|
76
|
+
from insulin_processing import *
|
|
77
|
+
# Follow prompts or additional necessary steps documented in the script comments
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Functionality:**
|
|
81
|
+
- The script imports necessary functions from `base_utils.py` and utilizes them to load and preprocess the insulin data.
|
|
82
|
+
- It includes functions to:
|
|
83
|
+
- Calculate time differences between data points.
|
|
84
|
+
- Chunk insulin records into smaller intervals based on specified conditions (such as insulin type and device type).
|
|
85
|
+
- Save processed data back into a `.xpt` file format suitable for further analysis.
|
|
86
|
+
|
|
87
|
+
**Output:**
|
|
88
|
+
- The script outputs an XPT file containing the processed insulin data, ready for further analysis.
|
|
89
|
+
|
|
90
|
+
### 3. `baseline_basal_profile.py`
|
|
91
|
+
**Description:** This script is designed to generate individual basal profiles for each user from the T1DEXI dataset, specifically for use during the computation of net Insulin-On-Board (netIOB). The profiles are created by calculating the hourly average of basal insulin delivery, which are then saved as JSON files for further processing. These profiles are crucial for comparing actual basal deliveries to predetermined schedules.
|
|
92
|
+
|
|
93
|
+
**How to Use:**
|
|
94
|
+
- This script is typically imported and used in conjunction with the `netIOB_calc.py` script during netIOB computations.
|
|
95
|
+
- The primary function, `avg_basal_rate`, processes a user's basal insulin DataFrame to generate `basal_rate_profile.json` and `profile.json`, which are then utilized by a JavaScript subprocess for netIOB calculations.
|
|
96
|
+
|
|
97
|
+
**Functionality:**
|
|
98
|
+
- **avg_basal_rate(users_basal_record):**
|
|
99
|
+
- **Input:** A DataFrame containing specific basal insulin records for a user.
|
|
100
|
+
- **Output:** Two JSON files:
|
|
101
|
+
- `basal_rate_profile.json`: Contains the basal rate profile structured as a list of dictionaries for each hour.
|
|
102
|
+
- `profile.json`: Contains the `dia` (Duration of Insulin Action) and the basal profile list.
|
|
103
|
+
|
|
104
|
+
**Process:**
|
|
105
|
+
- The script filters and processes the insulin data to align basal flow rate entries with scheduled insulin events based on timestamps.
|
|
106
|
+
- It then constructs a 24-hour profile for each user, ensuring coverage for all hours and filling any gaps in data.
|
|
107
|
+
- Outputs are formatted as JSON files, which are structured to support subsequent computational steps in netIOB calculations.
|
|
108
|
+
|
|
109
|
+
### 4. `netIOB_calc.py`
|
|
110
|
+
**Description:** This script is central to the computation of net Insulin-On-Board (netIOB) using data from AID (Automated Insulin Delivery) pumps in the T1DEXI dataset. It leverages functions from `base_utils.py` and `baseline_basal_profile.py` to prepare and utilize individual hourly basal profiles for accurate netIOB calculations.
|
|
111
|
+
|
|
112
|
+
**How to Use:**
|
|
113
|
+
**Important Note:** Before running this script, ensure that insulin data is properly chunked into 5-minute intervals using `insulin_processing.py`. Save the processed insulin data as `FACM_CHUNK.xpt` in the same folder as other T1DEXI files. Also, in the `netIOB_calc.py` script, ensure to specify the path to the T1DEXI folder where the `DATA_PATH` valriable is declared.
|
|
114
|
+
To execute the script:
|
|
115
|
+
**CLI:**
|
|
116
|
+
```bash
|
|
117
|
+
python netIOB_calc.py
|
|
118
|
+
```
|
|
119
|
+
**In a notebook:**
|
|
120
|
+
```python
|
|
121
|
+
from netIOB_calc import T1DEXI_netIOB
|
|
122
|
+
T1DEXI_netIOB().netIOB('aid')
|
|
123
|
+
```
|
|
124
|
+
The argument `'aid'` or `'non_aid'` specifies the device category for which netIOB should be calculated.
|
|
125
|
+
|
|
126
|
+
**Core Functions:**
|
|
127
|
+
- `convert_netiob_csv_to_xpt(device_category)`: Converts CSV files containing netIOB data to `.xpt` format.
|
|
128
|
+
- `get_last_x_hr(dataframe, real_time, revert_by)`: Retrieves data records from the last 'x' hours.
|
|
129
|
+
- `compute_basal_duration(basal_records)`: Calculates durations between consecutive basal insulin deliveries.
|
|
130
|
+
- `datetime_to_zoned_iso(time, timezone)`: Formats timestamps for netIOB computation.
|
|
131
|
+
|
|
132
|
+
**Dependencies:**
|
|
133
|
+
- Requires the `ore0` repository, which should be configured correctly in the local environment. This repository is crucial for the script’s execution, specifically for the netIOB calculations which rely on JavaScript computations.
|
|
134
|
+
|
|
135
|
+
**Note:**
|
|
136
|
+
- Ensure all configurations and path settings are correctly set up before execution. The script includes conditional operations that may need modifications based on specific requirements, such as uncommenting certain blocks for full functionality. Get the oref0 repo here: https://github.com/openaps/oref0/tree/master
|
|
137
|
+
|
|
138
|
+
### 5. `netiob_exercise_processing.py`
|
|
139
|
+
|
|
140
|
+
**Description:** This script is designed to process T1DEXI data and its corresponding netIOB data. It generates new data points crucial for analyzing netIOB in relation to users' exercise activity across various time intervals.
|
|
141
|
+
|
|
142
|
+
**How to Use:**
|
|
143
|
+
**Important Note:** Before running this script, ensure that `netIOB_calc.py` is executed beforehand to generate netIOB data for the category of users to be analysed. Running the script (could take a while to complete) will automatically save the data as `NETIOB.xpt`.
|
|
144
|
+
To execute the script:
|
|
145
|
+
**CLI:**
|
|
146
|
+
```bash
|
|
147
|
+
python netiob_exercise_processing.py
|
|
148
|
+
```
|
|
149
|
+
**In a notebooks:**
|
|
150
|
+
```python
|
|
151
|
+
from netiob_exercise_processing import T1DEXI_netIOB_exercise
|
|
152
|
+
T1DEXI_netIOB_exercise().exercise_netIOB_rel()
|
|
153
|
+
```
|
|
154
|
+
**Core Functions:**
|
|
155
|
+
The script imports and create an instance of the `base_utils.py` `class T1DEXI_Utils()`.
|
|
156
|
+
It includes the functions to:
|
|
157
|
+
- Converts timedelta str to approximate hours
|
|
158
|
+
- Computes delta between two values
|
|
159
|
+
|
|
160
|
+
**Outputs:**
|
|
161
|
+
- Generates a new DataFrame from the analysis
|
|
162
|
+
- Saves the newly generated DataFrame as `NETIOBEX.xpt` for further use.
|
|
163
|
+
|
|
164
|
+
### 6. `glucose_variability_analysis.ipynb`
|
|
165
|
+
|
|
166
|
+
**Description:** This Jupyter notebook contains Python code and scripts for detailed glucose analysis, including data extraction for AID and non-AID devices, analysis of glucose levels, categorization by insulin device type, and statistical comparison of various metrics such as Time in Range (TIR) and Time Above Range (TAR) across different genders and activities. It also includes advanced statistical functions like Shapiro-Wilk, skewness, z-test, and Mann-Whitney U tests.
|
|
167
|
+
|
|
168
|
+
**Features:**
|
|
169
|
+
- Detailed function annotations for clarity and ease of use.
|
|
170
|
+
- Utilizes advanced Python libraries and techniques for in-depth data analysis.
|
|
171
|
+
- Provides visualizations and statistical comparisons for a comprehensive understanding of glucose level variations.
|
|
172
|
+
|
|
173
|
+
**How to Use:**
|
|
174
|
+
1. Open the notebook in a Jupyter environment.
|
|
175
|
+
2. Call the functions while passing necessary parameters to reproduce the analysis or customize as needed for specific research requirements.
|
|
176
|
+
|
|
177
|
+
## Contributing
|
|
178
|
+
We welcome contributions from the community. If you wish to contribute to the project, please fork the repository and submit a pull request.
|
|
179
|
+
|
|
180
|
+
## License
|
|
181
|
+
This project is licensed under the Apache License 2.0. For more details, please see the LICENSE file in the repository.
|
|
182
|
+
|
|
183
|
+
## Contributors
|
|
184
|
+
|
|
185
|
+
CeADAR Connect Group @ CeADAR - Ireland's Centre for AI
|
|
186
|
+
|
|
187
|
+
- Ahtsham Zafar <ahtsham.zafar@ucd.ie>
|
|
188
|
+
- Dr. Abiodun Solanke <abiodun.solanke@ucd.ie>
|
|
189
|
+
- Dana Lewis <dana@openaps.org>
|
|
190
|
+
- Dr. Arsalan Shahid
|
|
191
|
+
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from netiob.tandem.helper import TandemHelper
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from pandas import DataFrame
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class TandemHelper:
|
|
7
|
+
id: str
|
|
8
|
+
df_LidBasalRateChange: Optional[DataFrame] = None
|
|
9
|
+
df_LidPumpingSuspended: Optional[DataFrame] = None
|
|
10
|
+
df_LidPumpingResumed: Optional[DataFrame] = None
|
|
11
|
+
df_LidBgReadingTaken: Optional[DataFrame] = None
|
|
12
|
+
df_LidBolusCompleted: Optional[DataFrame] = None
|
|
13
|
+
df_LidBolexCompleted: Optional[DataFrame] = None
|
|
14
|
+
df_LidBolusActivated: Optional[DataFrame] = None
|
|
15
|
+
df_LidBolexActivated: Optional[DataFrame] = None
|
|
16
|
+
df_LidCgmDataGxb: Optional[DataFrame] = None
|
|
17
|
+
df_LidBasalDelivery: Optional[DataFrame] = None
|
|
18
|
+
df_LidBolusDelivery: Optional[DataFrame] = None
|
|
19
|
+
df_LidAaDailyStatus: Optional[DataFrame] = None
|
|
20
|
+
df_LidCgmDataFsl2: Optional[DataFrame] = None
|
|
21
|
+
df_LidCgmDataG7: Optional[DataFrame] = None
|
|
22
|
+
df_LidDailyBasal: Optional[DataFrame] = None
|
|
23
|
+
df_LidCarbsEntered: Optional[DataFrame] = None
|
|
24
|
+
|
|
25
|
+
def __init__(
|
|
26
|
+
self,
|
|
27
|
+
id: str,
|
|
28
|
+
df_LidBasalRateChange: Optional[DataFrame] = None,
|
|
29
|
+
df_LidPumpingSuspended: Optional[DataFrame] = None,
|
|
30
|
+
df_LidPumpingResumed: Optional[DataFrame] = None,
|
|
31
|
+
df_LidBgReadingTaken: Optional[DataFrame] = None,
|
|
32
|
+
df_LidBolusCompleted: Optional[DataFrame] = None,
|
|
33
|
+
df_LidBolexCompleted: Optional[DataFrame] = None,
|
|
34
|
+
df_LidBolusActivated: Optional[DataFrame] = None,
|
|
35
|
+
df_LidBolexActivated: Optional[DataFrame] = None,
|
|
36
|
+
df_LidCgmDataGxb: Optional[DataFrame] = None,
|
|
37
|
+
df_LidBasalDelivery: Optional[DataFrame] = None,
|
|
38
|
+
df_LidBolusDelivery: Optional[DataFrame] = None,
|
|
39
|
+
df_LidAaDailyStatus: Optional[DataFrame] = None,
|
|
40
|
+
df_LidCgmDataFsl2: Optional[DataFrame] = None,
|
|
41
|
+
df_LidCgmDataG7: Optional[DataFrame] = None,
|
|
42
|
+
df_LidDailyBasal: Optional[DataFrame] = None,
|
|
43
|
+
df_LidCarbsEntered: Optional[DataFrame] = None
|
|
44
|
+
):
|
|
45
|
+
self.id = id
|
|
46
|
+
self.df_LidBasalRateChange = df_LidBasalRateChange
|
|
47
|
+
self.df_LidPumpingSuspended = df_LidPumpingSuspended
|
|
48
|
+
self.df_LidPumpingResumed = df_LidPumpingResumed
|
|
49
|
+
self.df_LidBgReadingTaken = df_LidBgReadingTaken
|
|
50
|
+
self.df_LidBolusCompleted = df_LidBolusCompleted
|
|
51
|
+
self.df_LidBolexCompleted = df_LidBolexCompleted
|
|
52
|
+
self.df_LidBolusActivated = df_LidBolusActivated
|
|
53
|
+
self.df_LidBolexActivated = df_LidBolexActivated
|
|
54
|
+
self.df_LidCgmDataGxb = df_LidCgmDataGxb
|
|
55
|
+
self.df_LidBasalDelivery = df_LidBasalDelivery
|
|
56
|
+
self.df_LidBolusDelivery = df_LidBolusDelivery
|
|
57
|
+
self.df_LidAaDailyStatus = df_LidAaDailyStatus
|
|
58
|
+
self.df_LidCgmDataFsl2 = df_LidCgmDataFsl2
|
|
59
|
+
self.df_LidCgmDataG7 = df_LidCgmDataG7
|
|
60
|
+
self.df_LidDailyBasal = df_LidDailyBasal
|
|
61
|
+
self.df_LidCarbsEntered = df_LidCarbsEntered
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: netiob
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: NET IOB
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Requires-Dist: Flask==3.0.3
|
|
7
|
+
Requires-Dist: flask_cors==4.0.0
|
|
8
|
+
Requires-Dist: numpy==1.26.4
|
|
9
|
+
Requires-Dist: pandas<1.4,>=1.3.5
|
|
10
|
+
Requires-Dist: pyreadstat==1.2.6
|
|
11
|
+
Requires-Dist: python_dateutil==2.8.2
|
|
12
|
+
Requires-Dist: pytz==2023.3.post1
|
|
13
|
+
Requires-Dist: Requests==2.32.0
|
|
14
|
+
Requires-Dist: six==1.16.0
|
|
15
|
+
Requires-Dist: xlsxwriter==3.2.0
|
|
16
|
+
Requires-Dist: xport==3.6.1
|
|
17
|
+
Dynamic: license-file
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
netiob/__init__.py
|
|
5
|
+
netiob.egg-info/PKG-INFO
|
|
6
|
+
netiob.egg-info/SOURCES.txt
|
|
7
|
+
netiob.egg-info/dependency_links.txt
|
|
8
|
+
netiob.egg-info/requires.txt
|
|
9
|
+
netiob.egg-info/top_level.txt
|
|
10
|
+
netiob/tandem/__init__.py
|
|
11
|
+
netiob/tandem/helper.py
|
|
12
|
+
netiob/utils/__init__.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
netiob
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "netiob"
|
|
7
|
+
description = "NET IOB"
|
|
8
|
+
version = "0.1.0"
|
|
9
|
+
dependencies = [
|
|
10
|
+
"Flask==3.0.3",
|
|
11
|
+
"flask_cors==4.0.0",
|
|
12
|
+
"numpy==1.26.4",
|
|
13
|
+
"pandas>=1.3.5,<1.4",
|
|
14
|
+
"pyreadstat==1.2.6",
|
|
15
|
+
"python_dateutil==2.8.2",
|
|
16
|
+
"pytz==2023.3.post1",
|
|
17
|
+
"Requests==2.32.0",
|
|
18
|
+
"six==1.16.0",
|
|
19
|
+
"xlsxwriter==3.2.0",
|
|
20
|
+
"xport==3.6.1"
|
|
21
|
+
]
|
netiob-0.1.0/setup.cfg
ADDED