routes

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: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//DefaultOpacity used for the image attention filters
	DefaultOpacity = 100
)
View Source
const (
	// ThumbnailDimensions is hard coded thumbnail dimension -- could be refactored to be default if we want client to dictate size.
	ThumbnailDimensions = 125
)

Variables

This section is empty.

Functions

func AbortHandler

func AbortHandler() func(http.ResponseWriter, *http.Request)

AbortHandler terminates the server. Yes, this is intentional. Its part of the eval protocol. Don't look at me like that.

func AddFieldHandler

func AddFieldHandler(metaCtor api.MetadataStorageCtor, dataCtor api.DataStorageCtor) func(http.ResponseWriter, *http.Request)

AddFieldHandler generates a route handler that adds columns to datasets expects at least two parameters "name" of the field and "fieldType" type of the field. Optional parameter is "defaultValue"

func AvailableDatasetsHandler

func AvailableDatasetsHandler(metaCtor model.MetadataStorageCtor) func(http.ResponseWriter, *http.Request)

AvailableDatasetsHandler generates a route handle that will return the list of files & folders that can be imported.

func ClearHandler

func ClearHandler(metaCtor api.MetadataStorageCtor, dataCtor api.DataStorageCtor) func(http.ResponseWriter, *http.Request)

ClearHandler generates a route handler that enables the clearing of variable, optionally being able to specify filter params.

func CloningHandler

func CloningHandler(metaCtor api.MetadataStorageCtor, dataCtor api.DataStorageCtor, config env.Config) func(http.ResponseWriter, *http.Request)

CloningHandler generates a route handler that enables cloning of a dataset in the data storage and metadata storage.

func CloningResultsHandler

func CloningResultsHandler(metaCtor api.MetadataStorageCtor, dataCtor api.DataStorageCtor, solutionCtor api.SolutionStorageCtor, config env.Config) func(http.ResponseWriter, *http.Request)

CloningResultsHandler generates a route handler that enables cloning of a result + dataset in the data storage and metadata storage, creating a new dataset based on results.

func ClusteringExplainHandler

func ClusteringExplainHandler(solutionCtor api.SolutionStorageCtor, metaCtor api.MetadataStorageCtor,
	dataCtor api.DataStorageCtor, config env.Config) func(http.ResponseWriter, *http.Request)

ClusteringExplainHandler creates a route handler that will cluster an explained result output, treating it as a tabular dataset.

func ClusteringHandler

func ClusteringHandler(metaCtor api.MetadataStorageCtor, dataCtor api.DataStorageCtor, config env.Config) func(http.ResponseWriter, *http.Request)

ClusteringHandler generates a route handler that enables clustering of a variable and the creation of the new column to hold the cluster label.

func ConfidenceSummaryHandler

func ConfidenceSummaryHandler(metaCtor api.MetadataStorageCtor, solutionCtor api.SolutionStorageCtor, dataCtor api.DataStorageCtor) func(http.ResponseWriter, *http.Request)

ConfidenceSummaryHandler bins predicted result confidence data for consumption in a downstream summary view.

func ConfigHandler

func ConfigHandler(config env.Config, version string, timestamp string, ta2Version string) func(http.ResponseWriter, *http.Request)

ConfigHandler returns the compiled version number, timestamp and initial config.

func CorrectnessSummaryHandler

func CorrectnessSummaryHandler(metaCtor api.MetadataStorageCtor, solutionCtor api.SolutionStorageCtor, dataCtor api.DataStorageCtor) func(http.ResponseWriter, *http.Request)

CorrectnessSummaryHandler bins predicted result data for consumption in a downstream summary view.

func DataHandler

func DataHandler(storageCtor api.DataStorageCtor, metaCtor api.MetadataStorageCtor, solutionCtor api.SolutionStorageCtor) func(http.ResponseWriter, *http.Request)

DataHandler creates a route that fetches filtered data from backing storage instance.

func DatasetHandler

func DatasetHandler(ctor model.MetadataStorageCtor) func(http.ResponseWriter, *http.Request)

DatasetHandler generates a route handler that returns a specified dataset summary.

