tme

package
v0.0.0-...-db96554 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2018 License: MIT Imports: 22 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EndpointTypeMappings = map[string]map[string]interface{}{
	"alphaville-series": {
		"taxonomy": "AlphavilleSeriesClassification",
		"source":   &tmereader.KnowledgeBases{},
		"type":     "AlphavilleSeries",
	},
	"authors": {
		"taxonomy": "Authors",
		"source":   &tmereader.AuthorityFiles{},
		"type":     "Person",
	},
	"brands": {
		"taxonomy": "Brands",
		"source":   &tmereader.AuthorityFiles{},
		"type":     "Brand",
	},
	"genres": {
		"taxonomy": "Genres",
		"source":   &tmereader.KnowledgeBases{},
		"type":     "Genre",
	},
	"locations": {
		"taxonomy": "GL",
		"source":   &tmereader.AuthorityFiles{},
		"type":     "Location",
	},
	"people": {
		"taxonomy": "PN",
		"source":   &tmereader.AuthorityFiles{},
		"type":     "Person",
	},
	"sections": {
		"taxonomy": "Sections",
		"source":   &tmereader.KnowledgeBases{},
		"type":     "Section",
	},
	"special-reports": {
		"taxonomy": "SpecialReports",
		"source":   &tmereader.AuthorityFiles{},
		"type":     "SpecialReport",
	},
	"subjects": {
		"taxonomy": "Subjects",
		"source":   &tmereader.KnowledgeBases{},
		"type":     "Subject",
	},
	"topics": {
		"taxonomy": "Topics",
		"source":   &tmereader.KnowledgeBases{},
		"type":     "Topic",
	},
	"organisations": {
		"taxonomy": "ON",
		"source":   &tmereader.AuthorityFiles{},
		"type":     "Organisation",
	},
}

Functions

func Router

func Router(th *Handler) *mux.Router

Types

type BasicConcept

type BasicConcept struct {
	UUID           string   `json:"uuid"`
	ParentUUIDs    []string `json:"parentUUIDs,omitempty"`
	PrefLabel      string   `json:"prefLabel,omitempty"`
	Type           string   `json:"type,omitempty"`
	Authority      string   `json:"authority,omitempty"`
	AuthorityValue string   `json:"authorityValue,omitempty"`
	Aliases        []string `json:"aliases,omitempty"`
	IsDeprecated   bool     `json:"isDeprecated,omitempty"`
}

type ConceptUUID

type ConceptUUID struct {
	UUID string `json:"uuid"`
}

type Handler

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

func NewHandler

func NewHandler(service Service) *Handler

func (*Handler) EnforceDataLoaded

func (th *Handler) EnforceDataLoaded(next http.Handler) http.Handler

func (*Handler) EnforceTaxonomy

func (th *Handler) EnforceTaxonomy(next http.Handler) http.Handler

func (*Handler) G2GCheck

func (th *Handler) G2GCheck() gtg.Status

func (*Handler) GetCount

func (th *Handler) GetCount(resp http.ResponseWriter, req *http.Request)

func (*Handler) GetIDs

func (th *Handler) GetIDs(resp http.ResponseWriter, req *http.Request)

func (*Handler) HandleGetFullTaxonomy

func (th *Handler) HandleGetFullTaxonomy(resp http.ResponseWriter, req *http.Request)

func (*Handler) HandleGetSingleConcept

func (th *Handler) HandleGetSingleConcept(resp http.ResponseWriter, req *http.Request)

func (*Handler) HandleReloadConcepts

func (th *Handler) HandleReloadConcepts(resp http.ResponseWriter, req *http.Request)

func (*Handler) HandleSendConcepts

func (th *Handler) HandleSendConcepts(resp http.ResponseWriter, req *http.Request)

func (*Handler) HandleSendSingle

func (th *Handler) HandleSendSingle(resp http.ResponseWriter, req *http.Request)

func (*Handler) HealthCheck

func (th *Handler) HealthCheck() []fthealth.Check

type Service

type Service interface {
	IsDataLoaded(endpoint string) bool
	GetCount(endpoint string) (int, error)
	GetAllConcepts(endpoint string) (io.PipeReader, error)
	GetConceptByUUID(endpoint, uuid string) (*BasicConcept, bool, error)
	GetConceptUUIDs(endpoint string) (io.PipeReader, error)
	SendConcepts(endpoint, jobID string, ignoreHash bool) error
	RefreshConceptByUUID(endpoint, uuid string) (*BasicConcept, bool, error)
	SendConceptByUUID(txID, endpoint, uuid string, ignoreHash bool) error
	Reload(endpoint string) error
	GetLoadedTypes() []string
}

Service - the main service interface

func NewService

func NewService(repos map[string]tmereader.Repository, httpClient httpClient, baseURL string, maxTmeRecords int, writerEndpoint string, writerWorkers int) Service

NewService - creates an instance of Service

type ServiceImpl

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

ServiceImpl - implements the interface above

func (*ServiceImpl) GetAllConcepts

func (s *ServiceImpl) GetAllConcepts(endpoint string) (io.PipeReader, error)

GetAllConcepts - returns a stream of all concepts for an endpoint

func (*ServiceImpl) GetConceptByUUID

func (s *ServiceImpl) GetConceptByUUID(endpoint, uuid string) (*BasicConcept, bool, error)

GetConceptByUUID - return a specific concept from a specific endpoint.

func (*ServiceImpl) GetConceptUUIDs

func (s *ServiceImpl) GetConceptUUIDs(endpoint string) (io.PipeReader, error)

func (*ServiceImpl) GetCount

func (s *ServiceImpl) GetCount(endpoint string) (int, error)

GetCount - returns record count for a specific endpoint

func (*ServiceImpl) GetLoadedTypes

func (s *ServiceImpl) GetLoadedTypes() []string

GetLoadedTypes - returns a list of the loaded types, rather than assuming everything in the mapping.

func (*ServiceImpl) IsDataLoaded

func (s *ServiceImpl) IsDataLoaded(endpoint string) bool

IsDataLoaded - is data for a specific endpoint loaded?

func (*ServiceImpl) RefreshConceptByUUID

func (s *ServiceImpl) RefreshConceptByUUID(endpoint, uuid string) (*BasicConcept, bool, error)

RefreshConceptByUUID - updates and returns a specific concept.

func (*ServiceImpl) Reload

func (s *ServiceImpl) Reload(endpoint string) error

Reload - Reloads the data for a specific endpoint

func (*ServiceImpl) SendConceptByUUID

func (s *ServiceImpl) SendConceptByUUID(txID, endpoint, uuid string, ignoreHash bool) error

func (*ServiceImpl) SendConcepts

func (s *ServiceImpl) SendConcepts(endpoint, jobID string, ignoreHash bool) error

type Taxonomy

type Taxonomy struct {
	TermsT []Term `xml:"term"`
	TermsC []Term `xml:"category"`
}

type Term

type Term struct {
	CanonicalName string  `xml:"name"`
	RawID         string  `xml:"id"`
	Aliases       aliases `xml:"variations"`
	Enabled       *bool   `xml:"enabled,omitempty"`
}

type Transformer

type Transformer struct {
}

func (*Transformer) UnMarshallTaxonomy

func (*Transformer) UnMarshallTaxonomy(contents []byte) ([]interface{}, error)

func (*Transformer) UnMarshallTerm

func (*Transformer) UnMarshallTerm(content []byte) (interface{}, error)

Jump to

Keyboard shortcuts

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