aidR: Dexcom Clarity export format

library(aidR)

Overview

A Dexcom Clarity export is a single delimited .csv file with 14 columns. It begins with a short metadata block, which includes the name and date of birth of the user and then, for every device that uploaded data, its device name, its sensor, and its alert settings. The metadata block is followed by one row per recorded event:

"Index";"Zeitstempel (JJJJ-MM-TTThh:mm:ss)";"Ereignisart";"Ereignis-Unterart";"Patienten-Info";"Geräteinfo";"Quellengerät-ID";"Glukosewert (mg/dL)";"Insulinwert (E)";"Kohlenh.-Wert (Gramm)";"Dauer (hh:mm:ss)";"Glukose-Änderungsgeschwindigkeit (mg/dL/min)";"Transmitterzeit (Lange Ganzzahl)";"Transmitter-ID"


"1";"";"Vorname";"";"XXX";"";"";"";"";"";"";"";""


"2";"";"Nachname";"";"XXX";"";"";"";"";"";"";"";""


"3";"";"Geburtsdatum";"";"1990-01-01";"";"";"";"";"";"";"";""


"4";"";"Gerät";"";"";"Dexcom G7";"iOS G7";"";"";"";"";"";""


"5";"";"Sensor";"";"";"G7";"iOS G7";"";"";"";"";"";""


"6";"";"Warnung";"Fallen";"";"";"iOS G7";"";"";"";"";"2";""


"7";"";"Warnung";"Hoch";"";"";"iOS G7";"160";"";"";"";"";""


"8";"";"Warnung";"Niedrig";"";"";"iOS G7";"70";"";"";"";"";""


"9";"";"Warnung";"Signalverlust";"";"";"iOS G7";"";"";"";"04:00:00";"";""


"10";"";"Warnung";"Anstieg";"";"";"iOS G7";"";"";"";"";"2";""


"11";"";"Warnung";"Niedriger Wert (dringend)";"";"";"iOS G7";"55";"";"";"";"";""


"12";"";"Warnung";"Bald niedriger Wert (dringend) – Bald";"";"";"iOS G7";"55";"";"";"";"";""


"13";"";"Gerät";"";"";"Dexcom G7";"iOS Watch";"";"";"";"";"";""


"14";"";"Sensor";"";"";"G7";"iOS Watch";"";"";"";"";"";""


"15";"";"Warnung";"Fallen";"";"";"iOS Watch";"";"";"";"";"3";""


"16";"";"Warnung";"Hoch";"";"";"iOS Watch";"250";"";"";"";"";""


"17";"";"Warnung";"Niedrig";"";"";"iOS Watch";"70";"";"";"";"";""


"18";"";"Warnung";"Signalverlust";"";"";"iOS Watch";"";"";"";"00:20:00";"";""


"19";"";"Warnung";"Anstieg";"";"";"iOS Watch";"";"";"";"";"3";""


"20";"";"Warnung";"Niedriger Wert (dringend)";"";"";"iOS Watch";"55";"";"";"";"";""


"21";"";"Warnung";"Bald niedriger Wert (dringend) – Bald";"";"";"iOS Watch";"55";"";"";"";"";""


"22";"2026-01-01T00:04:45";"EGV";"";"";"";"iOS G7";"113";"";"";"";"";"388692";"111111111111"


"23";"2026-01-01T00:09:44";"EGV";"";"";"";"iOS G7";"112";"";"";"";"";"388992";"111111111111"


"24";"2026-01-01T00:14:44";"EGV";"";"";"";"iOS G7";"111";"";"";"";"";"389292";"111111111111"


"25";"2026-01-01T00:19:44";"EGV";"";"";"";"iOS G7";"111";"";"";"";"";"389592";"111111111111"


"26";"2026-01-01T00:24:44";"EGV";"";"";"";"iOS G7";"111";"";"";"";"";"389892";"111111111111"

The column headers and the metadata labels are language-specific (the example above is German) and vary with the language of the user’s account. The separator varies with it as well, as exports use either a comma , or a semicolon ;.

Unlike the other supported platforms, Dexcom Clarity is a CGM platform rather than an AID platform, so an export contains CGM data only and no basal, bolus, carbohydrate, or SMBG data.

How aidR detects this format

Because the headers are language-specific, aidR cannot identify a Dexcom Clarity file from its header names. It relies instead on the structure of the file, trying both , and ; as the separator and accepting the one under which all three of the following hold:

aidR then retrieves the relevant columns by index rather than by name: the timestamp (column 2), the event type (column 3), the source device (column 7), the glucose value (column 8), and the transmitter id (column 14).

Entries and the data types they produce

To inspect the raw entries, we parse the export with clean = FALSE, which returns the full information provided by Dexcom Clarity:

data <- parse_data(id = "1", paths = path, clean = FALSE)
#> Parsing data for id 1...

Only the EGV rows are retained.

head(data$cgm)
            timestamp device_id value transmitter_id
1 2026-01-01 00:04:45    iOS G7   113   111111111111
2 2026-01-01 00:09:44    iOS G7   112   111111111111
3 2026-01-01 00:14:44    iOS G7   111   111111111111
4 2026-01-01 00:19:44    iOS G7   111   111111111111
5 2026-01-01 00:24:44    iOS G7   111   111111111111
6 2026-01-01 00:29:44    iOS G7   111   111111111111

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
cgm dexcom_clarity_example.csv All rows whose event type is EGV, i.e. the sensor readings.
data_clean <- parse_data(id = "1", paths = path)
#> Parsing data for id 1...
head(data_clean$cgm)
#>   id         format           timestamp timezone_offset value  unit sensor_name
#> 1  1 dexcom_clarity 2026-01-01 00:04:45              NA   113 mg/dL      iOS G7
#> 2  1 dexcom_clarity 2026-01-01 00:09:44              NA   112 mg/dL      iOS G7
#> 3  1 dexcom_clarity 2026-01-01 00:14:44              NA   111 mg/dL      iOS G7
#> 4  1 dexcom_clarity 2026-01-01 00:19:44              NA   111 mg/dL      iOS G7
#> 5  1 dexcom_clarity 2026-01-01 00:24:44              NA   111 mg/dL      iOS G7
#> 6  1 dexcom_clarity 2026-01-01 00:29:44              NA   111 mg/dL      iOS G7

Notes