func DatasetsHandler

func DatasetsHandler(metaCtors map[string]model.MetadataStorageCtor) func(http.ResponseWriter, *http.Request)

DatasetsHandler generates a route handler that facilitates a search of dataset descriptions and variable names, returning a name, description and variable list for any dataset that matches. The search parameter is optional it contains the search terms if set, and if unset, flags that a list of all datasets should be returned. The full list will be contain names only, descriptions and variable lists will not be included.

func DeleteHandler

func DeleteHandler(dataCtor api.DataStorageCtor, esMetaCtor api.MetadataStorageCtor) func(http.ResponseWriter, *http.Request)

DeleteHandler deletes a field from the data storage and the metadata storage.

func DeletingDatasetHandler

func DeletingDatasetHandler(metaCtor api.MetadataStorageCtor, dataCtor api.DataStorageCtor) func(http.ResponseWriter, *http.Request)

DeletingDatasetHandler attempts to delete mutable datasets

func DeletingModelHandler

func DeletingModelHandler(modelCtor api.ExportedModelStorageCtor) func(http.ResponseWriter, *http.Request)

DeletingModelHandler attempts to delete an exported model.

func ExportHandler

func ExportHandler(client *compute.Client, exportPath string, logger *env.DiscoveryLogger) func(http.ResponseWriter, *http.Request)

ExportHandler exports the caller supplied solution by calling through to the compute server export functionality.

func ExportResultHandler

func ExportResultHandler(solutionCtor api.SolutionStorageCtor, dataCtor api.DataStorageCtor, metaCtor api.MetadataStorageCtor) func(http.ResponseWriter, *http.Request)

ExportResultHandler will return a CSV file containing the results of a prediction. Data is transformed into a string using a naive print statement.

func ExtractHandler

func ExtractHandler(metaCtor api.MetadataStorageCtor, dataCtor api.DataStorageCtor, config env.Config) func(http.ResponseWriter, *http.Request)

ExtractHandler extracts a dataset from storage and writes it to disk.

func FileHandler

func FileHandler(rootDir string) func(http.ResponseWriter, *http.Request)

FileHandler provides a static file lookup route using the OS file system

func GeocodingHandler

func GeocodingHandler(metaCtor api.MetadataStorageCtor, dataCtor api.DataStorageCtor) func(http.ResponseWriter, *http.Request)

GeocodingHandler generates a route handler that enables geocoding of a variable and the creation of two new columns to hold the lat and lon.

func GroupingHandler

func GroupingHandler(dataCtor api.DataStorageCtor, metaCtor api.MetadataStorageCtor) func(http.ResponseWriter, *http.Request)

GroupingHandler generates a route handler that adds a grouping.

func ImageAttentionHandler

func ImageAttentionHandler(solutionCtor api.SolutionStorageCtor, metaCtor api.MetadataStorageCtor) func(http.ResponseWriter, *http.Request)

ImageAttentionHandler provides an image filter for the supplied index

func ImageHandler

func ImageHandler(ctor api.MetadataStorageCtor, config *env.Config) func(http.ResponseWriter, *http.Request)

ImageHandler provides a static file lookup route using simple directory mapping.

func ImportHandler

func ImportHandler(dataCtor api.DataStorageCtor, datamartCtors map[string]api.MetadataStorageCtor,
	fileMetaCtor api.MetadataStorageCtor, esMetaCtor api.MetadataStorageCtor,
	config *env.Config) func(http.ResponseWriter, *http.Request)

ImportHandler imports a dataset to the local file system and then ingests it.

func IndexDataHandler

func IndexDataHandler(ctor api.MetadataStorageCtor) func(http.ResponseWriter, *http.Request)

IndexDataHandler fetches a list of index data using the supplied parameters to determine the type of index data to return.

func JoinHandler

func JoinHandler(dataCtor api.DataStorageCtor, metaCtor api.MetadataStorageCtor) func(http.ResponseWriter, *http.Request)

JoinHandler generates a route handler that joins two datasets using caller supplied columns. The joined data is returned to the caller, but is NOT added to storage.

func JoinSuggestionHandler

