Statistics of Glycemia

Compute All Indices

calc_glu(patient='XX', GluCible=array([[70, 140], [70, 180], [54, 200], [60, 300]]), intervals=array([], shape=(0, 2), dtype=float64), WRITE='a', encoding='utf-8', verbose=False, interp=False)

Function to compute glycemic statistics of a patient glycemic time series, located in the folder DATA_DIR/patient/

Parameters

patientstr

Name of the folder containing all patient’s data in the DATA_DIR folder, which is ./Data/ by default.

GluCiblearray

(n,2) array containing the values of glycemic levels for hypo and hyper glycemia

WRITE‘a’, ‘w’

‘a’ append or ‘r’ replace result file

encodingstr

(old) Used to force glycemic file encoding

verboseTrue/False

To display more results

interpFalse/True

To compute statistics on interpolated data rather than raw sensor data

returns:

Bool

Returns

bool

if result is successfull

Hint

The folder DATA_DIR is set to ./Data/ by default. The patient ‘XX’ sensor data should thus be placed in the folder ./Data/XX/.

Example

Run with default parameters as

>>> calc_glu(patient='XX')

Hint

Si on a déjà fait tourner le code pour ce patient sur un autre intervalle, par défaut cela ajoute les lignes de résultats après les premières lignes (fonction append). We can overwrite the data by specyfying WRITE=’w’.

>>> calc_glu(patient='XX',WRITE='w')

Provide one or several prescribed time intervals to compute statistics :

>>> calc_glu(patient='XX',intervals=[["2025-01-12 08:00","2025-01-14 08:00"]])

Hint

If an interval file named interval_file.csv exist in the patient folder, it is added to the intervals to compute statistics.

List of indices implemented

Basic Statistics

Min,Max,Mean,Std,% of good values, Area below curve

JIndex, LBGI, HBGI, BGRI, GRADE_score_i, EUGLY_cont_i

M_Index [1], ADRR

Hypoglycemia events

Time, Duration, Frequency of short and prolongated hypoglycemia events

Short hypoglycemia is defined by:

time_hypo_short = [15, 15]

Time (minutes) of short hypoglycemia start and end

gly_hypo_short = [54, 70]

Glycemia (mg/l) of short hypoglycemia start and end

Prolongated hypoglycemia is defined by:

time_hypo_prol = [120, 120]

Time (minutes) of prolongated hypoglycemia start and end

gly_hypo_prol = [54, 54]

Glycemia (mg/l) of prolongates hypoglycemia start and end

Function is called by:

calc_hypo(Glu_interp, T_interp, time_hypo, glu_hypo)

Function to compute statistics of short or prolongated hypoglycemia events

Parameters
Glu_interpTYPE

DESCRIPTION.

T_interpTYPE

DESCRIPTION.

time_hypotuple

tuple of [time_ep_start,time_ep_stop] values.

glu_hypotuple

tuple of [hypo_start,hypo_stop] values.

Returns

None.

MAGE

A description and ref

calc_MAGE(Glu_interp, Time, nstd, Tav)

Function to compute the mAGE index on interpolated glycemic data

Parameters

Glu_interp(n) array of float

Glycemic time serie, equally sampled in time

Time(n) array of float

Corresponding time array

nstdTYPE

DESCRIPTION.

TavTYPE

Moving average duration

Returns

Amplitude_realTYPE

Array of amplitude of glycemic variabilities between peaks

Time_AmplitudeTYPE

Array of time stamp between peaks

idAll_filtTYPE

Index of peaks

CONGAn

A description and ref

CONGAn(Glu_interp)

Function to compute the CONGAn index

Parameters

Glu_interpTYPE

DESCRIPTION.

Returns

TYPE

DESCRIPTION.

References