postgres

package
v0.0.0-...-0d40728 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2021 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// CorrectCategory identifies the correct result meta-category.
	CorrectCategory = "correct"

	// IncorrectCategory identifies the incorrect result meta-category.
	IncorrectCategory = "incorrect"
)
View Source
const (
	// ProvenanceStorage label for storage valid types
	ProvenanceStorage = "storage-valid"
)

Variables

This section is empty.

Functions

func GetTimeseriesOperations

func GetTimeseriesOperations(operation api.TimeseriesOp) func(float64, float64, int64) float64

GetTimeseriesOperations returns the supported operations to deal with duplicates in the timeseries

func NewDataStorage

func NewDataStorage(clientCtor postgres.ClientCtor, batchClientCtor postgres.ClientCtor, metadataCtor api.MetadataStorageCtor) api.DataStorageCtor

NewDataStorage returns a constructor for a data storage.

func NewSolutionStorage

func NewSolutionStorage(clientCtor postgres.ClientCtor, metadataCtor api.MetadataStorageCtor) api.SolutionStorageCtor

NewSolutionStorage returns a constructor for a solution storage.

func SetRandomSeed

func SetRandomSeed(seed float64)

SetRandomSeed sets the random seed to use when reading a subset of data from the database.

Types

type BasicField

type BasicField struct {
	Storage            *Storage
	DatasetStorageName string
	DatasetName        string
	Key                string
	Label              string
	Type               string
	Count              string
}

BasicField provides access to baseline field data

func (*BasicField) GetDatasetName

func (b *BasicField) GetDatasetName() string

GetDatasetName returns the name of the dataset

func (*BasicField) GetDatasetStorageName

func (b *BasicField) GetDatasetStorageName() string

GetDatasetStorageName returns the name used for the dataset table (PG imposes a number of limits on table names)

func (*BasicField) GetKey

func (b *BasicField) GetKey() string

GetKey returns the unique field key (name)

func (*BasicField) GetLabel

func (b *BasicField) GetLabel() string

GetLabel returns the field's label. May not be unique, shouldn't be used to identify the field (use Key)

func (*BasicField) GetStorage

func (b *BasicField) GetStorage() *Storage

GetStorage returns the storage associated with the field

func (*BasicField) GetType

func (b *BasicField) GetType() string

GetType returns the internal Distil type of the field.

type BoundsField

type BoundsField struct {
	BasicField
	CoordinatesCol string
	PolygonCol     string
}

BoundsField defines behaviour for the remote sensing field type.

func NewBoundsField

func NewBoundsField(storage *Storage, datasetName string, datasetStorageName string,
	coordinatesCol string, polygonCol string, key string, label string, typ string, count string) *BoundsField

NewBoundsField creates a new field for remote sensing types.

func (*BoundsField) FetchPredictedSummaryData

func (f *BoundsField) FetchPredictedSummaryData(resultURI string, datasetResult string, filterParams *api.FilterParams, extrema *api.Extrema, mode api.SummaryMode) (*api.VariableSummary, error)

FetchPredictedSummaryData pulls predicted data from the result table and builds the coordinate histogram for the field.

func (*BoundsField) FetchSummaryData

func (f *BoundsField) FetchSummaryData(resultURI string, filterParams *api.FilterParams, extrema *api.Extrema, mode api.SummaryMode) (*api.VariableSummary, error)

FetchSummaryData pulls summary data from the database and builds a histogram.

type CategoricalField

type CategoricalField struct {
	BasicField
	// contains filtered or unexported fields
}

CategoricalField defines behaviour for the categorical field type.

func NewCategoricalField

func NewCategoricalField(storage *Storage, datasetName string, datasetStorageName string, key string, label string, typ string, count string) *CategoricalField

NewCategoricalField creates a new field for categorical types.

func NewCategoricalFieldSubSelect

func NewCategoricalFieldSubSelect(storage *Storage, datasetName string,
	datasetStorageName string, key string, label string, typ string, count string, fieldSubSelect func() string) *CategoricalField

NewCategoricalFieldSubSelect creates a new field for categorical types and specifies a sub select query to pull the raw data.

func (*CategoricalField) FetchPredictedSummaryData

