model

package
v0.0.0-...-f30afd4 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoConfig = errors.New("No config.json input to scoring function")
)

Functions

func FilterExposuresByDate

func FilterExposuresByDate(exposureSummaries *[]ExposureSummary, date int) *[]ExposureSummary

func GetExposureDay

func GetExposureDay(exposureSummary *ExposureSummary) int

Calculate the day that the last exposure happened.

func MaxWeightedDuration

func MaxWeightedDuration(attenuationWeights []float32) int

func SaveJSONFile

func SaveJSONFile(request *ExposureNotificationRequest) (string, error)

func WeightedDuration

func WeightedDuration(exposureSummary *ExposureSummary, attenuationWeights []float32) int

Types

type AttenuationDurations

type AttenuationDurations struct {
	Low    int `json:"low"`
	Medium int `json:"medium"`
	High   int `json:"high"`
}

TODO: This whole omitemtpy business is very confusing. There doesn't seem to be a difference between the default value explicitly being filled out, and it missing. Those are not the same. Can we deal with this better?

type ExposureConfiguration

type ExposureConfiguration struct {
	MinimumRiskScore                 int       `json:"minimumRiskScore"`
	AttenuationDurationThresholds    []int     `json:"attenuationDurationThresholds"`
	AttenuationLevelValues           []int     `json:"attenuationLevelValues"`
	DaysSinceLastExposureLevelValues []int     `json:"daysSinceLastExposureLevelValues"`
	DurationLevelValues              []int     `json:"durationLevelValues"`
	TransmissionRiskLevelValues      []int     `json:"transmissionRiskLevelValues"`
	AttenuationBucketWeights         []float32 `json:"attenuationBucketWeights"`
	TriggerThresholdWeightedDuration int       `json:"triggerThresholdWeightedDuration"`
}

type ExposureNotificationRequest

type ExposureNotificationRequest struct {
	NewExposureSummary      ExposureSummary       `json:"newExposureSummary"`
	UnusedExposureSummaries []ExposureSummary     `json:"unusedExposureSummaries,omitempty"`
	ExposureConfiguration   ExposureConfiguration `json:"exposureConfiguration,omitempty"`
}

type ExposureNotificationResponse

type ExposureNotificationResponse struct {
	Notifications []Notification `json:"notifications,omitempty"`
}

func CreateNotification

func CreateNotification(exposureSummary *ExposureSummary, attenuationWeights []float32) *ExposureNotificationResponse

func CreateNotificationAggregated

func CreateNotificationAggregated(newExposureSummary *ExposureSummary, unusedExposures *[]ExposureSummary, weightedDuration int, attenuationWeights []float32) *ExposureNotificationResponse

type ExposureSummary

type ExposureSummary struct {
	DateReceived          int                  `json:"dateReceived"`
	TimezoneOffset        int                  `json:"timeZoneOffset"`
	SeqNoInDay            int                  `json:"seqNoInDay"`
	AttenuationDurations  AttenuationDurations `json:"attenuationDurations"`
	MatchedKeyCount       int                  `json:"matchedKeyCount"`
	DaysSinceLastExposure int                  `json:"daysSinceLastExposure"`
	MaximumRiskScore      int                  `json:"maximumRiskScore"`
	RiskScoreSum          int                  `json:"riskScoreSum"`
}

type Notification

type Notification struct {
	ExposureSummaries []ExposureSummary `json:"exposureSummaries,omitempty"`
	DurationSeconds   int               `json:"durationSeconds"`
	// Note: we must have dateOfExposure OR dateMostRecentExposure + matchedKeyCount, but NOT both.
	DateOfExposure         int `json:"dateOfExposure,omitempty"`
	DateMostRecentExposure int `json:"dateMostRecentExposure,omitempty"`
	MatchedKeyCount        int `json:"matchedKeyCount,omitempty"`
}

Jump to

Keyboard shortcuts

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