Question: Directions Dataset: You will be given two datasets: From the Continuous Glucose Sensor ( CGMData . csv ) From the insulin pump ( InsulinData .
Directions
Dataset:
You will be given two datasets:
From the Continuous Glucose Sensor CGMDatacsv
From the insulin pump InsulinDatacsv
The output of the CGM sensor consists of three columns:
Data time stamp Columns B and C combined
the minute filtered CGM reading in mgdLColumn AE
the ISIG value which is the raw sensor output every mins.
The output of the pump has the following information:
Data time stamp
Basal setting
Micro bolus every mins
Meal intake amount in terms of grams of carbohydrate
Meal bolus
correction bolus
correction factor
CGM calibration or insulin reservoirrelated alarms
auto mode exit events and unique codes representing reasons Column Q
The bold items are the columns you will use in this project.
Metrics to be extracted:
Percentage time in hyperglycemia CGM mgdL
Percentage of time in hyperglycemia critical CGM mgdL
Percentage time in range CGM mgdL and CGM mgdL
Percentage time in range secondary CGM mgdL and CGM mgdL
Percentage time in hypoglycemia level CGM mgdL
Percentage time in hypoglycemia level CGM mgdL
Each of the metrics mentioned above is extracted in three different time intervals: daytime am to midnight overnight midnight to am and whole day am to am
The percentage is for the total number of CGM data that should be available each day. Assume that the total number of CGM data that should be available is There will be days such that the number of data available is less than but still, consider the percentage to be with respect to
You have to extract these metrics for each day and then report the mean value of each metric over all days. Hence there are metrics to be extracted.
The metrics will be computed for two cases:
Case A: Manual mode
Case B: Auto mode
Analysis Procedure:
The data is in reverse order of time. This means that the first row is the end of the data collection whereas the last row is the beginning of the data collection. The data starts with manual mode. Manual mode continues until you get a message AUTO MODE ACTIVE PLGM OFF in the column Q of the InsulinData.csv From then onwards Auto mode starts. You may get multiple AUTO MODE ACTIVE PLGM OFF in column Q but only use the earliest one to determine when you switch to auto mode. There is no switching back to manual mode, so the first task is to determine the time stamp when Auto mode starts. Remember that the time stamp of the CGM data is not the same as the timestamp of the insulin pump data because these are two different devices that operate asynchronously.
Once you determine the start of Auto Mode from InsulinData.csv you have to figure out the timestamp in CGMData.csv where Auto Mode starts. This can be done simply by searching for the time stamp nearest to and later than the Auto mode start time stamp obtained from InsulinData.csv
For each user, CGM data is first parsed and divided into segments, where each segment corresponds to a day's worth of data. One day is considered to start at am and end at : pm If there is no CGM data loss, then there should be samples in each segment. The segment as a whole is used to compute the metrics for the whole day time period. Each segment is then divided into two subsegments: the daytime subsegment and the overnight subsegment. For each subsegment, the CGM series is investigated to count the number of samples that belong to the ranges specified in the metrics. To compute the percentage with respect to hours, the total number of samples in the specified range is divided by
Note that here you have to tackle the missing data problem so a particular may not have all data points. In the data files, those are represented as NaN. You need to devise a strategy to tackle the missing data problem. Popular strategies include deletion of the entire day of data, or interpolation.
Write a Python script that accepts two CSV files: CGMData.csv and InsulinData.csv and runs the analysis procedure and outputs the metrics discussed in the metrics section in another CSV file using the format described in Result.csv
Submission Directions for Project Deliverables
This project will be autograded. You must complete and submit your work through Ed Lessons code challenges to receive credit for the course:
To get started, use the mainpy file provided in your workspace.
All necessary datasets are already loaded into the workspace.
Execute your code by running the python main.py command in the terminal to test your work.
On completing your work, submit it for autograding by clicking the Test button.
You will know you have completed the assignment when feedback appears for each test case with a score.
If needed: to resubmit the assignment in Ed Lesson
Edit your work in
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