func (f *CategoricalField) FetchPredictedSummaryData(resultURI string, datasetResult string, filterParams *api.FilterParams, extrema *api.Extrema, mode api.SummaryMode) (*api.VariableSummary, error)

FetchPredictedSummaryData pulls predicted data from the result table and builds the categorical histogram for the field.

func (*CategoricalField) FetchSummaryData

func (f *CategoricalField) FetchSummaryData(resultURI string, filterParams *api.FilterParams, extrema *api.Extrema, mode api.SummaryMode) (*api.VariableSummary, error)

FetchSummaryData pulls summary data from the database and builds a histogram.

type CoordinateField

type CoordinateField struct {
	BasicField
	XCol string
	YCol string
}

CoordinateField defines behaviour for the coordinate field type.

func NewCoordinateField

func NewCoordinateField(key string, storage *Storage, datasetName string, datasetStorageName string, xCol string, yCol string, label string, typ string, count string) *CoordinateField

NewCoordinateField creates a new field for coordinate types.

func (*CoordinateField) FetchPredictedSummaryData

func (f *CoordinateField) FetchPredictedSummaryData(resultURI string, datasetResult string, filterParams *api.FilterParams, extrema *api.Extrema, mode api.SummaryMode) (*api.VariableSummary, error)

FetchPredictedSummaryData pulls predicted data from the result table and builds the coordinate histogram for the field.

func (*CoordinateField) FetchSummaryData

func (f *CoordinateField) FetchSummaryData(resultURI string, filterParams *api.FilterParams, extrema *api.Extrema, mode api.SummaryMode) (*api.VariableSummary, error)

FetchSummaryData pulls summary data from the database and builds a histogram.

type DateTimeField

type DateTimeField struct {
	BasicField
	// contains filtered or unexported fields
}

DateTimeField defines behaviour for the numerical field type.

func NewDateTimeField

func NewDateTimeField(storage *Storage, datasetName string, datasetStorageName string, key string, label string, typ string, count string) *DateTimeField

NewDateTimeField creates a new field for numerical types.

func NewDateTimeFieldSubSelect

func NewDateTimeFieldSubSelect(storage *Storage, datasetName string, datasetStorageName string, key string, label string, typ string, count string, fieldSubSelect func() string) *DateTimeField

NewDateTimeFieldSubSelect creates a new field for numerical types and specifies a sub select query to pull the raw data.

func (*DateTimeField) FetchPredictedSummaryData

func (f *DateTimeField) FetchPredictedSummaryData(resultURI string, datasetResult string, filterParams *api.FilterParams, extrema *api.Extrema, mode api.SummaryMode) (*api.VariableSummary, error)

FetchPredictedSummaryData pulls data from the result table and builds the numerical histogram for the field.

func (*DateTimeField) FetchSummaryData

func (f *DateTimeField) FetchSummaryData(resultURI string, filterParams *api.FilterParams, extrema *api.Extrema, mode api.SummaryMode) (*api.VariableSummary, error)

FetchSummaryData pulls summary data from the database and builds a histogram.

type Field

type Field interface {
	FetchSummaryData(resultURI string, filterParams *api.FilterParams, extrema *api.Extrema, mode api.SummaryMode) (*api.VariableSummary, error)
	FetchPredictedSummaryData(resultURI string, datasetResult string, filterParams *api.FilterParams, extrema *api.Extrema, mode api.SummaryMode) (*api.VariableSummary, error)
	GetStorage() *Storage
	GetDatasetStorageName() string
	GetDatasetName() string
	GetKey() string
	GetLabel() string
	GetType() string
	// contains filtered or unexported methods
}

Field defines behaviour for a database field type.

type ImageField

type ImageField struct {
	BasicField
}

ImageField defines behaviour for the image field type.

func NewImageField

func NewImageField(storage *Storage, datasetName string, datasetStorageName string, key string, label string, typ string, count string) *ImageField

NewImageField creates a new field for image types.

func (*ImageField) FetchPredictedSummaryData

func (f *ImageField) FetchPredictedSummaryData(resultURI string, datasetResult string, filterParams *api.FilterParams, extrema *api.Extrema, mode api.SummaryMode) (*api.VariableSummary, error)

FetchPredictedSummaryData pulls predicted data from the result table and builds the image histogram for the field.

