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 (CGMData.csv)
From the insulin pump (InsulinData.csv)
The output of the CGM sensor consists of three columns:
Data time stamp (Columns B and C combined)
the 5-minute filtered CGM reading in mg/dL,(Column AE)
the ISIG value which is the raw sensor output every 5 mins.
The output of the pump has the following information:
Data time stamp
Basal setting
Micro bolus every 5 mins
Meal intake amount in terms of grams of carbohydrate
Meal bolus
correction bolus
correction factor
CGM calibration or insulin reservoir-related 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 >180 mg/dL)
Percentage of time in hyperglycemia critical (CGM >250 mg/dL)
Percentage time in range (CGM >=70 mg/dL and CGM <=180 mg/dL)
Percentage time in range secondary (CGM >=70 mg/dL and CGM <=150 mg/dL)
Percentage time in hypoglycemia level 1(CGM <70 mg/dL)
Percentage time in hypoglycemia level 2(CGM <54 mg/dL)
Each of the metrics mentioned above is extracted in three different time intervals: daytime (6 am to midnight), overnight (midnight to 6 am), and whole day (12 am to 12 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 288. There will be days such that the number of data available is less than 288, but still, consider the percentage to be with respect to 288.
You have to extract these metrics for each day and then report the mean value of each metric over all days. Hence there are 18 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 3 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 12 am and end at 11:59 pm. If there is no CGM data loss, then there should be 288 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 sub-segments: the daytime sub-segment and the overnight sub-segment. 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 24 hours, the total number of samples in the specified range is divided by 288.
Note that here you have to tackle the missing data problem, so a particular may not have all 288 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 auto-graded. You must complete and submit your work through Ed Lessons code challenges to receive credit for the course:
To get started, use the main.py' file provided in your workspace.
All necessary datasets are already loaded into the workspace.
Execute your code by running the python3 main.py command in the terminal to test your work.
On completing your work, submit it for auto-grading 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!