Documentation ¶
Overview ¶
This file contains the implementation of the common properties used for contest scoring.
The package conval helps to evaluate the log files from amateur radio contests.
This file contains the implementation of the specific things for contests announced by the EUDXCC (https://eudxcc.altervista.org/).
This file contains the implementation of the specific things for contests announced by the Dutch amateur radio association VERON.
Index ¶
- Constants
- Variables
- func CanadianTerritory(call callsign.Callsign) string
- func IncludedDefinitionNames() ([]string, error)
- func IsWAECountry(call callsign.Callsign, dxccEntity DXCCEntity) bool
- func NewPrefixDatabase() (*prefixDatabase, error)
- func SaveDefinitionYAML(w io.Writer, definition *Definition, withExamples bool) error
- func ValidateExamples(definition *Definition, prefixes PrefixDatabase) error
- func ValidateExamplesTrace(definition *Definition, prefixes PrefixDatabase) error
- func VeronEntity(call callsign.Callsign, dxccEntity DXCCEntity) string
- func WAEEntity(call callsign.Callsign, dxccEntity DXCCEntity) string
- func WPXPrefix(call callsign.Callsign) string
- type BandAndMode
- type BandChangeRule
- type BandCount
- type BandRule
- type BandScore
- type CQZone
- type Category
- type ConstrainedDuration
- type Constraint
- type ContestBand
- type ContestIdentifier
- type Continent
- type Counter
- func (c *Counter) Add(qso QSO) QSOScore
- func (c Counter) BandScore(band ContestBand) BandScore
- func (c Counter) BandsPerMulti(property Property, multi string) []ContestBand
- func (c *Counter) EffectiveExchangeFields(theirCall callsign.Callsign) []ExchangeField
- func (c Counter) EvaluateAll(startTime time.Time, resolution time.Duration) []ScoreBin
- func (c Counter) MultiProperties() []Property
- func (c Counter) MultisPerBand(property Property, band ContestBand) []string
- func (c Counter) MultisPerProperty(property Property) []string
- func (c Counter) Probe(qso QSO) QSOScore
- func (c *Counter) SetTrace(trace bool)
- func (c Counter) Total(score BandScore) int
- func (c Counter) TotalScore() BandScore
- func (c Counter) UsedBands() []ContestBand
- type DXCCEntity
- type Definition
- type DurationConstraintMode
- type Example
- type ExchangeDefinition
- type ExchangeField
- type ITUZone
- type Mode
- type MultiOperation
- type OperatorMode
- type Overlay
- type PowerMode
- type PrefixDatabase
- type PrefixDatabaseFunc
- type Property
- type PropertyConstraint
- type PropertyDefinition
- type PropertyGetter
- type PropertyGetterFunc
- type PropertyValidator
- type PropertyValidatorFunc
- type PropertyValidators
- type PropertyValidatorsFunc
- type QSO
- type QSOExample
- type QSOExchange
- type QSOScore
- type ScoreBin
- type ScoreExample
- type ScoreMode
- type ScoredQSO
- type Scoring
- type ScoringRule
- type Setup
- type SetupExample
- type TXMode
Constants ¶
View Source
const ( SamePrefix string = "same" OtherPrefix string = "other" NotPrefix string = "not" )
Variables ¶
View Source
var ( CallsignValidator = PropertyValidatorFunc(func(exchange string, _ PrefixDatabase) error { _, err := callsign.Parse(exchange) if err != nil { return err } return nil }) DXCCPrefixValidator = PropertyValidatorFunc(func(exchange string, prefixes PrefixDatabase) error { _, entity, _, _, found := prefixes.Find(exchange) if !found { return fmt.Errorf("%s is not a valid DXCC prefix", exchange) } if exchange != string(entity) { return fmt.Errorf("%s is not a primary DXCC prefix", exchange) } return nil }) )
View Source
var AllHFBands = []ContestBand{Band160m, Band80m, Band40m, Band20m, Band15m, Band10m}
View Source
var EmptyValidator = PropertyValidatorFunc(func(exchange string, _ PrefixDatabase) error { exchange = strings.TrimSpace(exchange) if exchange != "" { return fmt.Errorf("%s is not empty", exchange) } return nil })
Functions ¶
func CanadianTerritory ¶ added in v0.3.4
func IncludedDefinitionNames ¶
func IsWAECountry ¶
func IsWAECountry(call callsign.Callsign, dxccEntity DXCCEntity) bool
func NewPrefixDatabase ¶ added in v0.3.0
func NewPrefixDatabase() (*prefixDatabase, error)
func SaveDefinitionYAML ¶ added in v0.3.0
func SaveDefinitionYAML(w io.Writer, definition *Definition, withExamples bool) error
func ValidateExamples ¶
func ValidateExamples(definition *Definition, prefixes PrefixDatabase) error
func ValidateExamplesTrace ¶ added in v0.5.0
func ValidateExamplesTrace(definition *Definition, prefixes PrefixDatabase) error
func VeronEntity ¶ added in v0.3.4
func VeronEntity(call callsign.Callsign, dxccEntity DXCCEntity) string
Types ¶
type BandAndMode ¶
type BandAndMode struct { Band ContestBand Mode Mode }
type BandChangeRule ¶
type BandChangeRule struct { Constraint `yaml:",inline"` GracePeriod time.Duration `yaml:"grace_period"` MultiplierException bool `yaml:"multiplier_exception"` }
type Category ¶
type Category struct { Name string `yaml:"name"` Operator OperatorMode `yaml:"operator,omitempty"` TX TXMode `yaml:"tx,omitempty"` Power PowerMode `yaml:"power,omitempty"` BandCount BandCount `yaml:"band_count"` Bands []ContestBand `yaml:"bands,omitempty"` Modes []Mode `yaml:"modes,omitempty"` Assisted bool `yaml:"assisted,omitempty"` Overlay Overlay `yaml:"overlay,omitempty"` ScoreMode ScoreMode `yaml:"score_mode,omitempty"` Duration time.Duration `yaml:"duration,omitempty"` }
type ConstrainedDuration ¶
type ConstrainedDuration struct { Constraint `yaml:",inline"` Duration time.Duration `yaml:"duration"` Mode DurationConstraintMode `yaml:"constraint_mode,omitempty"` }
type Constraint ¶
type Constraint struct { OperatorMode OperatorMode `yaml:"operator_mode"` Overlay Overlay `yaml:"overlay"` }
type ContestBand ¶
type ContestBand string
const ( BandAll ContestBand = "all" Band160m ContestBand = "160m" Band80m ContestBand = "80m" Band40m ContestBand = "40m" Band20m ContestBand = "20m" Band15m ContestBand = "15m" Band10m ContestBand = "10m" )
type ContestIdentifier ¶
type ContestIdentifier string
A ContestIdentifier aka. Cabrillo name is a unique identifier for a contest. See https://www.contestcalendar.com/cabnames.php
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
func NewCounter ¶
func NewCounter(definition Definition, setup Setup, prefixes PrefixDatabase) *Counter
func (Counter) BandScore ¶
func (c Counter) BandScore(band ContestBand) BandScore
func (Counter) BandsPerMulti ¶
func (c Counter) BandsPerMulti(property Property, multi string) []ContestBand
func (*Counter) EffectiveExchangeFields ¶
func (c *Counter) EffectiveExchangeFields(theirCall callsign.Callsign) []ExchangeField
func (Counter) EvaluateAll ¶ added in v0.2.0
func (Counter) MultiProperties ¶
func (Counter) MultisPerBand ¶
func (c Counter) MultisPerBand(property Property, band ContestBand) []string
func (Counter) MultisPerProperty ¶
func (Counter) TotalScore ¶
func (Counter) UsedBands ¶
func (c Counter) UsedBands() []ContestBand
type DXCCEntity ¶
type DXCCEntity string
const ( SameCountry DXCCEntity = "same" OtherCountry DXCCEntity = "other" NotCountry DXCCEntity = "not" )
func (DXCCEntity) String ¶ added in v0.5.0
func (e DXCCEntity) String() string
type Definition ¶
type Definition struct { Name string `yaml:"name"` Identifier ContestIdentifier `yaml:"identifier"` OfficialRules string `yaml:"official_rules"` UploadURL string `yaml:"upload_url"` UploadFormat string `yaml:"upload_format"` Duration time.Duration `yaml:"duration,omitempty"` DurationConstraints []ConstrainedDuration `yaml:"duration-constraints,omitempty"` Breaks []ConstrainedDuration `yaml:"breaks,omitempty"` Categories []Category `yaml:"categories,omitempty"` Overlays []Overlay `yaml:"overlays,omitempty"` Modes []Mode `yaml:"modes,omitempty"` Bands []ContestBand `yaml:"bands,omitempty"` BandChangeRules []BandChangeRule `yaml:"band_change_rules,omitempty"` Properties []PropertyDefinition `yaml:"properties,omitempty"` Exchange []ExchangeDefinition `yaml:"exchange"` Scoring Scoring `yaml:"scoring"` Examples []Example `yaml:"examples,omitempty"` }
A Definition of a contest.
func IncludedDefinition ¶
func IncludedDefinition(name string) (*Definition, error)
func LoadDefinitionFromFile ¶
func LoadDefinitionFromFile(filename string) (*Definition, error)
func LoadDefinitionYAML ¶
func LoadDefinitionYAML(r io.Reader) (*Definition, error)
func (Definition) ExchangeFields ¶ added in v0.3.1
func (d Definition) ExchangeFields() []ExchangeField
func (Definition) PropertyGetter ¶ added in v0.4.0
func (d Definition) PropertyGetter(property Property) (PropertyGetter, bool)
func (Definition) PropertyValidator ¶ added in v0.4.0
func (d Definition) PropertyValidator(property Property) (PropertyValidator, bool)
type DurationConstraintMode ¶ added in v0.3.2
type DurationConstraintMode string
const ( // TotalTime counts from the timestamp of the first QSO until the timestamp of the last QSO without considering breaks. TotalTime DurationConstraintMode = "total_time" // ActiveTime counts from the timestamp of the first QSO until the timestamp of the last QSO, breaks that last at least one hour are subtracted. ActiveTime DurationConstraintMode = "active_time" )
type Example ¶
type Example struct { Setup SetupExample `yaml:"setup"` QSOs []QSOExample `yaml:"qsos"` Score ScoreExample `yaml:"score"` }
type ExchangeDefinition ¶
type ExchangeDefinition struct { MyContinent []Continent `yaml:"my_continent,omitempty"` MyCountry []DXCCEntity `yaml:"my_country,omitempty"` TheirContinent []Continent `yaml:"their_continent,omitempty"` TheirCountry []DXCCEntity `yaml:"their_country,omitempty"` TheirWorkingCondition []string `yaml:"their_working_condition,omitempty"` AdditionalWeight int `yaml:"additional_weight,omitempty"` Fields []ExchangeField `yaml:"fields,omitempty"` }
type ExchangeField ¶
type ExchangeField []Property
func (ExchangeField) Contains ¶ added in v0.3.1
func (f ExchangeField) Contains(property Property) bool
func (ExchangeField) Strings ¶ added in v0.3.1
func (f ExchangeField) Strings() []string
type MultiOperation ¶ added in v0.3.2
type MultiOperation string
const ( DefaultMultiOperation MultiOperation = "" MultiplyMultis MultiOperation = "multiply" AddMultis MultiOperation = "add" )
type OperatorMode ¶
type OperatorMode string
const ( SingleOperator OperatorMode = "single" MultiOperator OperatorMode = "multi" )
type PrefixDatabase ¶
type PrefixDatabaseFunc ¶ added in v0.3.1
type PrefixDatabaseFunc func(s string) (Continent, DXCCEntity, bool)
func (PrefixDatabaseFunc) Find ¶ added in v0.3.1
func (f PrefixDatabaseFunc) Find(s string) (Continent, DXCCEntity, bool)
type Property ¶
type Property string
const ( TheirCallProperty Property = "their_call" RSTProperty Property = "rst" SerialNumberProperty Property = "serial" MemberNumberProperty Property = "member_number" NoMemberProperty Property = "nm" CallsignProperty Property = "callsign" // can be used as exchange, e.g. in the silent key memorial contests CQZoneProperty Property = "cq_zone" ITUZoneProperty Property = "itu_zone" DXCCEntityProperty Property = "dxcc_entity" WorkingConditionProperty Property = "working_condition" NameProperty Property = "name" AgeProperty Property = "age" PowerProperty Property = "power" ClassProperty Property = "class" StateProvinceProperty Property = "state_province" DXCCPrefixProperty Property = "dxcc_prefix" // can be used as exchange, e.g. in the CWops contests WAEEntityProperty Property = "wae_entity" WPXPrefixProperty Property = "wpx_prefix" GenericTextProperty Property = "generic_text" GenericNumberProperty Property = "generic_number" EmptyProperty Property = "empty" )
const (
EURegionProperty Property = "eu_region"
)
type PropertyConstraint ¶ added in v0.3.2
type PropertyConstraint struct { Name Property `yaml:"name"` Min string `yaml:"min,omitempty"` Max string `yaml:"max,omitempty"` MyValue string `yaml:"my_value,omitempty"` TheirValue string `yaml:"their_value,omitempty"` TheirValueEmpty bool `yaml:"their_value_empty,omitempty"` TheirValueNotEmpty bool `yaml:"their_value_not_empty,omitempty"` SameValue bool `yaml:"same,omitempty"` OtherValue bool `yaml:"other,omitempty"` }
type PropertyDefinition ¶ added in v0.4.0
type PropertyDefinition struct { Name Property `yaml:"name"` Label string `yaml:"label,omitempty"` Values []string `yaml:"values,omitempty"` Expression string `yaml:"expression,omitempty"` Source Property `yaml:"source,omitempty"` // contains filtered or unexported fields }
func (*PropertyDefinition) GetLabel ¶ added in v0.4.0
func (d *PropertyDefinition) GetLabel() string
func (*PropertyDefinition) GetProperty ¶ added in v0.4.0
func (d *PropertyDefinition) GetProperty(qso QSO, _ PrefixDatabase) string
func (*PropertyDefinition) ValidateProperty ¶ added in v0.4.0
func (d *PropertyDefinition) ValidateProperty(value string, _ PrefixDatabase) error
type PropertyGetter ¶
type PropertyGetter interface {
GetProperty(QSO, PrefixDatabase) string
}
type PropertyGetterFunc ¶
type PropertyGetterFunc func(QSO, PrefixDatabase) string
func (PropertyGetterFunc) GetProperty ¶
func (f PropertyGetterFunc) GetProperty(qso QSO, prefixes PrefixDatabase) string
type PropertyValidator ¶
type PropertyValidator interface {
ValidateProperty(string, PrefixDatabase) error
}
func CommonPropertyValidator ¶ added in v0.4.0
func CommonPropertyValidator(property Property) (PropertyValidator, bool)
func NumberRangeValidator ¶
func NumberRangeValidator(from, to int, name string) PropertyValidator
func RegexpValidator ¶
func RegexpValidator(exp *regexp.Regexp, name string) PropertyValidator
type PropertyValidatorFunc ¶
type PropertyValidatorFunc func(string, PrefixDatabase) error
func (PropertyValidatorFunc) ValidateProperty ¶
func (f PropertyValidatorFunc) ValidateProperty(exchange string, prefixes PrefixDatabase) error
type PropertyValidators ¶
type PropertyValidators interface {
PropertyValidator(Property) (PropertyValidator, bool)
}
type PropertyValidatorsFunc ¶ added in v0.4.0
type PropertyValidatorsFunc func(Property) (PropertyValidator, bool)
func (PropertyValidatorsFunc) PropertyValidator ¶ added in v0.4.0
func (f PropertyValidatorsFunc) PropertyValidator(property Property) (PropertyValidator, bool)
type QSO ¶
type QSO struct { TheirCall callsign.Callsign TheirContinent Continent TheirCountry DXCCEntity Timestamp time.Time Band ContestBand Mode Mode MyExchange QSOExchange TheirExchange QSOExchange }
func (QSO) TheirPrefix ¶ added in v0.3.4
type QSOExample ¶
type QSOExample struct { TheirCall string `yaml:"their_call,omitempty"` TheirContinent Continent `yaml:"their_continent,omitempty"` TheirCountry DXCCEntity `yaml:"their_country,omitempty"` Timestamp time.Time `yaml:"time,omitempty"` Band ContestBand `yaml:"band,omitempty"` Mode Mode `yaml:"mode,omitempty"` TheirExchange []string `yaml:"their_exchange,omitempty"` Score QSOScore `yaml:",inline"` }
func (QSOExample) ToQSO ¶
func (q QSOExample) ToQSO(fields []ExchangeField, myExchange QSOExchange, prefixes PrefixDatabase, propertyValidators PropertyValidators) QSO
type QSOExchange ¶
func ParseExchange ¶
func ParseExchange(fields []ExchangeField, values []string, prefixes PrefixDatabase, propertyValidators PropertyValidators) QSOExchange
func (QSOExchange) Add ¶
func (e QSOExchange) Add(fields []ExchangeField, values []string, prefixes PrefixDatabase, propertyValidators PropertyValidators)
type QSOScore ¶
type ScoreBin ¶ added in v0.2.0
type ScoreExample ¶ added in v0.3.2
type ScoreMode ¶ added in v0.3.2
type ScoreMode string
const ( // StrictScore allows only the number of bands defined in the category (single, <any number>, all). If more bands were worked, the claimed score is zero. StrictScore ScoreMode = "strict" // BestScore counts only the best n bands, according to the number of bands defined in the category (single, <any number>, all). BestScore ScoreMode = "best" )
type Scoring ¶
type Scoring struct { QSORules []ScoringRule `yaml:"qsos,omitempty"` QSOBandRule BandRule `yaml:"qso_band_rule,omitempty"` MultiRules []ScoringRule `yaml:"multis,omitempty"` MultiOperation MultiOperation `yaml:"multi_operation,omitempty"` }
type ScoringRule ¶
type ScoringRule struct { MyContinent []Continent `yaml:"my_continent,omitempty"` MyCountry []DXCCEntity `yaml:"my_country,omitempty"` MyPrefix []string `yaml:"my_prefix,omitempty"` TheirContinent []Continent `yaml:"their_continent,omitempty"` TheirCountry []DXCCEntity `yaml:"their_country,omitempty"` TheirPrefix []string `yaml:"their_prefix,omitempty"` TheirWorkingCondition []string `yaml:"their_working_condition,omitempty"` Bands []ContestBand `yaml:"bands,omitempty"` Property Property `yaml:"property,omitempty"` // only useful for multis Except []string `yaml:"except,omitempty"` // only useful for multis PropertyConstraints []PropertyConstraint `yaml:"property_constraints,omitempty"` BandRule BandRule `yaml:"band_rule,omitempty"` AdditionalWeight int `yaml:"additional_weight,omitempty"` Value int `yaml:"value,omitempty"` }
type Setup ¶
type Setup struct { MyCall callsign.Callsign MyContinent Continent MyCountry DXCCEntity GridLocator locator.Locator Operators []callsign.Callsign OperatorMode OperatorMode Overlay Overlay Power PowerMode Bands []ContestBand Modes []Mode MyExchange QSOExchange }
func LoadSetupFromFile ¶
type SetupExample ¶
type SetupExample struct { MyCall string `yaml:"my_call,omitempty"` MyContinent Continent `yaml:"my_continent,omitempty"` MyCountry DXCCEntity `yaml:"my_country,omitempty"` GridLocator string `yaml:"grid_locator,omitempty"` Operators []string `yaml:"operators,omitempty"` OperatorMode OperatorMode `yaml:"operator_mode,omitempty"` Overlay Overlay `yaml:"overlay,omitempty"` Power PowerMode `yaml:"power,omitempty"` Bands []ContestBand `yaml:"bands,omitempty"` Modes []Mode `yaml:"modes,omitempty"` MyExchange QSOExchange `yaml:"my_exchange,omitempty"` }
func (SetupExample) ToSetup ¶
func (s SetupExample) ToSetup() Setup
Source Files ¶
Click to show internal directories.
Click to hide internal directories.