func (*ImageField) FetchSummaryData

func (f *ImageField) FetchSummaryData(resultURI string, filterParams *api.FilterParams, extrema *api.Extrema, mode api.SummaryMode) (*api.VariableSummary, error)

FetchSummaryData pulls summary data from the database and builds a histogram.

type MultiBandImageField

type MultiBandImageField struct {
	BasicField
	IDCol      string
	ClusterCol string
}

MultiBandImageField defines behaviour for the image field type.

func NewMultiBandImageField

func NewMultiBandImageField(storage *Storage, datasetName string, datasetStorageName string, clusterCol string, key string, label string, typ string,
	idCol string, bandCol string) *MultiBandImageField

NewMultiBandImageField creates a new field for mutli band image types.

func (*MultiBandImageField) FetchPredictedSummaryData

func (f *MultiBandImageField) FetchPredictedSummaryData(resultURI string, datasetResult string, filterParams *api.FilterParams, extrema *api.Extrema, mode api.SummaryMode) (*api.VariableSummary, error)

FetchPredictedSummaryData pulls predicted data from the result table and builds the image histogram for the field.

func (*MultiBandImageField) FetchSummaryData

func (f *MultiBandImageField) FetchSummaryData(resultURI string, filterParams *api.FilterParams, extrema *api.Extrema, mode api.SummaryMode) (*api.VariableSummary, error)

FetchSummaryData pulls summary data from the database and builds a histogram.

type NumericalField

type NumericalField struct {
	BasicField
	// contains filtered or unexported fields
}

NumericalField defines behaviour for the numerical field type.

func NewNumericalField

func NewNumericalField(storage *Storage, datasetName string, datasetStorageName string, key string, label string, typ string, count string) *NumericalField

NewNumericalField creates a new field for numerical types.

func NewNumericalFieldSubSelect

func NewNumericalFieldSubSelect(storage *Storage, datasetName string, datasetStorageName string, key string, label string, typ string, count string, fieldSubSelect func() string) *NumericalField

NewNumericalFieldSubSelect creates a new field for numerical types and specifies a sub select query to pull the raw data.

func (*NumericalField) FetchNumericalStats

func (f *NumericalField) FetchNumericalStats(filterParams *api.FilterParams) (*NumericalStats, error)

FetchNumericalStats gets the variable's numerical summary info (mean, stddev).

func (*NumericalField) FetchNumericalStatsByResult

func (f *NumericalField) FetchNumericalStatsByResult(resultURI string, filterParams *api.FilterParams) (*NumericalStats, error)

FetchNumericalStatsByResult gets the variable's numerical summary info (mean, stddev) for a result set.

func (*NumericalField) FetchPredictedSummaryData

func (f *NumericalField) FetchPredictedSummaryData(resultURI string, datasetResult string, filterParams *api.FilterParams, extrema *api.Extrema, mode api.SummaryMode) (*api.VariableSummary, error)

FetchPredictedSummaryData pulls data from the result table and builds the numerical histogram for the field.

func (*NumericalField) FetchSummaryData

func (f *NumericalField) FetchSummaryData(resultURI string, filterParams *api.FilterParams, extrema *api.Extrema, mode api.SummaryMode) (*api.VariableSummary, error)

FetchSummaryData pulls summary data from the database and builds a histogram.

type NumericalStats

type NumericalStats struct {
	StdDev          float64
	Mean            float64
	NoDataAvailable bool
}

NumericalStats contains summary information on a numerical fields.

type Storage

type Storage struct {
	// contains filtered or unexported fields
}

Storage accesses the underlying postgres database.

func (*Storage) AddField

func (s *Storage) AddField(dataset string, storageName string, varName string, varType string, defaultVal string) error

AddField adds a new field to the data storage. This only adds a new column. It does not add the column to other tables nor does it rebuild a view.

func (*Storage) AddVariable

func (s *Storage) AddVariable(dataset string, storageName string, key string, varType string, defaultVal string) error

AddVariable adds a new variable to the dataset.

func (*Storage) CloneDataset

func (s *Storage) CloneDataset(dataset string, storageName string, datasetNew string, storageNameNew string) error

CloneDataset clones an existing dataset.

