aidR: CareLink export format

library(aidR)

Overview

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:

Last Name;First Name;Patient ID;System ID;Start Date;End Date;Device;MiniMed 780G MMT-1886;Hardware Version;A2.01;Firmware Version;8.13.2
"XXX";"YYY";"";"";"04.07.2026 00:00:00";"05.07.2026 00:00:00";"Serial Number";XXXXXXXXXX;Software Version;
Patient DOB;;;;;;CGM;Guardian™ 4 Sensor


-------;MiniMed 780G MMT-1886;Pump;XXXXXXXXXX;------- 
Index;Date;Time;New Device Time;BG Source;BG Reading (mg/dL);Linked BG Meter ID;Basal Rate (U/h);Temp Basal Amount;Temp Basal Type;Temp Basal Duration (h:mm:ss);Bolus Type;Bolus Volume Selected (U);Bolus Volume Delivered (U);Bolus Duration (h:mm:ss);Prime Type;Prime Volume Delivered (U);Estimated Reservoir Volume after Fill (U);Alert;User Cleared Alerts;Suspend;Rewind;BWZ Estimate (U);BWZ Target High BG (mg/dL);BWZ Target Low BG (mg/dL);BWZ Carb Ratio (g/U);BWZ Insulin Sensitivity (mg/dL/U);BWZ Carb Input (grams);BWZ BG/SG Input (mg/dL);BWZ Correction Estimate (U);BWZ Food Estimate (U);BWZ Active Insulin (U);BWZ Status;Sensor Calibration BG (mg/dL);Sensor Glucose (mg/dL);ISIG Value;Event Marker;Bolus Number;Bolus Cancellation Reason;BWZ Unabsorbed Insulin Total (U);Final Bolus Estimate;Scroll Step Size;Insulin Action Curve Time;Sensor Calibration Rejected Reason;Preset Bolus;Bolus Source;BLE Network Device;Device Update Event;Network Device Associated Reason;Network Device Disassociated Reason;Network Device Disconnected Reason;Sensor Exception;Preset Temp Basal Name;Sensor State
1,00000;2026/07/04;23:09:51;;;;;;;;;;;;;;;;;PERSONAL REMINDER;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2,00000;2026/07/04;23:08:00;;;;;;;;;;;;;;;;PERSONAL REMINDER: vibration;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3,00000;2026/07/04;22:48:05;;;;;;;;;Normal;1,9;1,9;;;;;;;;;;;;;;;;;;;;;;;;205;;;;;;;;CLOSED_LOOP_BG_CORRECTION_AND_FOOD_BOLUS;;;;;;;;

How aidR detects this format

aidR identifies a CareLink export by the keyword MiniMed in the first line.

