ranking

package
v1.34.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const BaseRank = 100

BaseRank is the base ranking score for sources. If a source is prefered, it should be given a score lower than BaseRank in StatsRanking. If a source is not prefered, it should be given a score higher than BaseRank in StatsRanking

Variables

View Source
var StatsRanking = map[RankKey]int{
	{"CensusPEP", "CensusPEPSurvey", "*"}:                                0,
	{"CensusACS5YearSurvey", "CensusACS5yrSurvey", "*"}:                  1,
	{"CensusACS5YearSurvey_AggCountry", "CensusACS5yrSurvey", "*"}:       1,
	{"CensusUSAMedianAgeIncome", "CensusACS5yrSurvey", "*"}:              1,
	{"USDecennialCensus_RedistrictingRelease", "USDecennialCensus", "*"}: 2,
	{"EurostatData", "EurostatRegionalPopulationData", "*"}:              3,
	{"WorldDevelopmentIndicators", "*", "*"}:                             4,

	{"IndiaCensus_Primary", "*", "*"}:                 5,
	{"WikipediaStatsData", "Wikipedia", "*"}:          1001,
	{"HumanCuratedStats", "HumanCuratedStats", "*"}:   1002,
	{"WikidataPopulation", "WikidataPopulation", "*"}: 1003,

	{"BLS_LAUS", "BLSSeasonallyUnadjusted", "*"}: 0,
	{"BLS_CPS", "BLSSeasonallyAdjusted", "*"}:    1,
	{"EurostatData", "", "*"}:                    2,

	{"NYT_COVID19", "NYT_COVID19_GitHub", "*"}: 0,

	{"CDC500", "AgeAdjustedPrevalence", "*"}: 0,

	{"UNEnergy", "", "*"}:         0,
	{"EIA_Electricity", "*", "*"}: 1,

	{"NOAA_EPA_Observed_Historical_Weather", "*", "*"}: 0,
	{"Copernicus_ECMWF_ERA5_Monthly", "*", "*"}:        0,
	{"NASA_NEXDCP30", "NASA_Mean_CCSM4", "P1M"}:        0,
	{"NASA_NEXGDDP", "NASA_Mean_CMIP5_CCSM4", "P1M"}:   0,
	{"NASA_NEXDCP30_StatVarSeriesAggr", "*", "P1M"}:    0,
	{"NASA_NEXGDDP_StatVarSeriesAggr", "*", "P1M"}:     0,

	{"NASA_WetBulbComputation_Aggregation", "NASA_Mean_HadGEM2-AO", "*"}: 0,
	{"NASA_WetBulbComputation_Aggregation", "*", "*"}:                    1,
	{"NASA_WetBulbComputation", "NASA_Mean_HadGEM2-AO", "*"}:             2,

	{"FBIHateCrimePublications", "*", "*"}: 0,
	{"FBIHateCrime", "*", "*"}:             1,
}

StatsRanking is used to rank multiple source series for the same StatisticalVariable, where lower value means higher ranking.

Functions

This section is empty.

Types

type ByRank

type ByRank []*model.SourceSeries

ByRank implements sort.Interface for []*SourceSeries based on the rank score.

func (ByRank) Len

func (a ByRank) Len() int

func (ByRank) Less

func (a ByRank) Less(i, j int) bool

func (ByRank) Swap

func (a ByRank) Swap(i, j int)

type CohortByRank

type CohortByRank []*pb.SourceSeries

CohortByRank implements sort.Interface for []*SourceSeries based on the rank score. Each source series data is keyed by the place dcid.

Note this has the same data type as SeriesByRank but is used to compare cohort instead of time series.

func (CohortByRank) Len

func (a CohortByRank) Len() int

func (CohortByRank) Less

func (a CohortByRank) Less(i, j int) bool

func (CohortByRank) Swap

func (a CohortByRank) Swap(i, j int)

type RankKey

type RankKey struct {
	ImportName        string
	MeasurementMethod string
	ObservationPeriod string
}

RankKey represents keys used for ranking. Import Name should be non-empty. Can use "*" for wildcard match for MeasurementMethod and ObservationPeriod

type SeriesByRank

type SeriesByRank []*pb.SourceSeries

SeriesByRank implements sort.Interface for []*SourceSeries based on the rank score. Each source series data is keyed by the observation date.

This is the protobuf version of byRank.

func (SeriesByRank) Len

func (a SeriesByRank) Len() int

func (SeriesByRank) Less

func (a SeriesByRank) Less(i, j int) bool

func (SeriesByRank) Swap

func (a SeriesByRank) Swap(i, j int)

Jump to

Keyboard shortcuts

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