func (*Storage) CreateIndices

func (s *Storage) CreateIndices(dataset string, indexFields []string) error

CreateIndices generates indices for the suppled fields on the "dataset"_base table

func (*Storage) DeleteDataset

func (s *Storage) DeleteDataset(storageName string) error

DeleteDataset drops all tables associated to the dataset

func (*Storage) DeleteVariable

func (s *Storage) DeleteVariable(dataset string, storageName string, varName string) error

DeleteVariable flags a variable as deleted.

func (*Storage) DoesVariableExist

func (s *Storage) DoesVariableExist(dataset string, storageName string, varName string) (bool, error)

DoesVariableExist returns whether or not a variable exists.

func (*Storage) FetchCategoryCounts

func (s *Storage) FetchCategoryCounts(storageName string, variable *model.Variable) (map[string]int, error)

FetchCategoryCounts fetches the count of each label that occurs for the supplied categorical variable.

func (*Storage) FetchConfidenceSummary

func (s *Storage) FetchConfidenceSummary(dataset string, storageName string, resultURI string, filterParams *api.FilterParams, mode api.SummaryMode) (map[string]*api.VariableSummary, error)

FetchConfidenceSummary fetches a histogram of the confidence and explanations associated with a set of classification predictions.

func (*Storage) FetchCorrectnessSummary

func (s *Storage) FetchCorrectnessSummary(dataset string, storageName string, resultURI string, filterParams *api.FilterParams, mode api.SummaryMode) (*api.VariableSummary, error)

FetchCorrectnessSummary fetches a histogram of the residuals associated with a set of numerical predictions.

func (*Storage) FetchData

func (s *Storage) FetchData(dataset string, storageName string, filterParams *api.FilterParams, includeGroupingCol bool, orderByVar *model.Variable) (*api.FilteredData, error)

FetchData creates a postgres query to fetch a set of rows. Applies filters to restrict the results to a user selected set of fields, with rows further filtered based on allowed ranges and categories.

func (*Storage) FetchDataset

func (s *Storage) FetchDataset(dataset string, storageName string,
	includeMetadata bool, limitSelectedFields bool, filterParams *api.FilterParams) ([][]string, error)

FetchDataset extracts the complete raw data from the database.

func (*Storage) FetchExplainValues

func (s *Storage) FetchExplainValues(dataset string, storageName string, d3mIndex []int, resultUUID string) ([]api.SolutionExplainValues, error)

FetchExplainValues : fetches fetches explain values

func (*Storage) FetchExtrema

func (s *Storage) FetchExtrema(dataset string, storageName string, variable *model.Variable) (*api.Extrema, error)

FetchExtrema return extrema of a variable in a result set.

func (*Storage) FetchExtremaByURI

func (s *Storage) FetchExtremaByURI(dataset string, storageName string, resultURI string, varName string) (*api.Extrema, error)

FetchExtremaByURI return extrema of a variable in a result set.

func (*Storage) FetchNumRows

func (s *Storage) FetchNumRows(storageName string, variables []*model.Variable) (int, error)

FetchNumRows pulls the number of rows in the table.

func (*Storage) FetchNumRowsFiltered

func (s *Storage) FetchNumRowsFiltered(storageName string, variables []*model.Variable, filters []string, params []interface{}) (int, error)

FetchNumRowsFiltered pulls the number of filtered rows in the table.

func (*Storage) FetchPredictedSummary

func (s *Storage) FetchPredictedSummary(dataset string, storageName string, resultURI string, filterParams *api.FilterParams, extrema *api.Extrema, mode api.SummaryMode) (*api.VariableSummary, error)

FetchPredictedSummary gets the summary data about a target variable from the results table.

func (*Storage) FetchPrediction

func (s *Storage) FetchPrediction(requestID string) (*api.Prediction, error)

FetchPrediction pulls the specified prediction.

func (*Storage) FetchPredictionResultByProduceRequestID

func (s *Storage) FetchPredictionResultByProduceRequestID(produceRequestID string) (*api.SolutionResult, error)

FetchPredictionResultByProduceRequestID pulls prediction result information from Postgres. This is slightly different than FetchSolutionResultByProduceRequestID in that it joins with data from the `prediction` rather than the `request` table to extract additional information.