Sections and the data types they produce

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)
#> Parsing data for id 1...

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.
    head(data$scheduled_basal_rates)
         Index           timestamp Basal Rate (U/h) Suspend Rewind duration_h
    1 91,00000 2026-07-04 00:08:09              0.7    <NA>     NA  1.8761111
    2 89,00000 2026-07-04 02:00:43              0.8    <NA>     NA  1.1141667
    3 88,00000 2026-07-04 03:07:34              1.0    <NA>     NA  0.9175000
    4 87,00000 2026-07-04 04:02:37              0.9    <NA>     NA  0.8872222
    5 86,00000 2026-07-04 04:55:51              1.1    <NA>     NA  0.9905556
    6 85,00000 2026-07-04 05:55:17              1.2    <NA>     NA  1.1341667
                  pump_name
    1 MiniMed 780G MMT-1886
    2 MiniMed 780G MMT-1886
    3 MiniMed 780G MMT-1886
    4 MiniMed 780G MMT-1886
    5 MiniMed 780G MMT-1886
    6 MiniMed 780G MMT-1886
    • boluses. Records whether a bolus was normal, square-wave, or dual-wave, along with the delivered volume and, for extended boluses, the duration.
    head(data$bolus)
    # A tibble: 6 × 11
      Index    timestamp           `Bolus Type` `Bolus Volume Selected (U)`
      <chr>    <dttm>              <chr>                              <dbl>
    1 69,00000 2026-07-04 11:29:11 Normal                               5.1
    2 68,00000 2026-07-04 11:47:56 Normal                               5.1
    3 66,00000 2026-07-04 12:24:37 Normal                               2.4
    4 65,00000 2026-07-04 12:32:56 Normal                               2.4
    5 63,00000 2026-07-04 13:15:45 Normal                               2.9
    6 62,00000 2026-07-04 13:21:55 Normal                               2.9
    # ℹ 7 more variables: `Bolus Volume Delivered (U)` <dbl>,
    #   `Bolus Duration (h:mm:ss)` <lgl>, `Bolus Number` <int>,
    #   `Bolus Cancellation Reason` <lgl>, `Preset Bolus` <lgl>,
    #   `Bolus Source` <chr>, pump_name <chr>
    • bolus wizard (BWZ) entries, i.e. the carbohydrates communicated to the bolus calculator together with the resulting recommendation.
    head(data$bwz)
         Index           timestamp BWZ Estimate (U) BWZ Target High BG (mg/dL)
    1 70,00000 2026-07-04 11:29:11              5.1                         NA
    2 67,00000 2026-07-04 12:24:37              2.4                         NA
    3 64,00000 2026-07-04 13:15:45              2.9                         NA
    4 61,00000 2026-07-04 13:52:49              3.0                         NA
    5 58,00000 2026-07-04 15:08:09              3.1                         NA
    6 41,00000 2026-07-04 17:22:13              2.8                         NA
      BWZ Target Low BG (mg/dL) BWZ Carb Ratio (g/U) BWZ Carb Input (grams)
    1                        NA                  8.0                     35
    2                        NA                  6.6                     15
    3                        NA                  6.6                     20
    4                        NA                  6.6                     25
    5                        NA                  7.2                     20
    6                        NA                  7.2                     18
      BWZ Insulin Sensitivity (mg/dL/U) BWZ BG/SG Input (mg/dL)
    1                                NA                     253
    2                                NA                       0
    3                                NA                     216
    4                                NA                     195
    5                                NA                     117
    6                                NA                     106
      BWZ Correction Estimate (U) BWZ Food Estimate (U) BWZ Active Insulin (U)
    1                           0                   5.1                     NA
    2                           0                   2.4                     NA
    3                           0                   2.9                     NA
    4                           0                   3.0                     NA
    5                           0                   3.1                     NA
    6                           0                   2.8                     NA
      BWZ Status BWZ Unabsorbed Insulin Total (U) Final Bolus Estimate
    1  Delivered                               NA                   NA
    2  Delivered                               NA                   NA
    3  Delivered                               NA                   NA
    4  Delivered                               NA                   NA
    5  Delivered                               NA                   NA
    6  Delivered                               NA                   NA
      Scroll Step Size
    1               NA
    2               NA
    3               NA
    4               NA
    5               NA
    6               NA
    • self-monitored blood glucose (SMBG) entries.
    head(data$SMBG)
         Index           timestamp           BG Source BG Reading (mg/dL)
    1 71,00000 2026-07-04 10:53:32   BG_SENT_FOR_CALIB                129
    2 43,00000 2026-07-04 17:15:21 ENTERED_IN_BG_ENTRY                 49
      Linked BG Meter ID
    1                 NA
    2                 NA
    • alerts and alarms raised by the pump.
    head(data$alerts)
         Index           timestamp                       Alert User Cleared Alerts
    1 82,00000 2026-07-04 07:58:08 ALERT BEFORE LOW: vibration                <NA>
    2 81,00000 2026-07-04 08:02:49     ALERT BEFORE LOW: siren                <NA>
    3 80,00000 2026-07-04 08:13:05                        <NA>    ALERT BEFORE LOW
    4 77,00000 2026-07-04 09:41:04 ALERT BEFORE LOW: vibration                <NA>
    5 76,00000 2026-07-04 09:43:34                        <NA>    ALERT BEFORE LOW
    6 75,00000 2026-07-04 09:55:14     ALERT ON LOW: vibration                <NA>
    • prime events (tubing/cannula fills).
    head(data$prime)
         Index           timestamp   Prime Type Prime Volume Delivered (U)
    1 26,00000 2026-07-04 19:40:45 Cannula Fill                          0
      Estimated Reservoir Volume after Fill (U)
    1                                   147.975
    • temp basal events.
    head(data$temp_basal)
         Index           timestamp Temp Basal Amount Temp Basal Type
    1 78,00000 2026-07-04 09:22:18                10         Percent
      Temp Basal Duration (h:mm:ss) Preset Temp Basal Name             pump_name
    1                      01:00:00                 TEMP_2 MiniMed 780G MMT-1886
    • correction-bolus information (not present in this example).
    head(data$corr_bolus_info)
    NULL
    • sensor calibrations.
    head(data$sensor_calibration)
         Index           timestamp Sensor Calibration BG (mg/dL)
    1 42,00000 2026-07-04 17:20:12                           129
      Sensor Calibration Rejected Reason
    1                                 NA
    • insulin action curve changes.
    head(data$insulin_action_curve)
         Index  timestamp Insulin Action Curve Time
    1 92,00000 2026-07-04                       180
    • device change events.
    head(data$device_changes)
         Index           timestamp
    1 47,00000 2026-07-04 17:01:16
    2 46,00000 2026-07-04 17:03:00
                                        BLE Network Device
    1 Glucose Sensor Transmitter (XXXXXXXXXXX) was removed
    2   Glucose Sensor Transmitter (XXXXXXXXXXX) was added
  • Aggregated Auto Insulin Data section: daily aggregated insulin delivered in automated mode. Interestingly, this number does not match any of the total aggregates from the PDF export, so it is unclear what this actually refers to.

