Documentation ¶
Index ¶
- Variables
- func FilterExposuresByDate(exposureSummaries *[]ExposureSummary, date int) *[]ExposureSummary
- func GetExposureDay(exposureSummary *ExposureSummary) int
- func MaxWeightedDuration(attenuationWeights []float32) int
- func SaveJSONFile(request *ExposureNotificationRequest) (string, error)
- func WeightedDuration(exposureSummary *ExposureSummary, attenuationWeights []float32) int
- type AttenuationDurations
- type ExposureConfiguration
- type ExposureNotificationRequest
- type ExposureNotificationResponse
- func CreateNotification(exposureSummary *ExposureSummary, attenuationWeights []float32) *ExposureNotificationResponse
- func CreateNotificationAggregated(newExposureSummary *ExposureSummary, unusedExposures *[]ExposureSummary, ...) *ExposureNotificationResponse
- func ScoreV1(request *ExposureNotificationRequest) (*ExposureNotificationResponse, error)
- type ExposureSummary
- type Notification
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 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
func ScoreV1 ¶
func ScoreV1(request *ExposureNotificationRequest) (*ExposureNotificationResponse, error)
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"` }
Click to show internal directories.
Click to hide internal directories.