func JoinSuggestionHandler(esCtor model.MetadataStorageCtor, metaCtors map[string]model.MetadataStorageCtor) func(http.ResponseWriter, *http.Request)

JoinSuggestionHandler generates a route handler that facilitates a search of dataset join suggestions. The search parameter is optional it contains the search terms if set, and if unset, flags that a list of all datasets should be returned. The full list will be contain names only, descriptions and variable lists will not be included.

func ModelHandler

func ModelHandler(ctor model.ExportedModelStorageCtor) func(http.ResponseWriter, *http.Request)

ModelHandler generates a route handler that returns a specified model summary.

func ModelsHandler

func ModelsHandler(modelCtor model.ExportedModelStorageCtor) func(http.ResponseWriter, *http.Request)

ModelsHandler generates a route handler that facilitates a search of model & dataset descriptions, and variable names, returning a name, description and variable list for any model that matches. The search parameter is optional it contains the search terms if set, and if unset, flags that a list of all models should be returned.

func MultiBandImageHandler

func MultiBandImageHandler(ctor api.MetadataStorageCtor, dataCtor api.DataStorageCtor, config env.Config) func(http.ResponseWriter, *http.Request)

MultiBandImageHandler fetches individual band images and combines them into a single RGB image using the supplied mapping.

func MultiBandImagePackHandler

func MultiBandImagePackHandler(ctor api.MetadataStorageCtor, dataCtor api.DataStorageCtor, config env.Config) func(http.ResponseWriter, *http.Request)

MultiBandImagePackHandler fetches individual band images and combines them into a single RGB image using the supplied mapping.

func OutlierDetectionHandler

func OutlierDetectionHandler(metaCtor api.MetadataStorageCtor) func(http.ResponseWriter, *http.Request)

OutlierDetectionHandler generates a route handler that enables outlier detection for either remote sensing or tabular data. Return a boolean if the detection was successful.

func OutlierResultsHandler

func OutlierResultsHandler(metaCtor api.MetadataStorageCtor, dataCtor api.DataStorageCtor) func(http.ResponseWriter, *http.Request)

OutlierResultsHandler generates a route handler that enables outlier detection for either remote sensing or tabular data. Return a boolean and add the data to the dataset.

func PredictionHandler

func PredictionHandler(solutionCtor api.SolutionStorageCtor) func(http.ResponseWriter, *http.Request)

PredictionHandler fetches a prediction by its ID.

func PredictionResultSummaryHandler

func PredictionResultSummaryHandler(metaCtor api.MetadataStorageCtor, solutionCtor api.SolutionStorageCtor, dataCtor api.DataStorageCtor) func(http.ResponseWriter, *http.Request)

PredictionResultSummaryHandler bins predicted result data for consumption in a downstream summary view.

func PredictionResultsHandler

func PredictionResultsHandler(solutionCtor api.SolutionStorageCtor, dataCtor api.DataStorageCtor, metaCtor api.MetadataStorageCtor) func(http.ResponseWriter, *http.Request)

PredictionResultsHandler fetches a solution's test prediction, or the output of a prediction run against a fitted model.

func PredictionsHandler

func PredictionsHandler(solutionCtor api.SolutionStorageCtor) func(http.ResponseWriter, *http.Request)

PredictionsHandler fetches predictions associated with a given dataset and target.

func RemoveGroupingHandler

func RemoveGroupingHandler(dataCtor api.DataStorageCtor, metaCtor api.MetadataStorageCtor) func(http.ResponseWriter, *http.Request)

RemoveGroupingHandler generates a route handler that removes a grouping.

func ResidualsExtremaHandler

func ResidualsExtremaHandler(metaCtor api.MetadataStorageCtor, solutionCtor api.SolutionStorageCtor, dataCtor api.DataStorageCtor) func(http.ResponseWriter, *http.Request)

ResidualsExtremaHandler returns the extremas for a residual summary.

func ResidualsSummaryHandler

func ResidualsSummaryHandler(metaCtor api.MetadataStorageCtor, solutionCtor api.SolutionStorageCtor, dataCtor api.DataStorageCtor) func(http.ResponseWriter, *http.Request)

