model

package
v0.0.0-...-a2a2cd2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2023 License: MIT, MIT Imports: 4 Imported by: 0

Documentation

Overview

Package models provides model types

Index

Constants

View Source
const (
	DIABETES_TYPE_1 = "T1"
	DIABETES_TYPE_2 = "T2"
)

Type of diabetes

View Source
const (
	TARGET_GLUCOSE_VALUE    = 83.
	EXERCISE_VALUE_FORMAT   = "%d,%s"
	UNDEFINED_SCORE_VALUE   = int64(math.MaxInt64)
	DEFAULT_LOOKBACK_PERIOD = time.Duration(-7*24) * time.Hour
)
View Source
const (
	UNDEFINED_A1C_VALUE = math.SmallestNonzeroFloat64
)

Variables

View Source
var UNDEFINED_A1C_ESTIMATE = A1CEstimate{Value: UNDEFINED_A1C_VALUE, LowerBound: util.GLUKIT_EPOCH_TIME, UpperBound: util.GLUKIT_EPOCH_TIME, CalculatedOn: util.GLUKIT_EPOCH_TIME, ScoringVersion: -1}

"Dynamic" constants, those should never be updated

View Source
var UNDEFINED_SCORE = GlukitScore{Value: UNDEFINED_SCORE_VALUE, LowerBound: util.GLUKIT_EPOCH_TIME, UpperBound: util.GLUKIT_EPOCH_TIME, CalculatedOn: util.GLUKIT_EPOCH_TIME, ScoringVersion: -1}

"Dynamic" constants, those should never be updated

Functions

This section is empty.

Types

type A1CEstimate

type A1CEstimate struct {
	Value          float64   `datastore:"value"`
	LowerBound     time.Time `datastore:"lowerBound"`
	UpperBound     time.Time `datastore:"upperBound"`
	CalculatedOn   time.Time `datastore:"calculatedOn"`
	ScoringVersion int       `datastore:"scoringVersion`
}

A1CEstimate is a calculated estimate of an a1c. The lower and upper bounds should match the date of the first and last read of the period used to calculate the score. The scoring version represents the version of the calculation algorithm used to calculate a given estimate It is used to discard/recalculate older versions of glukit scores in the eventuality where we change how we calculate the internal estimation.

type Coordinate

type Coordinate struct {
	X int `json:"x"`
	Y int `json:"y"`
}

Represents a cartesian coordinate

type CoordinateSlice

type CoordinateSlice []Coordinate

func (CoordinateSlice) Get

func (slice CoordinateSlice) Get(i int) int

func (CoordinateSlice) Len

func (slice CoordinateSlice) Len() int

func (CoordinateSlice) Less

func (slice CoordinateSlice) Less(i, j int) bool

func (CoordinateSlice) Swap

func (slice CoordinateSlice) Swap(i, j int)

type DashboardData

type DashboardData struct {
	Average float64 `json:"average"`
	Median  float64 `json:"median"`
	High    float64 `json:"high"`
	Low     float64 `json:"low"`
}

Represents the structure of the dashboard data for a user

type DataStoreDayOfCalibrationReads

type DataStoreDayOfCalibrationReads apimodel.DayOfCalibrationReads

type DataStoreDayOfExercises

type DataStoreDayOfExercises apimodel.DayOfExercises

type DataStoreDayOfGlucoseReads

type DataStoreDayOfGlucoseReads apimodel.DayOfGlucoseReads

type DataStoreDayOfInjections

type DataStoreDayOfInjections apimodel.DayOfInjections

type DataStoreDayOfMeals

type DataStoreDayOfMeals apimodel.DayOfMeals

type FileImportLog

type FileImportLog struct {
	Id                string
	Md5Checksum       string
	LastDataProcessed time.Time
	ImportResult      string
}

Represents the logging of a file import

type GlukitScore

type GlukitScore struct {
	Value          int64     `datastore:"value"`
	LowerBound     time.Time `datastore:"lowerBound"`
	UpperBound     time.Time `datastore:"upperBound"`
	CalculatedOn   time.Time `datastore:"calculatedOn"`
	ScoringVersion int       `datastore:"scoringVersion`
}

Represents a GlukitScore value, the lower and upper bounds should match the date of the first and last read of the period used to calculate the score. The GlukitScore scoring version represents the version of the calculation algorithm used to calculate a given score. It is used to discard/recalculate older versions of glukit scores in the eventuality where we change how we calculate the internal score.

func (GlukitScore) IsBetterThan

func (score GlukitScore) IsBetterThan(reference GlukitScore) bool

Compares one GlukitScore with another and returns true if the score is better than the reference score passed in argument i.e. newValue.IsBetterThan(oldValue) would return true if the newValue's score is better than the oldValue's score.

type GlukitUser

type GlukitUser struct {
	Email           string               `datastore:"email"`
	FirstName       string               `datastore:"firstName,noindex"`
	LastName        string               `datastore:"lastName,noindex"`
	DateOfBirth     time.Time            `datastore:"birthdate"`
	DiabetesType    string               `datastore:"diabetesType"`
	Timezone        string               `datastore:"timezoneId,noindex"`
	LastUpdated     time.Time            `datastore:"lastUpdated"`
	MostRecentRead  apimodel.GlucoseRead `datastore:"mostRecentRead"`
	BestScore       GlukitScore          `datastore:"bestScore"`
	MostRecentScore GlukitScore          `datastore:"mostRecentScore"`
	Internal        bool                 `datastore:"internal"`
	PictureUrl      string               `datastore:"pictureUrl,noindex"`
	AccountCreated  time.Time            `datastore:"joinedOn"`
	MostRecentA1C   A1CEstimate          `datastore:"mostRecentA1C"`
}

Represents a GlukitUser profile

type ReadStatsSlice

type ReadStatsSlice []apimodel.GlucoseRead

Type for a slice of GlucoseReads with comparison based on value rather than time. It is used as read statistics.

func (ReadStatsSlice) Get

func (slice ReadStatsSlice) Get(i int) float64

func (ReadStatsSlice) Len

func (slice ReadStatsSlice) Len() int

func (ReadStatsSlice) Less

func (slice ReadStatsSlice) Less(i, j int) bool

func (ReadStatsSlice) Swap

func (slice ReadStatsSlice) Swap(i, j int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL