models

package
v1.27.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const (
	CompletedState = "completed"
	CreatedState   = "created"
	SubmittedState = "submitted"
	FailedState    = "failed"
)

CreatedState represents one possible state of the job resource

Variables

This section is empty.

Functions

func CreateInstance

func CreateInstance(job *Job, datasetID, datasetURL string, codelists []recipe.CodeList) *dataset.NewInstance

CreateInstance from a job ID and the provided recipe CodeLists Neither job nor job.Links can be nil

Types

type DataBakerEvent

type DataBakerEvent struct {
	JobID string `avro:"job_id"`
}

DataBakerEvent used to trigger the databaker process

type IDLink struct {
	ID   string `json:"id"`
	HRef string `json:"href"`
}

IDLink holds the ID and a link to the resource

type ImportData

type ImportData struct {
	JobID         string
	Recipe        string          `json:"recipe,omitempty"`
	Format        string          `json:"format,omitempty"`
	UploadedFiles *[]UploadedFile `json:"files,omitempty"`
	InstanceIDs   []string
}

ImportData used to create a message to data baker or direct to the dimension-extractor

type Job

type Job struct {
	ID              string               `bson:"id,omitempty"                  json:"id,omitempty"`
	RecipeID        string               `bson:"recipe,omitempty"              json:"recipe,omitempty"`
	State           string               `bson:"state,omitempty"               json:"state,omitempty"`
	UploadedFiles   *[]UploadedFile      `bson:"files,omitempty"               json:"files,omitempty"`
	Links           *LinksMap            `bson:"links,omitempty"               json:"links,omitempty"`
	Processed       []ProcessedInstances `bson:"processed_instances,omitempty" json:"processed_instances,omitempty"`
	LastUpdated     time.Time            `bson:"last_updated,omitempty"        json:"last_updated,omitempty"`
	UniqueTimestamp bsonprim.Timestamp   `bson:"unique_timestamp,omitempty"    json:"-"`
}

Job for importing datasets

func CreateJob

func CreateJob(reader io.Reader) (*Job, error)

CreateJob from a json message

func (*Job) Validate

func (job *Job) Validate() error

Validate the content of a job

func (*Job) ValidateState

func (job *Job) ValidateState() error

ValidateState checks the state is valid

type JobResults

type JobResults struct {
	Count      int    `json:"count"`
	Offset     int    `json:"offset"`
	Limit      int    `json:"limit"`
	TotalCount int    `json:"total_count"`
	Items      []*Job `json:"items"`
}

JobResults for list of Job items

type LinksMap

type LinksMap struct {
	Instances []IDLink `bson:"instances,omitempty" json:"instances,omitempty"`
	Self      IDLink   `bson:"self,omitempty" json:"self,omitempty"`
}

LinksMap represents a list of links related to a job resource

type ProcessedInstances added in v1.18.0

type ProcessedInstances struct {
	ID             string `bson:"id,omitempty"               json:"id,omitempty"`
	RequiredCount  int    `bson:"required_count,omitempty"   json:"required_count,omitempty"`
	ProcessedCount int    `bson:"processed_count,omitempty"  json:"processed_count,omitempty"`
}

ProcessedInstances holds the ID and the number of code lists that have been processed during an import process for an instance

type UploadedFile

type UploadedFile struct {
	AliasName string `bson:"alias_name" json:"alias_name" avro:"alias-name"`
	URL       string `bson:"url"        json:"url"        avro:"url"`
}

UploadedFile used for a file which has been uploaded to a bucket

func CreateUploadedFile

func CreateUploadedFile(reader io.Reader) (*UploadedFile, error)

CreateUploadedFile from a json message

func (UploadedFile) Validate

func (s UploadedFile) Validate() error

Validate the content of the structure

Jump to

Keyboard shortcuts

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