head(data$aggr_auto_insulin)
     Index  timestamp Bolus Type Bolus Volume Selected (U)
1 93,00000 2026-07-04     Normal                    20.494
  Bolus Volume Delivered (U)             Bolus Source
1                     20.494 CLOSED_LOOP_AUTO_INSULIN
  • Sensor section: CGM data.
head(data$cgm)
      Index           timestamp Sensor Glucose (mg/dL) ISIG Value
1 381,00000 2026-07-04 03:48:00                    109      19.80
2 380,00000 2026-07-04 03:53:00                    114      19.55
3 379,00000 2026-07-04 03:58:00                    106      19.00
4 378,00000 2026-07-04 04:03:00                     96      17.32
5 377,00000 2026-07-04 04:08:00                     89      16.03
6 376,00000 2026-07-04 04:13:00                     81      15.37
         sensor_name
1 Guardian™ 4 Sensor
2 Guardian™ 4 Sensor
3 Guardian™ 4 Sensor
4 Guardian™ 4 Sensor
5 Guardian™ 4 Sensor
6 Guardian™ 4 Sensor

Cleaning files

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).

Notes

  • CGM and SMBG values are reported in mg/dL or mmol/L depending on account settings; aidR converts to mg/dL automatically.
  • timezone_offset is always NA, since CareLink exports report only local (wall-clock) time.
  • CareLink does report a daily insulin aggregate, but this number does not match any of the daily aggregates displayed in a PDF export. It is unclear what this number refers to, and aidR therefore does not use this number. Therefore, total_bolus is summed from the cleaned bolus data and carries source = "summed".
  • The basal rates from the Pump section are the scheduled basal rates (possibly interrupted by reservoir changes and rewinds), and not the basal insulin effectively delivered. 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.