func (*Storage) FetchPredictionResultByUUID

func (s *Storage) FetchPredictionResultByUUID(resultUUID string) (*api.SolutionResult, error)

FetchPredictionResultByUUID pulls solution result information from Postgres.

func (*Storage) FetchPredictionsByFittedSolutionID

func (s *Storage) FetchPredictionsByFittedSolutionID(fittedSolutionID string) ([]*api.Prediction, error)

FetchPredictionsByFittedSolutionID fetches all prediction requests using a given fitted solution id.

func (*Storage) FetchRawDistinctValues

func (s *Storage) FetchRawDistinctValues(dataset string, storageName string, varNames []string) ([][]string, error)

FetchRawDistinctValues fetches the distinct values for a variable from the base table.

func (*Storage) FetchRequest

func (s *Storage) FetchRequest(requestID string) (*api.Request, error)

FetchRequest pulls request information from Postgres.

func (*Storage) FetchRequestByDatasetTarget

func (s *Storage) FetchRequestByDatasetTarget(dataset string, target string) ([]*api.Request, error)

FetchRequestByDatasetTarget pulls requests associated with a given dataset and target from postgres.

func (*Storage) FetchRequestByFittedSolutionID

func (s *Storage) FetchRequestByFittedSolutionID(fittedSolutionID string) (*api.Request, error)

FetchRequestByFittedSolutionID pulls request information from Postgres using a fitted solution ID.

func (*Storage) FetchRequestByResultUUID

func (s *Storage) FetchRequestByResultUUID(resultUUID string) (*api.Request, error)

FetchRequestByResultUUID pulls request information from Postgres using a result UUID.

func (*Storage) FetchRequestBySolutionID

func (s *Storage) FetchRequestBySolutionID(solutionID string) (*api.Request, error)

FetchRequestBySolutionID pulls request information from Postgres using a solution ID.

func (*Storage) FetchRequestFeatures

func (s *Storage) FetchRequestFeatures(requestID string) ([]*api.Feature, error)

FetchRequestFeatures pulls request feature information from Postgres.

func (*Storage) FetchRequestFilters

func (s *Storage) FetchRequestFilters(requestID string, features []*api.Feature) (*api.FilterParams, error)

FetchRequestFilters pulls request filter information from Postgres.

func (*Storage) FetchResidualsExtremaByURI

func (s *Storage) FetchResidualsExtremaByURI(dataset string, storageName string, resultURI string) (*api.Extrema, error)

FetchResidualsExtremaByURI fetches the residual extrema by resultURI.

func (*Storage) FetchResidualsSummary

func (s *Storage) FetchResidualsSummary(dataset string, storageName string, resultURI string, filterParams *api.FilterParams, extrema *api.Extrema, mode api.SummaryMode) (*api.VariableSummary, error)

FetchResidualsSummary fetches a histogram of the residuals associated with a set of numerical predictions.

func (*Storage) FetchResultDataset

func (s *Storage) FetchResultDataset(dataset string, storageName string, predictionName string,
	features []string, resultURI string, includeExplain bool) ([][]string, error)

FetchResultDataset extracts the complete results and base table data.

func (*Storage) FetchResults

func (s *Storage) FetchResults(dataset string, storageName string, resultURI string, id string, filterParams *api.FilterParams, predictionResultMode bool) (*api.FilteredData, error)

FetchResults pulls the results from the Postgres database. Note the generalized `id` string parameter - this will be a solution ID if this is a solution result, or a produce request ID is this is a predictions result.

func (*Storage) FetchResultsExtremaByURI

func (s *Storage) FetchResultsExtremaByURI(dataset string, storageName string, resultURI string) (*api.Extrema, error)

FetchResultsExtremaByURI fetches the results extrema by resultURI.

func (*Storage) FetchSolution

func (s *Storage) FetchSolution(solutionID string) (*api.Solution, error)

FetchSolution pulls solution information from Postgres.

func (*Storage) FetchSolutionFeatureWeights

func (s *Storage) FetchSolutionFeatureWeights(dataset string, storageName string, resultURI string, d3mIndex int64) (*api.SolutionFeatureWeight, error)

FetchSolutionFeatureWeights fetches solution feature weights from Postgres.