ResidualsSummaryHandler bins predicted result data for consumption in a downstream summary view.

func SaveDatasetHandler

func SaveDatasetHandler(metaCtor api.MetadataStorageCtor, dataCtor api.DataStorageCtor, config env.Config) func(http.ResponseWriter, *http.Request)

SaveDatasetHandler extracts a dataset from storage and writes it to disk.

func SaveHandler

func SaveHandler(modelStorageCtor api.ExportedModelStorageCtor, solutionStorageCtor api.SolutionStorageCtor,
	metadataStorageCtor api.MetadataStorageCtor) func(http.ResponseWriter, *http.Request)

SaveHandler exports the caller supplied solution by calling through to the compute server export functionality.

func SetVerboseError

func SetVerboseError(verbose bool)

SetVerboseError sets the flag determining if the client should receive error details

func SolutionHandler

func SolutionHandler(solutionCtor api.SolutionStorageCtor, metadataCtor api.MetadataStorageCtor) func(http.ResponseWriter, *http.Request)

SolutionHandler fetches a solution by its ID.

func SolutionRequestHandler

func SolutionRequestHandler(solutionCtor model.SolutionStorageCtor) func(http.ResponseWriter, *http.Request)

SolutionRequestHandler fetches a solution request by its ID.

func SolutionRequestsHandler

func SolutionRequestsHandler(solutionCtor model.SolutionStorageCtor) func(http.ResponseWriter, *http.Request)

SolutionRequestsHandler fetches search request for a given dataset and target.

func SolutionResultSummaryHandler

func SolutionResultSummaryHandler(metaCtor api.MetadataStorageCtor, solutionCtor api.SolutionStorageCtor, dataCtor api.DataStorageCtor) func(http.ResponseWriter, *http.Request)

SolutionResultSummaryHandler bins predicted result data for consumption in a downstream summary view.

func SolutionVariableRankingHandler

func SolutionVariableRankingHandler(metaCtor api.MetadataStorageCtor, solutionCtor api.SolutionStorageCtor) func(http.ResponseWriter, *http.Request)

SolutionVariableRankingHandler generates a route handler that returns the importances associated with with a solution's features. If a given pipeline produced feature level importances, we'll use those. As a fallback we will rank by the feature/target combination.

func SolutionsHandler

func SolutionsHandler(solutionCtor api.SolutionStorageCtor, metadataCtor api.MetadataStorageCtor) func(http.ResponseWriter, *http.Request)

SolutionsHandler fetches solutions associated with a given dataset and target.

func TargetSummaryHandler

func TargetSummaryHandler(metaCtor api.MetadataStorageCtor, solutionCtor api.SolutionStorageCtor, dataCtor api.DataStorageCtor) func(http.ResponseWriter, *http.Request)

TargetSummaryHandler generates a route handler that facilitates the creation and retrieval of summary information about the specified variable for data returned in a result set.

func TaskHandler

func TaskHandler(dataCtor api.DataStorageCtor, esMetaCtor api.MetadataStorageCtor) func(http.ResponseWriter, *http.Request)

TaskHandler determines modeling task based on dataset and target variable.

func TimeseriesForecastHandler

func TimeseriesForecastHandler(metaCtor api.MetadataStorageCtor, dataCtor api.DataStorageCtor, solutionCtor api.SolutionStorageCtor, trainTestSplitTimeSeries float64) func(http.ResponseWriter, *http.Request)

TimeseriesForecastHandler returns timeseries data.

func TimeseriesHandler

func TimeseriesHandler(metaCtor api.MetadataStorageCtor, ctorStorage api.DataStorageCtor) func(http.ResponseWriter, *http.Request)

TimeseriesHandler returns timeseries data.

func TrainingSummaryHandler

func TrainingSummaryHandler(metaCtor api.MetadataStorageCtor, solutionCtor api.SolutionStorageCtor, dataCtor api.DataStorageCtor) func(http.ResponseWriter, *http.Request)

TrainingSummaryHandler generates a route handler that facilitates the creation and retrieval of summary information about the specified variable for data returned in a result set.

