Documentation ¶
Index ¶
- Constants
- Variables
- func GetBoundariesOfElementsInRange(slice Interface, lowerBound, upperBound time.Time) (startIndex, endIndex int)
- func GetTimeMillis(time time.Time) int64
- type CalibrationRead
- type CalibrationReadSlice
- func (slice CalibrationReadSlice) Get(i int) float64
- func (slice CalibrationReadSlice) GetEpochTime(i int) (epochTime int64)
- func (slice CalibrationReadSlice) Len() int
- func (slice CalibrationReadSlice) Less(i, j int) bool
- func (slice CalibrationReadSlice) Swap(i, j int)
- func (slice CalibrationReadSlice) ToDataPointSlice() (dataPoints []DataPoint)
- type DataPoint
- type DataPointSlice
- type DayOfCalibrationReads
- type DayOfExercises
- type DayOfGlucoseReads
- type DayOfInjections
- type DayOfMeals
- type Exercise
- type ExerciseSlice
- func (slice ExerciseSlice) GetEpochTime(i int) (epochTime int64)
- func (slice ExerciseSlice) Len() int
- func (slice ExerciseSlice) Less(i, j int) bool
- func (slice ExerciseSlice) Swap(i, j int)
- func (slice ExerciseSlice) ToDataPointSlice(matchingReads []GlucoseRead, glucoseUnit GlucoseUnit) (dataPoints []DataPoint)
- type GlucoseRead
- type GlucoseReadSlice
- func (slice GlucoseReadSlice) Get(i int) float64
- func (slice GlucoseReadSlice) GetEpochTime(i int) (epochTime int64)
- func (slice GlucoseReadSlice) Len() int
- func (slice GlucoseReadSlice) Less(i, j int) bool
- func (slice GlucoseReadSlice) Swap(i, j int)
- func (slice GlucoseReadSlice) ToDataPointSlice(glucoseUnit GlucoseUnit) (dataPoints []DataPoint)
- type GlucoseUnit
- type Injection
- type InjectionSlice
- func (slice InjectionSlice) GetEpochTime(i int) (epochTime int64)
- func (slice InjectionSlice) Len() int
- func (slice InjectionSlice) Less(i, j int) bool
- func (slice InjectionSlice) Swap(i, j int)
- func (slice InjectionSlice) ToDataPointSlice(matchingReads []GlucoseRead, glucoseUnit GlucoseUnit) (dataPoints []DataPoint)
- type Interface
- type Meal
- type MealSlice
- type Time
- type TimeSlice
Constants ¶
const ( UNDEFINED_READ = -1 DAY_OF_DATA_DURATION = time.Duration(24) * time.Hour )
const ( GLUCOSE_READ_TAG = "GlucoseRead" // Units MMOL_PER_L = "mmolPerL" MG_PER_DL = "mgPerDL" UNKNOWN_GLUCOSE_MEASUREMENT_UNIT = "Unknown" )
const (
CALIBRATION_READ_TAG = "CalibrationRead"
)
const (
CARB_TAG = "Carbs"
)
const (
EXERCISE_TAG = "Exercise"
)
const (
INSULIN_TAG = "Insulin"
)
Variables ¶
var UNDEFINED_CALIBRATION_READ = CalibrationRead{Time{0, "UTC"}, "NONE", -1.}
var UNDEFINED_GLUCOSE_READ = GlucoseRead{Time{GetTimeMillis(util.GLUKIT_EPOCH_TIME), "UTC"}, "NONE", UNDEFINED_READ}
Functions ¶
func GetBoundariesOfElementsInRange ¶
func GetBoundariesOfElementsInRange(slice Interface, lowerBound, upperBound time.Time) (startIndex, endIndex int)
filter filters out any value that is outside of the lower and upper bounds. The two bounds are inclusive and the returned indexes are inclusive too.
func GetTimeMillis ¶
Types ¶
type CalibrationRead ¶
type CalibrationRead struct { Time Time `json:"time" datastore:"time,noindex"` Unit GlucoseUnit `json:"unit" datastore:"unit,noindex"` Value float32 `json:"value" datastore:"value,noindex"` }
CalibrationRead represents a CGM read (not to be confused with a MeterRead which is a calibration value from an external meter
func (CalibrationRead) GetNormalizedValue ¶
func (element CalibrationRead) GetNormalizedValue(unit GlucoseUnit) (float32, error)
GetNormalizedValue gets the normalized value to the requested unit
func (CalibrationRead) GetTime ¶
func (element CalibrationRead) GetTime() time.Time
GetTime gets the time of a Timestamp value
type CalibrationReadSlice ¶
type CalibrationReadSlice []CalibrationRead
func (CalibrationReadSlice) Get ¶
func (slice CalibrationReadSlice) Get(i int) float64
func (CalibrationReadSlice) GetEpochTime ¶
func (slice CalibrationReadSlice) GetEpochTime(i int) (epochTime int64)
func (CalibrationReadSlice) Len ¶
func (slice CalibrationReadSlice) Len() int
func (CalibrationReadSlice) Less ¶
func (slice CalibrationReadSlice) Less(i, j int) bool
func (CalibrationReadSlice) Swap ¶
func (slice CalibrationReadSlice) Swap(i, j int)
func (CalibrationReadSlice) ToDataPointSlice ¶
func (slice CalibrationReadSlice) ToDataPointSlice() (dataPoints []DataPoint)
ToDataPointSlice converts a CalibrationReadSlice into a generic DataPoint array
type DataPoint ¶
type DataPoint struct { LocalTime string `json:"label"` EpochTime int64 `json:"x"` Y float32 `json:"y"` Value float32 `json:"value"` Tag string `json:"tag"` Unit GlucoseUnit `json:"unit"` }
Represents a generic data point in time
func MergeDataPointArrays ¶
type DataPointSlice ¶
type DataPointSlice []DataPoint
func (DataPointSlice) Len ¶
func (slice DataPointSlice) Len() int
func (DataPointSlice) Less ¶
func (slice DataPointSlice) Less(i, j int) bool
func (DataPointSlice) Swap ¶
func (slice DataPointSlice) Swap(i, j int)
type DayOfCalibrationReads ¶
type DayOfCalibrationReads struct { Reads []CalibrationRead `datastore:"calibrations,noindex"` StartTime time.Time `datastore:"startTime"` EndTime time.Time `datastore:"endTime"` }
This holds an array of reads for a whole day
func NewDayOfCalibrationReads ¶
func NewDayOfCalibrationReads(reads []CalibrationRead) DayOfCalibrationReads
type DayOfExercises ¶
type DayOfExercises struct { Exercises []Exercise `datastore:"exercises,noindex"` StartTime time.Time `datastore:"startTime"` EndTime time.Time `datastore:"endTime"` }
This holds an array of exercise events for a whole day
func NewDayOfExercises ¶
func NewDayOfExercises(exercises []Exercise) DayOfExercises
type DayOfGlucoseReads ¶
type DayOfGlucoseReads struct { Reads []GlucoseRead `datastore:"reads,noindex"` StartTime time.Time `datastore:"startTime"` EndTime time.Time `datastore:"endTime"` }
This holds an array of reads for a whole day
func NewDayOfGlucoseReads ¶
func NewDayOfGlucoseReads(reads []GlucoseRead) DayOfGlucoseReads
type DayOfInjections ¶
type DayOfInjections struct { Injections []Injection `datastore:"injections,noindex"` StartTime time.Time `datastore:"startTime"` EndTime time.Time `datastore:"endTime"` }
This holds an array of injections for a whole day
func NewDayOfInjections ¶
func NewDayOfInjections(injections []Injection) DayOfInjections
type DayOfMeals ¶
type DayOfMeals struct { Meals []Meal `datastore:"meals,noindex"` StartTime time.Time `datastore:"startTime"` EndTime time.Time `datastore:"endTime"` }
This holds an array of injections for a whole day
func NewDayOfMeals ¶
func NewDayOfMeals(meals []Meal) DayOfMeals
type Exercise ¶
type ExerciseSlice ¶
type ExerciseSlice []Exercise
func (ExerciseSlice) GetEpochTime ¶
func (slice ExerciseSlice) GetEpochTime(i int) (epochTime int64)
func (ExerciseSlice) Len ¶
func (slice ExerciseSlice) Len() int
func (ExerciseSlice) Less ¶
func (slice ExerciseSlice) Less(i, j int) bool
func (ExerciseSlice) Swap ¶
func (slice ExerciseSlice) Swap(i, j int)
func (ExerciseSlice) ToDataPointSlice ¶
func (slice ExerciseSlice) ToDataPointSlice(matchingReads []GlucoseRead, glucoseUnit GlucoseUnit) (dataPoints []DataPoint)
ToDataPointSlice converts an ExerciseSlice into a generic DataPoint array
type GlucoseRead ¶
type GlucoseRead struct { Time Time `json:"time" datastore:"time,noindex"` Unit GlucoseUnit `json:"unit" datastore:"unit,noindex"` Value float32 `json:"value" datastore:"value,noindex"` }
GlucoseRead represents a CGM read (not to be confused with a MeterRead which is a calibration value from an external meter
func (GlucoseRead) GetNormalizedValue ¶
func (element GlucoseRead) GetNormalizedValue(unit GlucoseUnit) (float32, error)
GetNormalizedValue gets the normalized value to the requested unit
func (GlucoseRead) GetTime ¶
func (element GlucoseRead) GetTime() time.Time
GetTime gets the time of a Timestamp value
type GlucoseReadSlice ¶
type GlucoseReadSlice []GlucoseRead
func (GlucoseReadSlice) Get ¶
func (slice GlucoseReadSlice) Get(i int) float64
func (GlucoseReadSlice) GetEpochTime ¶
func (slice GlucoseReadSlice) GetEpochTime(i int) (epochTime int64)
func (GlucoseReadSlice) Len ¶
func (slice GlucoseReadSlice) Len() int
func (GlucoseReadSlice) Less ¶
func (slice GlucoseReadSlice) Less(i, j int) bool
func (GlucoseReadSlice) Swap ¶
func (slice GlucoseReadSlice) Swap(i, j int)
func (GlucoseReadSlice) ToDataPointSlice ¶
func (slice GlucoseReadSlice) ToDataPointSlice(glucoseUnit GlucoseUnit) (dataPoints []DataPoint)
ToDataPointSlice converts a GlucoseReadSlice into a generic DataPoint array
type GlucoseUnit ¶
type GlucoseUnit string
type Injection ¶
type Injection struct { Time Time `json:"time" datastore:"time,noindex"` Units float32 `json:"units" datastore:"units,noindex"` InsulinName string `json:"insulinName" datastore:"insulinName,noindex"` InsulinType string `json:"insulinType" datastore:"insulinType,noindex"` }
Injection represents an insulin injection
type InjectionSlice ¶
type InjectionSlice []Injection
func (InjectionSlice) GetEpochTime ¶
func (slice InjectionSlice) GetEpochTime(i int) (epochTime int64)
func (InjectionSlice) Len ¶
func (slice InjectionSlice) Len() int
func (InjectionSlice) Less ¶
func (slice InjectionSlice) Less(i, j int) bool
func (InjectionSlice) Swap ¶
func (slice InjectionSlice) Swap(i, j int)
func (InjectionSlice) ToDataPointSlice ¶
func (slice InjectionSlice) ToDataPointSlice(matchingReads []GlucoseRead, glucoseUnit GlucoseUnit) (dataPoints []DataPoint)
ToDataPointSlice converts an InjectionSlice into a generic DataPoint array
type Meal ¶
type Meal struct { Time Time `json:"time" datastore:"time,noindex"` Carbohydrates float32 `json:"carbohydrates" datastore:"carbohydrates,noindex"` Proteins float32 `json:"proteins" datastore:"proteins,noindex"` Fat float32 `json:"fat" datastore:"fat,noindex"` SaturatedFat float32 `json:"saturatedFat" datastore:"saturatedFat,noindex"` }
Meal is the data structure that represents a meal of food intake. Only carbohydrates are fully supported at the moment.
type MealSlice ¶
type MealSlice []Meal
func (MealSlice) GetEpochTime ¶
func (MealSlice) ToDataPointSlice ¶
func (slice MealSlice) ToDataPointSlice(matchingReads []GlucoseRead, glucoseUnit GlucoseUnit) (dataPoints []DataPoint)
ToDataPointSlice converts an MealSlice into a generic DataPoint array