func (*Storage) FetchSolutionResultByProduceRequestID

func (s *Storage) FetchSolutionResultByProduceRequestID(produceRequestID string) (*api.SolutionResult, error)

FetchSolutionResultByProduceRequestID pulls solution result information from Postgres.

func (*Storage) FetchSolutionResultByUUID

func (s *Storage) FetchSolutionResultByUUID(resultUUID string) (*api.SolutionResult, error)

FetchSolutionResultByUUID pulls solution result information from Postgres.

func (*Storage) FetchSolutionResults

func (s *Storage) FetchSolutionResults(solutionID string) ([]*api.SolutionResult, error)

FetchSolutionResults pulls solution result information from Postgres.

func (*Storage) FetchSolutionResultsByFittedSolutionID

func (s *Storage) FetchSolutionResultsByFittedSolutionID(fittedSolutionID string) ([]*api.SolutionResult, error)

FetchSolutionResultsByFittedSolutionID pulls solution result information from Postgres.

func (*Storage) FetchSolutionScores

func (s *Storage) FetchSolutionScores(solutionID string) ([]*api.SolutionScore, error)

FetchSolutionScores pulls solution score from Postgres.

func (*Storage) FetchSolutionState

func (s *Storage) FetchSolutionState(solutionID string) (*api.SolutionState, error)

FetchSolutionState pulls solution state information from Postgres.

func (*Storage) FetchSolutionWeights

func (s *Storage) FetchSolutionWeights(solutionID string) ([]*api.SolutionWeight, error)

FetchSolutionWeights fetches solution feature weights from Postgres.

func (*Storage) FetchSolutionsByDatasetTarget

func (s *Storage) FetchSolutionsByDatasetTarget(dataset string, target string) ([]*api.Solution, error)

FetchSolutionsByDatasetTarget fetches all solutions that apply to a particular dataset and target.

func (*Storage) FetchSolutionsByRequestID

func (s *Storage) FetchSolutionsByRequestID(requestID string) ([]*api.Solution, error)

FetchSolutionsByRequestID fetches solutions associated with a given request.

func (*Storage) FetchSummary

func (s *Storage) FetchSummary(dataset string, storageName string, varName string, filterParams *api.FilterParams, mode api.SummaryMode) (*api.VariableSummary, error)

FetchSummary returns the summary for the provided dataset and variable.

func (*Storage) FetchSummaryByResult

func (s *Storage) FetchSummaryByResult(dataset string, storageName string, varName string, resultURI string, filterParams *api.FilterParams, extrema *api.Extrema, mode api.SummaryMode) (*api.VariableSummary, error)

FetchSummaryByResult returns the summary for the provided dataset and variable for data that is part of the result set.

func (*Storage) FetchTimeseries

func (s *Storage) FetchTimeseries(dataset string, storageName string, variableKey string, seriesIDColName string, xColName string, yColName string, timeseriesURI []string,
	duplicateOperation api.TimeseriesOp, filterParams *api.FilterParams) ([]*api.TimeseriesData, error)

FetchTimeseries fetches a timeseries.

func (*Storage) FetchTimeseriesForecast

func (s *Storage) FetchTimeseriesForecast(dataset string, storageName string, varKey string, seriesIDColName string, xColName string, yColName string,
	seriesIDs []string, duplicateOperation api.TimeseriesOp, resultURI string, filterParams *api.FilterParams) ([]*api.TimeseriesData, error)

FetchTimeseriesForecast fetches a timeseries.

func (*Storage) GetStorageName

func (s *Storage) GetStorageName(dataset string) (string, error)

GetStorageName returns a valid unique name to use for a given dataset name.

func (*Storage) InsertBatch

func (s *Storage) InsertBatch(storageName string, varNames []string, inserts [][]interface{}) error

InsertBatch batches the data to insert for increased performance.

func (*Storage) IsKey

func (s *Storage) IsKey(dataset string, storageName string, variables []*model.Variable) (bool, error)

IsKey verifies if a given set of variables is unique across the dataset.

func (*Storage) IsValidDataType

func (s *Storage) IsValidDataType(dataset string, storageName string, varName string, varType string) (bool, error)

