knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(aidR)
path <- system.file("extdata", "carelink_example.csv", package = "aidR")
A CareLink (Medtronic) export is a single semicolon-delimited .csv (or .xlsx) file. The file is divided into sections separated by marker rows of the form -------;MiniMed 780G MMT-1886;Pump;XXXXXXXXXX;-------. Each section has its own header row and its own set of columns:
writeLines(readLines(path, n = 10))
aidR identifies a CareLink export by the keyword MiniMed in the first line.
To inspect the files, we parse the export with clean = FALSE, which returns the full information provided by CareLink:
data <- parse_data(id = "1", paths = path, clean = FALSE)
Because all information is present in one file, most of the parsing work happens up front: the file is split into sections, and the large "Pump" section is then split further into individual event types based on which columns are populated on each row.
The list below describes the different sections and the information we can get from it.
Header block (first rows, before the first -------): patient, pump, and sensor information. aidR reads the pump name (e.g. MiniMed 780G MMT-1886) and sensor name (e.g. Guardian™ 4 Sensor) from here.
Pump section: split by event type into
scheduled basal rates. Note: these are the programmed rates of the active basal pattern, i.e. what the pump would deliver in manual mode. They are not the basal insulin effectively delivered: in automated mode the pump adjusts delivery on its own, and in manual mode suspends and temporary basal rates override the schedule.
r
head(data$scheduled_basal_rates)
r
head(data$bolus)
r
head(data$bwz)
r
head(data$SMBG)
r
head(data$alerts)
r
head(data$prime)
r
head(data$temp_basal)
r
head(data$corr_bolus_info)
r
head(data$sensor_calibration)
r
head(data$insulin_action_curve)
r
head(data$device_changes)
head(data$aggr_auto_insulin)
head(data$cgm)
When parse_data is run with clean = TRUE, the cleaned data types are built from the following raw files and attributes:
| Cleaned data type | Used files | Used attributes of clean = FALSE |
|-------------------|------------------------|-----------------|
| cgm | carelink_example.csv | data$cgm |
| bolus | carelink_example.csv | data$bolus |
| carbs | carelink_example.csv | data$bwz |
| SMBG | carelink_example.csv | data$SMBG |
| total_bolus | carelink_example.csv | data$bolus |
Note that a CareLink export contains no usable basal data - cgm, bolus, carbs, and SMBG are the core data types available from this platform (see the notes below).
aidR converts to mg/dL automatically.timezone_offset is always NA, since CareLink exports report only local (wall-clock) time.aidR therefore does not use this number. Therefore, total_bolus is summed from the cleaned bolus data and carries source = "summed".aidR therefore does not use them to build a cleaned basal data type, and consequently reports no total_basal for CareLink. If you need the schedule itself, it is available from parse_data(clean = FALSE) as data$scheduled_basal_rates.link_id is always NA for bolus and carbs: the export does not record which carbohydrate entry triggered which bolus. Matching them by timestamp and amount is not implemented.Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.