func UpdateHandler

func UpdateHandler(metaCtor api.MetadataStorageCtor, dataCtor api.DataStorageCtor, config env.Config) func(http.ResponseWriter, *http.Request)

UpdateHandler generates a route handler that enables clustering of a variable and the creation of the new column to hold the cluster label.

func UploadHandler

func UploadHandler(config *env.Config) func(http.ResponseWriter, *http.Request)

UploadHandler uploads a file to the local file system and then imports it.

func UserEventHandler

func UserEventHandler(logger *env.DiscoveryLogger) func(w http.ResponseWriter, r *http.Request)

UserEventHandler logs UI events to the discovery logger

func VariableRankingHandler

func VariableRankingHandler(metaCtor api.MetadataStorageCtor) func(http.ResponseWriter, *http.Request)

VariableRankingHandler generates a route handler that allows ranking variables of a dataset relative to the importance of a selected variable. This ranking is potentially long running.

func VariableSummaryHandler

func VariableSummaryHandler(metaCtor api.MetadataStorageCtor, ctorStorage api.DataStorageCtor) func(http.ResponseWriter, *http.Request)

VariableSummaryHandler generates a route handler that facilitates the creation and retrieval of summary information about the specified variable.

func VariableTypeHandler

func VariableTypeHandler(storageCtor api.DataStorageCtor, metaCtor api.MetadataStorageCtor) func(http.ResponseWriter, *http.Request)

VariableTypeHandler generates a route handler that facilitates the update of a variable type.

func VariablesHandler

func VariablesHandler(metaCtor api.MetadataStorageCtor, dataCtor api.DataStorageCtor) func(http.ResponseWriter, *http.Request)

VariablesHandler generates a route handler that facilitates a search of variable names and descriptions, returning a variable list for the specified dataset.

Types

type ClusteringResult

type ClusteringResult struct {
	ClusterField string `json:"cluster"`
}

ClusteringResult represents a clustering response for a variable.

type Combinations

type Combinations struct {
	Combinations []interface{} `json:"combinations"`
}

Combinations provides a lit of combinations to be serialized to JSON for transport to the client.

type CorrectnessSummary

type CorrectnessSummary struct {
	CorrectnessSummary *api.VariableSummary `json:"summary"`
}

CorrectnessSummary contains a fetch result histogram.

type DatasetResult

type DatasetResult struct {
	Dataset *model.Dataset `json:"dataset"`
}

DatasetResult represents the result of a dataset response.

type DatasetsResult

type DatasetsResult struct {
	Datasets []*model.Dataset `json:"datasets"`
}

DatasetsResult represents the result of a datasets response.

type FilteredDataClient

type FilteredDataClient struct {
	NumRows          int                        `json:"numRows"`
	NumRowsFiltered  int                        `json:"numRowsFiltered"`
	Columns          []*api.Column              `json:"columns"`
	Values           [][]*api.FilteredDataValue `json:"values"`
	FittedSolutionID string                     `json:"fittedSolutionId"`
	ProduceRequestID string                     `json:"produceRequestId"`
}

FilteredDataClient is the structure the client requires when fetching data.

type GeocodingResult

type GeocodingResult struct {
	LatitudeField  string `json:"latitude"`
	LongitudeField string `json:"longitude"`
}

GeocodingResult represents a geocoding response for a variable.

type ImagePackRequest

type ImagePackRequest struct {
	Dataset  string   `json:"dataset"`
	ImageIDs []string `json:"imageIds"`
	Band     string   `json:"band,omitempty"`
	Ramp     string   `json:"colorScale,omitempty"`
}

ImagePackRequest is the expected request format for the route (Band can be an empty string)

type ImagePackResult

type ImagePackResult struct {
	ImagesBuffer [][]byte `json:"images"`
	ImageIDs     []string `json:"imageIds"`
	ErrorIDs     []string `json:"errorIds"`
}

ImagePackResult is the expected post result for MultiBandImagePackHandler

type ModelMetricDesc

type ModelMetricDesc struct {
	ID          util.MetricID `json:"id"`
	DisplayName string        `json:"displayName"`
	Description string        `json:"description"`
}