IsValidDataType checks to see if a specified type is valid for a variable. Multiple simultaneous calls to the function can result in inaccurate.

func (*Storage) PersistExplainedResult

func (s *Storage) PersistExplainedResult(dataset string, storageName string, resultURI string, explainResult *api.SolutionExplainResult) error

PersistExplainedResult stores the additional explained output.

func (*Storage) PersistPrediction

func (s *Storage) PersistPrediction(requestID string, dataset string, target string, fittedSolutionID string, progress string, createdTime time.Time) error

PersistPrediction persists a prediction request to Postgres.

func (*Storage) PersistRequest

func (s *Storage) PersistRequest(requestID string, dataset string, progress string, createdTime time.Time) error

PersistRequest persists a request to Postgres.

func (*Storage) PersistRequestFeature

func (s *Storage) PersistRequestFeature(requestID string, featureName string, featureType string) error

PersistRequestFeature persists request feature information to Postgres.

func (*Storage) PersistRequestFilters

func (s *Storage) PersistRequestFilters(requestID string, filters *api.FilterParams) error

PersistRequestFilters persists request filters information to Postgres.

func (*Storage) PersistResult

func (s *Storage) PersistResult(dataset string, storageName string, resultURI string, target string) error

PersistResult stores the solution result to Postgres.

func (*Storage) PersistSolution

func (s *Storage) PersistSolution(requestID string, solutionID string, explainedSolutionID string, createdTime time.Time) error

PersistSolution persists the solution to Postgres.

func (*Storage) PersistSolutionExplainedOutput

func (s *Storage) PersistSolutionExplainedOutput(resultUUID string, explainOutput map[string]*api.SolutionExplainResult) error

PersistSolutionExplainedOutput persists the explained result data to postgres.

func (*Storage) PersistSolutionFeatureWeight

func (s *Storage) PersistSolutionFeatureWeight(dataset string, storageName string, resultURI string, weights [][]string) error

PersistSolutionFeatureWeight persists the solution feature weight to Postgres.

func (*Storage) PersistSolutionResult

func (s *Storage) PersistSolutionResult(solutionID string, fittedSolutionID string, produceRequestID string, resultType string,
	resultUUID string, resultURI string, progress string, createdTime time.Time) error

PersistSolutionResult persists the solution result metadata to Postgres.

func (*Storage) PersistSolutionScore

func (s *Storage) PersistSolutionScore(solutionID string, metric string, score float64) error

PersistSolutionScore persist the solution score to Postgres.

func (*Storage) PersistSolutionState

func (s *Storage) PersistSolutionState(solutionID string, progress string, createdTime time.Time) error

PersistSolutionState persists the solution state to Postgres.

func (*Storage) PersistSolutionWeight

func (s *Storage) PersistSolutionWeight(solutionID string, featureName string, featureIndex int64, weight float64) error

PersistSolutionWeight persists the solution feature weight to Postgres.

func (*Storage) SaveDataset

func (s *Storage) SaveDataset(dataset string, storageName string, filterParams *api.FilterParams) error

SaveDataset is used for dropping the unused values based on filter param. (Only used in save_dataset route)

func (*Storage) SetDataType

func (s *Storage) SetDataType(dataset string, storageName string, varName string, varType string) error

SetDataType updates the data type of the specified variable. Multiple simultaneous calls to the function can result in discarded changes.

func (*Storage) SetVariableValue

func (s *Storage) SetVariableValue(dataset string, storageName string, varName string, value string, filterParams *api.FilterParams) error

SetVariableValue updates an entire column to specified value

func (*Storage) UpdateData

func (s *Storage) UpdateData(dataset string, storageName string, varName string, updates map[string]string, filterParams *api.FilterParams) error

UpdateData updates data stored using the d3m index as key, but also allows for filtering in cases where the d3m index is not unique.

func (*Storage) UpdateRequest

func (s *Storage) UpdateRequest(requestID string, progress string, updatedTime time.Time) error

UpdateRequest updates a request in Postgres.

func (*Storage) UpdateSolution

func (s *Storage) UpdateSolution(solutionID string, explainedSolutionID string) error

UpdateSolution updates the solution in Postgres.

func (*Storage) UpdateVariableBatch

func (s *Storage) UpdateVariableBatch(storageName string, varName string, updates map[string]string) error

