knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(aidR)
path <- system.file("extdata", "mylife_example.csv", package = "aidR")
A mylife export is a single semicolon-delimited .csv file with eight columns:
writeLines(readLines(path, n = 10))
Each event represents a single row. Both the column headers and the event labels are language-specific and vary with the language of the user's account (the example above is in German).
Because the headers in a mylife export are language-specific, aidR cannot identify a file from its header names. It relies instead on the structure of the header row, which is delimited by semicolons ; and must split into exactly eight columns. For the same reason, event types are not matched by their labels either: bolus rows are recognized by a unit starting with U, and carbohydrate rows by a unit starting with g.
To inspect the raw entries, we parse the export with clean = FALSE, which returns the full information provided by mylife:
data <- parse_data(id = "1", paths = path, clean = FALSE)
All entries are preserved as-is under their original, language-specific label, so nothing in the export is lost. Possible labels include:
Bolus; unit U.head(data$Bolus)
Kohlenhydrate; unit g.head(data$Kohlenhydrate)
Blutzucker manuelle Eingabe; unit mg/dL or mmol/L.head(data$`Blutzucker manuelle Eingabe`)
Ease-off): start and duration of Ease-off mode.Boost): start and duration of Boost mode.Hypo Kohlenhydrate; unit g.Auto mode An.langsam resorbierbar; unit g.Auto mode lädt.Note that a mylife export contains no CGM or basal data - bolus, carbs, and SMBG are the only core data types available from this platform.
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 |
|-------------------|----------------------|--------------------------------------------------------------------------------------------------------------------------------|
| bolus | mylife_example.csv | All entries whose unit is U, i.e. bolus entries. |
| carbs | mylife_example.csv | All entries whose unit is g, including regular carbohydrates, slowly resorbing carbohydrates, and hypo carbohydrate entries. |
| SMBG | mylife_example.csv | All entries whose unit is mg/dL or mmol/L, i.e. manual blood glucose entries. |
| total_bolus | mylife_example.csv | The cleaned bolus data, summed per day. |
aidR converts them to mg/dL automatically.timezone_offset is always NA, since mylife exports report only local (wall-clock) time.total_basal, since a mylife export contains no basal data. total_bolus is summed from the cleaned bolus data and carries source = "summed".estimated_absorption_duration is parsed out of the free-text information column for slowly resorbing carbs (e.g. "... 2h ...") and is NA when not stated.is_hypo_treatment is likewise derived from the information column, by looking for the marker HypoTreatment.label retains the original, language-specific event label, so the source of each carbohydrate entry stays traceable after merging across platforms.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.