func (element GlucoseRead) GetNormalizedValue(unit GlucoseUnit) (float32, error) {
	if unit == element.Unit {
		return element.Value, nil
	}
	if element.Unit == UNKNOWN_GLUCOSE_MEASUREMENT_UNIT {
		return element.Value, nil
	}
	switch unit {
	case MMOL_PER_L:
		return element.Value * 0.0555, nil
	case MG_PER_DL:
		return element.Value * 18.0182, nil
	default:
		return -1., errors.New(fmt.Sprintf("Bad unit requested, [%s] is not one of [%s, %s]", unit, MG_PER_DL, MMOL_PER_L))
	}
}
GetNormalizedValue gets the normalized value to the requested unit
package apimodel
import (
	"errors"
	"fmt"
	"github.com/alexandre-normand/glukit/app/util"
	"time"
)
const (
	GLUCOSE_READ_TAG = "GlucoseRead"
	MMOL_PER_L                       = "mmolPerL"
	MG_PER_DL                        = "mgPerDL"
	UNKNOWN_GLUCOSE_MEASUREMENT_UNIT = "Unknown"
)
type GlucoseUnit string
type GlucoseRead struct {
	Time  Time        `json:"time" datastore:"time,noindex"`
	Unit  GlucoseUnit `json:"unit" datastore:"unit,noindex"`
	Value float32     `json:"value" datastore:"value,noindex"`
}
type DayOfGlucoseReads struct {
	Reads     []GlucoseRead `datastore:"reads,noindex"`
	StartTime time.Time     `datastore:"startTime"`
	EndTime   time.Time     `datastore:"endTime"`
}
func NewDayOfGlucoseReads(reads []GlucoseRead) DayOfGlucoseReads {
	return DayOfGlucoseReads{reads, reads[0].GetTime().Truncate(DAY_OF_DATA_DURATION), reads[len(reads)-1].GetTime()}
}
func (element GlucoseRead) GetTime() time.Time {
	return element.Time.GetTime()
}