UpdateVariableBatch batches updates for a variable to increase performance.

func (*Storage) VerifyData

func (s *Storage) VerifyData(datasetID string, tableName string) error

VerifyData checks each column in the table against every supported type, then updates what types are valid in the SuggestedType

type TextField

type TextField struct {
	BasicField
}

TextField defines behaviour for the text field type.

func NewTextField

func NewTextField(storage *Storage, datasetName string, datasetStorageName string, key string, label string, typ string, count string) *TextField

NewTextField creates a new field for text types.

func (*TextField) FetchPredictedSummaryData

func (f *TextField) FetchPredictedSummaryData(resultURI string, datasetResult string, filterParams *api.FilterParams, extrema *api.Extrema, mode api.SummaryMode) (*api.VariableSummary, error)

FetchPredictedSummaryData pulls data from the result table and builds the categorical histogram for the field.

func (*TextField) FetchSummaryData

func (f *TextField) FetchSummaryData(resultURI string, filterParams *api.FilterParams, extrema *api.Extrema, mode api.SummaryMode) (*api.VariableSummary, error)

FetchSummaryData pulls summary data from the database and builds a histogram.

type TimeSeriesField

type TimeSeriesField struct {
	BasicField
	IDCol      string
	ClusterCol string
	XCol       string
	XColType   string
	YCol       string
	YColType   string
}

TimeSeriesField defines behaviour for the timeseries field type.

func NewTimeSeriesField

func NewTimeSeriesField(storage *Storage, datasetName string, datasetStorageName string, clusterCol string, key string, label string, typ string,
	idCol string, xCol string, xColType string, yCol string, yColType string) *TimeSeriesField

NewTimeSeriesField creates a new field for timeseries types.

func (*TimeSeriesField) FetchPredictedSummaryData

func (f *TimeSeriesField) FetchPredictedSummaryData(resultURI string, datasetResult string, filterParams *api.FilterParams, extrema *api.Extrema, mode api.SummaryMode) (*api.VariableSummary, error)

FetchPredictedSummaryData pulls predicted data from the result table and builds the timeseries histogram for the field.

func (*TimeSeriesField) FetchSummaryData

func (f *TimeSeriesField) FetchSummaryData(resultURI string, filterParams *api.FilterParams, extrema *api.Extrema, mode api.SummaryMode) (*api.VariableSummary, error)

FetchSummaryData pulls summary data from the database and builds a histogram.

type TimelineField

type TimelineField interface {
	Field
	// contains filtered or unexported methods
}

TimelineField defines the behaviour of a field which can be used as a timeline.

type VectorField

type VectorField struct {
	BasicField
	Unnested string
}

VectorField defines behaviour for any Vector type.

func NewVectorField

func NewVectorField(storage *Storage, datasetName string, datasetStorageName string, key string, label string, typ string) *VectorField

NewVectorField creates a new field of the vector type. A vector field uses unnest to flatten the database array and then uses the underlying data type to get summaries.

func (*VectorField) FetchNumericalStats

func (f *VectorField) FetchNumericalStats(filterParams *api.FilterParams, invert bool) (*NumericalStats, error)

FetchNumericalStats gets the variable's numerical summary info (mean, stddev).

func (*VectorField) FetchNumericalStatsByResult

func (f *VectorField) FetchNumericalStatsByResult(resultURI string, filterParams *api.FilterParams) (*NumericalStats, error)

FetchNumericalStatsByResult gets the variable's numerical summary info (mean, stddev) for a result set.

func (*VectorField) FetchPredictedSummaryData

func (f *VectorField) FetchPredictedSummaryData(resultURI string, datasetResult string, filterParams *api.FilterParams, extrema *api.Extrema, mode api.SummaryMode) (*api.VariableSummary, error)

FetchPredictedSummaryData pulls predicted data from the result table and builds the categorical histogram for the field.

func (*VectorField) FetchSummaryData

func (f *VectorField) FetchSummaryData(resultURI string, filterParams *api.FilterParams, extrema *api.Extrema, mode api.SummaryMode) (*api.VariableSummary, error)

FetchSummaryData pulls summary data from the database and builds a histogram.

Jump to

Keyboard shortcuts

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