Documentation
¶
Index ¶
Constants ¶
const ( SteerCode = "S" HeiferCode = "F" CowCode = "C" )
SexMap maps symbols to animal types
Variables ¶
var ( DefaultMasterPath = "./defaultMaster.hjson" DefaultWeaningPath = "./defaultEcoWeaning.hjson" DefaultBackgroundPath = "./defaultEcoBackground.hjson" DefaultFatPath = "./defaultEcoFatcattle.hjson" DefaultSlaughterPath = "./defaultEcoSlaughtercattle.hjson" DefaultWeaningTerminalPath = "./defaultEcoWeaningTerm.hjson" DefaultBackgroundTerminalPath = "./defaultEcoBackgroundTerm.hjson" DefaultFatTerminalPath = "./defaultEcoFatcattleTerm.hjson" DefaultSlaughterTerminalPath = "./defaultEcoSlaughtercattleTerm.hjson" )
Default filepaths the the files to treat as default
var ( Weaning = Endpoint{Internal: "weaning", Display: "weaning"} Background = Endpoint{Internal: "background", Display: "background"} Fat = Endpoint{Internal: "fatcattle", Display: "fed cattle (live)"} Slaughter = Endpoint{Internal: "slaughtercattle", Display: "fed cattle (carcass)"} EndpointMap = map[string]Endpoint{Weaning.Internal: Weaning, Background.Internal: Background, Fat.Internal: Fat, Slaughter.Internal: Slaughter} EndpointSlice = []Endpoint{Weaning, Background, Fat, Slaughter} )
Possible endpoints
var ( OwnReplacements = IndexType("Creates own replacements") Terminal = IndexType("Terminal") IndexTypes = []IndexType{OwnReplacements, Terminal} )
Possible IndexTypes
var SexMap = map[string]string{ SteerCode: "Steer", HeiferCode: "Heifer", CowCode: "Cow", }
var TraitMap = []Component{ {"USREA,D", "USREA,D", "Ultrasounded rib-eye area", false}, {"USIMF,D", "USIMF,D", "Ultrasounded intramuscular fat", false}, {"USFAT,D", "USFAT,D", "Ultrasounded backfat thickness", false}, {"HCW,D", "HCW,D", "Hot carcass weight", false}, {"REA,D", "REA,D", "Carcass rib-eye area", false}, {"FAT,D", "FAT,D", "Carcass backfat thickness", false}, {"MS,D", "MS,D", "Carcass marbling score", false}, {"BW,D", "BW,D", "Birth weight", false}, {"WW,D", "WW,D", "Weaning weight - Direct", false}, {"WW,M", "WW,M", "Weaning weight - Maternal", false}, {"YW,D", "YW,D", "Yearling weight", false}, {"FI,D", "FI,D", "Daily dry matter intake", false}, {"MW,D", "MW,D", "Mature cow weight", false}, {"STAY,D", "STAY,D", "Probability of a cow staying in the herd to age six given that she calved as a 2-year-old", false}, {"HP,D", "HP,D", "Probability of conceiving as a 2-year-old heifer", false}, {"CE,D", "CD,D", "Calving ease - Direct", false}, {"CE,M", "CD,M", "Calving ease - Maternal", false}, }
TraitMap maps trait symbols to descriptions
Functions ¶
Types ¶
type BreedComposition ¶
BreedComposition holds a breed composition for the breeds page
type Component ¶
Component contains a code, description, and boolean value for whether or not this field is selected Used for the index components
type EcoParams ¶
type EcoParams struct { SaleEndpoint string `json:"saleEndpoint"` IndexTerminal bool `json:"indexTerminal"` IndexComponents []string `json:"indexComponents"` TraitSexPricePerCwt []string `json:"traitSexPricePerCwt"` DiscountRate string `json:"discountRate"` AumCost [12]float64 `json:"aumCost"` BackgroundAumCost [12]float64 `json:"backgroundAumCost"` BackgroundDays int `json:"backgroundDays"` DaysOnFeed float64 `json:"daysOnFeed"` FeedlotFeedCost string `json:"feedlotFeedCost"` GridPremiums []string `json:"gridPremiums"` ProportionInProgram string `json:"proportionInProgram"` }
EcoParams should mock the economical optional input file for iGenDec
func DefaultEcoParams ¶
DefaultEcoParams returns the default eco params as seen in ecoIndex.hjson Every user will be initilised with this struct
func EcoParamsFromFile ¶
EcoParamsFromFile reads in an eco parameter file
type HerdComposition ¶
type HerdComposition struct {
Count, BreedComp interface{}
}
HerdComposition holds a breed compostion
type HerdCompositionType ¶
type HerdCompositionType struct { ID string Values []HerdComposition }
HerdCompositionType holds a slice of BreedCompositions and an identifier for templating reasons
type MasterParams ¶
type MasterParams struct { Comment string `json:"comment"` TargetDatabase string `json:"target-database,omitempty"` Burnin int `json:"burnin"` PlanningHorizon int `json:"planningHorizon"` Traits []string `json:"Traits"` Components []string `json:"Components"` Genetic [324]float64 `json:"genetic"` Residual [225]float64 `json:"residual"` BreedEffects []string `json:"BreedEffects"` HeterosisCodes []string `json:"HeterosisCodes"` HeterosisValues []string `json:"HeterosisValues"` BreedTraitSexAod []string `json:"BreedTraitSexAod"` TraitAgeEffects []string `json:"TraitAgeEffects"` AgeDist []string `json:"ageDist"` NFoundationBulls int `json:"nFoundationBulls"` MeritFoundationBulls []float64 `json:"meritFoundationBulls"` Herds []string `json:"herds"` CalfAum float64 `json:"calfAum"` CowAum float64 `json:"cowAum"` CowHerdBreedComposition []interface{} `json:"CowHerdBreedComposition"` BullBatteryBreedComposition []interface{} `json:"BullBatteryBreedComposition"` CurrentCalvesBreedComposition []interface{} `json:"CurrentCalvesBreedComposition"` BreedCompositions []BreedComposition `json:"BreedCompositions"` // Custom field - will be ignored by iGenDec }
MasterParams should mock main file for iGenDec
func DefaultMasterParams ¶
func DefaultMasterParams() (*MasterParams, error)
DefaultMasterParams returns the default master parameter file for users
func MasterParamsFromFile ¶
func MasterParamsFromFile(filename string) (*MasterParams, error)
MasterParamsFromFile parses a master parameter file and validifies the fields
func (*MasterParams) Bytes ¶
func (params *MasterParams) Bytes() ([]byte, error)
Bytes returns the marshalled index params If need to change the way we process the params, can easily do here
func (*MasterParams) ToMap ¶
func (params *MasterParams) ToMap(m map[string]interface{}) map[string]interface{}
ToMap returns the values we need from the struct in a fiber compatible map Has to set up some fields to work with the front end