Documentation
¶
Index ¶
- Constants
- type API
- func (api *API) HydrateMultivariateDimensionsPOST(dimensions []model.Dimension, pType string) ([]model.Dimension, error)
- func (api *API) ParseRequest(body io.Reader, req interface{}) error
- func (api *API) RetrieveDefaultCategorisation(dimension *model.Dimension, datasetName string) (string, string, string, error)
- type DatasetJSONDimension
- type DatasetJSONLinks
- type Error
- type GetDatasetJSONResponse
- type GetFilterDimensionOptionsItem
- type GetFilterDimensionOptionsResponse
- type GetObservationResponse
- type GetObservationsResponse
- type ObservationDimension
Constants ¶
const ( DefaultLimit = 20 DefaultOffset = 0 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { Router chi.Router // contains filtered or unexported fields }
API provides a struct to wrap the api around
func New ¶
func New(_ context.Context, cfg *config.Config, r chi.Router, idc *identity.Client, rsp responder, g generator, d datastore, ds datasetAPIClient, pt populationTypesAPIClient, c cantabularClient, m metadataAPIClient, p kafka.IProducer) *API
New creates and initialises a new API
func (*API) HydrateMultivariateDimensionsPOST ¶ added in v1.16.0
func (api *API) HydrateMultivariateDimensionsPOST(dimensions []model.Dimension, pType string) ([]model.Dimension, error)
Used for POST Dimension when the filter type is multivariate. Extra logic required to hydrate dimension using the default categorisation of the dimension.
func (*API) ParseRequest ¶
NOTE: for multivariate tables, it is going to use the name field for the id when making the call to cantabular.
func (*API) RetrieveDefaultCategorisation ¶ added in v1.18.0
func (api *API) RetrieveDefaultCategorisation(dimension *model.Dimension, datasetName string) (string, string, string, error)
RetrieveDefaultCategorisation takes dimension, returns categorisations, and checks if any are default. if so, it returns the relevant information. If there are no default categorisations, it returns empty string for default categorisation, and the original dimension name and label to persist instead. returns (finalDimension, finalLabel, finalCategorisation, error)
type DatasetJSONDimension ¶ added in v1.2.0
type DatasetJSONLinks ¶ added in v1.2.0
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error is the packages error type
func (Error) BadRequest ¶ added in v1.2.0
BadRequest satisfies the errBadRequest interface
func (Error) LogData ¶
LogData satisfies the dataLogger interface which is used to recover log data from an error
func (Error) Message ¶
Message satisfies the messager interface which is used to specify a response to be sent to the caller in place of the error text for a given error. This is useful when you don't want sensitive information or implementation details being exposed to the caller which could be used to find exploits in our API
type GetDatasetJSONResponse ¶ added in v1.10.0
type GetDatasetJSONResponse struct { Dimensions []DatasetJSONDimension `json:"dimensions"` Links DatasetJSONLinks `json:"links"` Observations []float32 `json:"observations"` TotalObservations int `json:"total_observations"` BlockedAreas int `json:"blocked_areas"` TotalAreas int `json:"total_areas"` AreasReturned int `json:"areas_returned"` }
getDatasetJSONResponse is the response body for GET /datasets/{dataset_id}/editions/{edition}/versions/{version}/json
type GetFilterDimensionOptionsItem ¶ added in v1.2.0
type GetFilterDimensionOptionsResponse ¶ added in v1.2.0
type GetFilterDimensionOptionsResponse struct { Items []GetFilterDimensionOptionsItem `json:"items"` // contains filtered or unexported fields }
getDimensionOptionsResponse is the response body for GET /filters/{id}/dimensions/{name}/options
type GetObservationResponse ¶ added in v1.20.0
type GetObservationResponse struct { Dimensions []ObservationDimension `bson:"dimensions" json:"dimensions"` Observation float32 `bson:"observation" json:"observation"` }
type GetObservationsResponse ¶ added in v1.20.0
type GetObservationsResponse struct { Observations []GetObservationResponse `bson:"observations" json:"observations"` Links DatasetJSONLinks `json:"links"` TotalObservations int `json:"total_observations"` BlockedAreas int `json:"blocked_areas"` TotalAreas int `json:"total_areas"` AreasReturned int `json:"areas_returned"` }