ModelMetricDesc provides a scoring ID, display name, and description.

type MultiBandCombinationDesc

type MultiBandCombinationDesc struct {
	ID          imagery.BandCombinationID `json:"id"`
	DisplayName string                    `json:"displayName"`
	Ramp        bool                      `json:"ramp"`
}

MultiBandCombinationDesc provides a band combination ID and display name.

type OutlierOutput

type OutlierOutput struct {
	Success bool `json:"success"`
}

OutlierOutput represents a outlier response for a variable.

type PredictedSummary

type PredictedSummary struct {
	PredictedSummary *api.VariableSummary `json:"summary"`
}

PredictedSummary contains a fetch result histogram.

type PredictionResponse

type PredictionResponse struct {
	RequestID        string         `json:"requestId"`
	FittedSolutionID string         `json:"fittedSolutionId"`
	Feature          string         `json:"feature"`
	Features         []*api.Feature `json:"features"`
	Dataset          string         `json:"dataset"`
	Progress         string         `json:"progress"`
	Timestamp        time.Time      `json:"timestamp"`
	ResultID         string         `json:"resultId"`
	PredictedKey     string         `json:"predictedKey"`
}

PredictionResponse represents a result from a produce call on a prediction dataset.

type PredictionResult

type PredictionResult struct {
	*FilteredDataClient
	FittedSolutionID string `json:"fittedSolutionId"`
	ProduceRequestID string `json:"produceRequestId"`
}

PredictionResult represents the output from a model prediction.

type ResidualsExtrema

type ResidualsExtrema struct {
	Extrema *api.Extrema `json:"extrema"`
}

ResidualsExtrema contains a residual extrema response.

type SolutionRequest

type SolutionRequest struct {
	RequestID string              `json:"requestId"`
	Feature   string              `json:"feature"`
	Dataset   string              `json:"dataset"`
	Features  []*model.Feature    `json:"features"`
	Filters   *model.FilterParams `json:"filters"`
	Progress  string              `json:"progress"`
	Timestamp time.Time           `json:"timestamp"`
}

SolutionRequest represents a information used to make a pipeline generation request.

type SolutionResponse

type SolutionResponse struct {
	RequestID        string               `json:"requestId"`
	Feature          string               `json:"feature"`
	FeatureLabel     string               `json:"featureLabel"`
	Dataset          string               `json:"dataset"`
	Features         []*api.Feature       `json:"features"`
	Filters          *api.FilterParams    `json:"filters"`
	SolutionID       string               `json:"solutionId"`
	FittedSolutionID string               `json:"fittedSolutionId"`
	ResultID         string               `json:"resultId"`
	Progress         string               `json:"progress"`
	Scores           []*api.SolutionScore `json:"scores"`
	Timestamp        time.Time            `json:"timestamp"`
	PredictedKey     string               `json:"predictedKey"`
	ErrorKey         string               `json:"errorKey"`
	ConfidenceKey    string               `json:"confidenceKey"`
	HasPredictions   bool                 `json:"hasPredictions"`
}

SolutionResponse represents a pipeline solution.

type SummaryResult

type SummaryResult struct {
	Summary *api.VariableSummary `json:"summary"`
}

SummaryResult represents a summary response for a variable.

type TimeseriesForecastResult

type TimeseriesForecastResult struct {
	VarKey            string                       `json:"variableKey"`
	SeriesID          string                       `json:"seriesID"`
	Timeseries        []*api.TimeseriesObservation `json:"timeseries"`
	Forecast          []*api.TimeseriesObservation `json:"forecast"`
	ForecastTestRange []float64                    `json:"forecastTestRange"`
	IsDateTime        bool                         `json:"isDateTime"`
	Min               float64                      `json:"min"`
	Max               float64                      `json:"max"`
	Mean              float64                      `json:"mean"`
}

TimeseriesForecastResult represents the result of a timeseries request.

type VariablesResult

type VariablesResult struct {
	Variables []*model.Variable `json:"variables"`
}

VariablesResult represents the result of a variables response.

Jump to

Keyboard shortcuts

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