cantabular

package
v2.0.3-beta Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2021 License: MIT Imports: 11 Imported by: 32

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is the client for interacting with the Cantabular API

func NewClient

func NewClient(ua httpClient, cfg Config) *Client

NewClient returns a new Client

func (*Client) Checker

func (c *Client) Checker(ctx context.Context, state *healthcheck.CheckState) error

Checker is a placeholder for Cantabular healthcheck, it returns StatusOK with a 'not implemented' message TODO implement this function when we decide how to check the health status of a cantabular service

func (*Client) GetCodebook

func (c *Client) GetCodebook(ctx context.Context, req GetCodebookRequest) (*GetCodebookResponse, error)

GetCodebook gets a Codebook from cantabular.

type Codebook

type Codebook []Variable

Variable represents a 'codebook' object returned from Cantabular

type Config

type Config struct {
	Host string
}

Config holds the config used to initialise the Cantabular Client

type Dataset

type Dataset struct {
	Name             string    `json:"name"`
	Digest           string    `json:"digest"`
	Description      string    `json:"description"`
	Size             int       `json:"size"`
	RulebaseVariable string    `json:"ruleBaseVariable"`
	DateTime         time.Time `json:"datetime"`
}

Dataset represents a 'dataset' object returned from Cantabular

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"message"`
}

ErrorResponse models the error response from cantabular

type GetCodebookRequest

type GetCodebookRequest struct {
	DatasetName string
	Variables   []string
	Categories  bool
}

GetCodebookRequest holds the query parameters for GET /codebook/{dataset}?cats=xxx&v=xxx

type GetCodebookResponse

type GetCodebookResponse struct {
	Codebook Codebook `json:"codebook"`
	Dataset  Dataset  `json:"dataset"`
}

GetCodebookRequest holds the response body for GET /codebook/{dataset}?cats=xxx&v=xxx

type MapFrom

type MapFrom struct {
	SourceNames []string `json:"sourceNames,omitempty"`
	Code        []string `json:"codes,omitempty"`
}

MapFrom represents the 'mapFrom' object from variable when category information is included

type Variable

type Variable struct {
	Name    string    `json:"name"`
	Label   string    `json:"label"`
	Len     int       `json:"len"`
	Codes   []string  `json:"codes,omitempty"`
	Labels  []string  `json:"labels,omitempty"`
	MapFrom []MapFrom `json:"mapFrom,omitempty"`
}

Variable represents a 'variable' object returned from Cantabular

Jump to

Keyboard shortcuts

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