Documentation
¶
Overview ¶
Package repository defines interfaces for persisting and retrieving biological stock data.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AutocompleteQuery ¶
type AutocompleteQuery struct {
// Query is the partial search text. The caller sends it untrimmed;
// the repository trims it and lowercases it.
Query string
// Entity restricts the search to one kind of stock.
Entity StockEntityFilter
// Limit is the maximum number of suggestions. A value at or below 0
// becomes 5. A value above 50 becomes 50.
Limit int
}
AutocompleteQuery holds the input of an autocomplete search. The repository normalizes Query and clamps Limit.
type EntityCounts ¶ added in v1.5.0
type EntityCounts struct {
// Total is the number of distinct stocks of this kind, including
// stocks without an ontology term.
Total int64
// Subtypes lists all subtype groups for this stock kind.
Subtypes []SubtypeCount
}
EntityCounts holds the total and subtype counts for one stock kind.
type FullSearchQuery ¶
type FullSearchQuery struct {
// Query is the search text. The caller sends it untrimmed; the
// repository trims it and lowercases it.
Query string
// Entity restricts the search to one kind of stock.
Entity StockEntityFilter
// Limit is the maximum number of results. A value at or below 0
// becomes 50. A value above 50 becomes 50.
Limit int
}
FullSearchQuery holds the input of a full stock search. The repository normalizes Query and clamps Limit.
type FullSearchResult ¶
type FullSearchResult struct {
// ID is the stock_id of the matched stock, for example DBS0236126.
ID string
// Field is the field path that matched, for example summary or label.
Field string
// DisplayText is the complete stored value of the matched field.
DisplayText string
// Summary is the complete stored summary of the stock document. It is
// empty when the attribute is absent.
Summary string
// StockLabel is the strain property label (shown as Descriptor in the
// stock center) for strains, or the plasmid name for plasmids. It is
// empty when the attribute is absent.
StockLabel string
// StockType is the ontology term label of the stock
// (dicty_strain_property for strains, dicty_plasmid_keyword for
// plasmids). It is empty when the term is absent.
StockType string
// Entity is the kind of the matched stock. It is never EntityBoth.
Entity StockEntityFilter
// Score ranks the match. A prefix match scores above a phrase match, a
// phrase match above a token match, and a token match above a fuzzy
// match.
Score float64
}
FullSearchResult is one full search match.
type StockCounts ¶ added in v1.5.0
type StockCounts struct {
Strains EntityCounts
Plasmids EntityCounts
}
StockCounts holds the totals and subtype counts for strains and plasmids.
type StockEntityFilter ¶
type StockEntityFilter string
StockEntityFilter restricts a stock search to one kind of stock. The zero value covers both kinds. The values match the type attribute of the edge in the stock property graph.
const ( // EntityBoth covers strains and plasmids. EntityBoth StockEntityFilter = "" // EntityStrain covers strains only. EntityStrain StockEntityFilter = "strain" // EntityPlasmid covers plasmids only. EntityPlasmid StockEntityFilter = "plasmid" )
type StockRepository ¶
type StockRepository interface {
GetStrain(id string) (*model.StockDoc, error)
GetPlasmid(id string) IOE.IOEither[error, *model.StockDoc]
AddStrain(ns *stock.NewStrain) (*model.StockDoc, error)
AddPlasmid(ns *stock.NewPlasmid) IOE.IOEither[error, *model.StockDoc]
EditStrain(us *stock.StrainUpdate) (*model.StockDoc, error)
EditPlasmid(us *stock.PlasmidUpdate) IOE.IOEither[error, *model.StockDoc]
ListStrains(ctx context.Context, s *stock.StockParameters) ([]*model.StockDoc, error)
ListStrainsByIDs(ctx context.Context, s *stock.StockIdList) ([]*model.StockDoc, error)
ListPlasmids(ctx context.Context, s *stock.StockParameters) IOE.IOEither[error, []*model.StockDoc]
LoadStrain(id string, es *stock.ExistingStrain) (*model.StockDoc, error)
LoadPlasmid(id string, ep *stock.ExistingPlasmid) IOE.IOEither[error, *model.StockDoc]
RemoveStock(id string) error
// SearchStock returns at most Limit ranked full search results for
// the normalized query of params as a lazy IOEither pipeline. An
// empty result is not an error.
SearchStock(
ctx context.Context,
params *FullSearchQuery,
) IOEV2.IOEither[error, []*FullSearchResult]
// AutocompleteStock returns at most Limit short suggestions for the
// normalized query of params as a lazy IOEither pipeline.
AutocompleteStock(
ctx context.Context,
params *AutocompleteQuery,
) IOEV2.IOEither[error, []*Suggestion]
// CountStocks returns the totals and subtype counts for strains and
// plasmids as a lazy IOEither pipeline.
CountStocks(
ctx context.Context,
) IOEV2.IOEither[error, *StockCounts]
Dbh() *manager.Database
LoadOboJSON(r io.Reader) (*storage.UploadInformation, error)
}
StockRepository is an interface for managing stock information
type SubtypeCount ¶ added in v1.5.0
type SubtypeCount struct {
// Name is the subtype group name: regular, gwdi, or bacterial for
// strains; regular or goldenbraid for plasmids.
Name string
// Count is the number of distinct stocks in that subtype group.
Count int64
}
SubtypeCount holds the distinct stock count for one subtype group.
type Suggestion ¶
type Suggestion struct {
// ID is the stock_id of the matched stock, for example DBS0236126.
ID string
// Field is the field path that matched, for example label or genes.
Field string
// DisplayText is the text that the user interface shows.
DisplayText string
// Entity is the kind of the matched stock. It is never EntityBoth.
Entity StockEntityFilter
// Score ranks the match. A prefix match scores above a fuzzy match.
Score float64
}
Suggestion is one autocomplete match.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package arangodb provides ArangoDB implementation of the stock repository interface.
|
Package arangodb provides ArangoDB implementation of the stock repository interface. |
|
statement
Package statement holds the AQL statements of the arangodb repository.
|
Package statement holds the AQL statements of the arangodb repository. |