service

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoElasticClient = errors.New("no ElasticSearch client available")
)

Functions

func NewElasticClient

func NewElasticClient(region string, config EsAccessConfig) (*elastic.Client, error)

Types

type AWSSigningTransport

type AWSSigningTransport struct {
	HTTPClient  *http.Client
	Credentials *credentials.Credentials
	Region      string
}

func (AWSSigningTransport) RoundTrip

func (a AWSSigningTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implementation

type AggregateConceptModel

type AggregateConceptModel struct {
	// Required fields
	PrefUUID   string `json:"prefUUID"`
	DirectType string `json:"type"`
	PrefLabel  string `json:"prefLabel"`
	// Additional fields
	Aliases   []string `json:"aliases,omitempty"`
	ScopeNote string   `json:"scopeNote,omitempty"`
	// Membership
	MembershipRoles  []AggregateMembershipRole `json:"membershipRoles,omitempty"`
	OrganisationUUID []string                  `json:"organisationUUID,omitempty"`
	PersonUUID       []string                  `json:"personUUID,omitempty"`
	// Organisation
	CountryCode            string `json:"countryCode,omitempty"`
	CountryOfIncorporation string `json:"countryOfIncorporation,omitempty"`
	IsDeprecated           bool   `json:"isDeprecated,omitempty"`
	// Source representations
	SourceRepresentations []SourceConcept `json:"sourceRepresentations"`
	// NAICS
	NAICS []NAICS `json:"naicsIndustryClassifications,omitempty"`
}

func (AggregateConceptModel) ConcordedUUIDs

func (c AggregateConceptModel) ConcordedUUIDs() []string

func (AggregateConceptModel) GetAuthorities

func (c AggregateConceptModel) GetAuthorities() []string

func (AggregateConceptModel) PreferredUUID

func (c AggregateConceptModel) PreferredUUID() string

type AggregateMembershipRole

type AggregateMembershipRole struct {
	RoleUUID        string `json:"membershipRoleUUID,omitempty"`
	InceptionDate   string `json:"inceptionDate,omitempty"`
	TerminationDate string `json:"terminationDate,omitempty"`
}

type BulkProcessorConfig

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

func NewBulkProcessorConfig

func NewBulkProcessorConfig(nrWorkers int, nrOfRequests int, bulkSize int, flushInterval time.Duration) BulkProcessorConfig

type Concept

type Concept interface {
	// GetAuthorities returns an array containing all authorities that this concept is identified by
	GetAuthorities() []string
	// ConcordedUUIDs returns an array containing all concorded concept uuids - N.B. it will not contain the canonical prefUUID.
	ConcordedUUIDs() []string

	PreferredUUID() string
}

Concept contains common function between both concept models

type ConceptMetrics

type ConceptMetrics struct {
	AnnotationsCount         int `json:"annotationsCount"`
	PrevWeekAnnotationsCount int `json:"prevWeekAnnotationsCount"`
}

type ConceptModel

type ConceptModel struct {
	UUID                   string                 `json:"uuid"`
	DirectType             string                 `json:"type"`
	PrefLabel              string                 `json:"prefLabel"`
	Authority              string                 `json:"authority,omitempty"`
	Aliases                []string               `json:"aliases,omitempty"`
	AlternativeIdentifiers map[string]interface{} `json:"alternativeIdentifiers,omitempty"`
	IsDeprecated           bool                   `json:"isDeprecated,omitempty"`
	ScopeNote              string                 `json:"scopeNote,omitempty"`
}

func (ConceptModel) ConcordedUUIDs

func (c ConceptModel) ConcordedUUIDs() []string

func (ConceptModel) GetAuthorities

func (c ConceptModel) GetAuthorities() []string

func (ConceptModel) PreferredUUID

func (c ConceptModel) PreferredUUID() string

type EsAccessConfig

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

func NewAccessConfig

func NewAccessConfig(awsCreds *credentials.Credentials, endpoint string, tracelogging bool) EsAccessConfig

type EsConceptModel

type EsConceptModel struct {
	Id                     string          `json:"id"`
	Type                   string          `json:"type,omitempty"`
	ApiUrl                 string          `json:"apiUrl"`
	PrefLabel              string          `json:"prefLabel"`
	Types                  []string        `json:"types"`
	Authorities            []string        `json:"authorities"`
	DirectType             string          `json:"directType"`
	Aliases                []string        `json:"aliases,omitempty"`
	LastModified           string          `json:"lastModified"`
	PublishReference       string          `json:"publishReference"`
	IsDeprecated           bool            `json:"isDeprecated,omitempty"` // stored only if this is true
	ScopeNote              string          `json:"scopeNote,omitempty"`
	CountryCode            string          `json:"countryCode,omitempty"`
	CountryOfIncorporation string          `json:"countryOfIncorporation,omitempty"`
	Metrics                *ConceptMetrics `json:"metrics,omitempty"`
	NAICS                  []NAICS         `json:"NAICS,omitempty"`
}

type EsConceptModelPatch

type EsConceptModelPatch struct {
	Metrics *ConceptMetrics `json:"metrics"`
}

type EsIDTypePair

type EsIDTypePair struct {
	ID   string `json:"id,omitempty"`
	Type string `json:"type,omitempty"`
}

type EsMembershipModel

type EsMembershipModel struct {
	Id             string   `json:"id"`
	PersonId       string   `json:"personId"`
	OrganisationId string   `json:"organisationId"`
	Memberships    []string `json:"memberships"`
}

type EsModel

type EsModel interface{}

func ConvertAggregateConceptToESConceptModel

func ConvertAggregateConceptToESConceptModel(concept AggregateConceptModel, conceptType, publishRef, publicAPIHost string) (EsModel, error)

func ConvertConceptToESConceptModel

func ConvertConceptToESConceptModel(concept ConceptModel, conceptType, publishRef, publicAPIHost string) (EsModel, error)

type EsPersonConceptModel

type EsPersonConceptModel struct {
	*EsConceptModel
	IsFTAuthor string `json:"isFTAuthor,omitempty"`
}

type EsPersonConceptPatch

type EsPersonConceptPatch struct {
	Metrics    *ConceptMetrics `json:"metrics"`
	IsFTAuthor string          `json:"isFTAuthor"`
}

type EsService

type EsService interface {
	LoadData(ctx context.Context, conceptType string, uuid string, payload EsModel) (bool, *elastic.IndexResponse, error)
	ReadData(uuid string) (*elastic.GetResult, error)
	DeleteData(ctx context.Context, conceptType string, uuid string) (*elastic.DeleteResponse, error)
	LoadBulkData(uuid string, payload interface{})
	CleanupData(ctx context.Context, concept Concept)
	PatchUpdateConcept(uuid string, payload PayloadPatch)
	CloseBulkProcessor() error
	GetClusterHealth() (*elastic.ClusterHealthResponse, error)
	IsIndexReadOnly() (bool, string, error)
	GetAllIDs(ctx context.Context, includeTypes, excludeFTPinkAuthorities, includeAllAuthorities bool) chan EsIDTypePair
}

func NewEsService

func NewEsService(ch chan *elastic.Client, indexName string, bulkProcessorConfig *BulkProcessorConfig) EsService

type NAICS added in v1.5.5

type NAICS struct {
	UUID string `json:"uuid"`
	Rank int    `json:"rank"`
}

type PayloadPatch

type PayloadPatch interface{}

type SourceConcept

type SourceConcept struct {
	UUID      string `json:"uuid"`
	Authority string `json:"authority"`
}

Jump to

Keyboard shortcuts

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