Documentation
¶
Overview ¶
Package push hands one item that the service holds straight to a program on this machine. psyche is the one such program. Its relate reads the item's parse, the findings of the scan that read it and, where asked, what the service derived from the parse, as one parse-input document on stdin.
Index ¶
Constants ¶
const ( FromQualityGate = "the quality gate" FromModelRead = "the model read" )
The stages that --enriched reads, as a person names them.
const Connector = "cli-push"
Connector is the push connector that a new link lands through, where the push names no other.
const Destination = route.PsycheDestination
Destination is the destination that a link a push lands is placed at.
const Program = "psyche"
Program is the program that a push to psyche runs, found on PATH.
const SchemaVersion = 1
SchemaVersion is the version of psyche's parse-input schema that Write writes, the one that testdata/parse-input.schema.json holds.
const Wait = 10 * time.Minute
Wait is how long a push waits for an item's parse and the scan of it, where it names no other wait. A captions parse waits its turn at ypl's door before its read, so Wait leaves room for the longest door wait and captions read that ypl publishes, with the claims and the scan after them.
Variables ¶
var ErrNoText = errors.New("the parse holds no text")
ErrNoText is a parse whose text is whitespace alone, which leaves psyche nothing to relate.
var ErrNotScanned = errors.New("no scan has read the parse")
ErrNotScanned is a parse that no scan has read, which a push never hands on.
Functions ¶
func Relate ¶
Relate runs `psyche relate --parse -` on this machine with doc on its stdin, adding --json where asJSON is set. psyche writes to stdout and stderr as it runs.
func WaitingOn ¶ added in v0.31.0
func WaitingOn(item server.ItemAnswer) (stage, ended string)
WaitingOn names the stage that item waits at on its way to a scanned parse, store.StageParse until a parse is done and store.StageScan after, as the service's progress of each reads. Where no run of that stage is left to end it, ended says how it ended, so a push stops waiting: it failed, or nothing queued it.
Types ¶
type Document ¶
type Document struct {
SchemaVersion int `json:"schema_version"`
Key string `json:"key"`
URL *string `json:"url"`
Title *string `json:"title"`
Zone store.Zone `json:"zone"`
MediaType string `json:"media_type"`
Extractor string `json:"extractor"`
ExtractorVersion string `json:"extractor_version"`
Text string `json:"text"`
Units []store.Unit `json:"units"`
RulesVersion *string `json:"rules_version"`
Findings []server.ParseFinding `json:"findings"`
Suggested []Suggestion `json:"suggested"`
Enriched *Enriched `json:"enriched,omitempty"`
}
Document is one parsed source as `psyche relate --parse` reads it.
type Enriched ¶
type Enriched struct {
Summary *string `json:"summary,omitempty"`
Idea *string `json:"idea,omitempty"`
Suggestion *string `json:"suggestion,omitempty"`
Genre *string `json:"genre,omitempty"`
Domains []string `json:"domains,omitempty"`
Themes []string `json:"themes,omitempty"`
Quality *int `json:"quality,omitempty"`
}
Enriched is what the service derived from the parse. Each field is absent where no stage answered it.
type Enrichment ¶
type Enrichment struct {
// Enriched is nil where no stage's answer could be read.
Enriched *Enriched
// From names each stage whose answer Enriched carries.
From []string
// Left says, in a sentence each, which part was left out and why.
Left []string
}
Enrichment is what --enriched adds to the document, and why each part that it leaves out is missing.
func Enrich ¶
func Enrich(item server.ItemAnswer) Enrichment
Enrich is what the service's current answers on item add: the quality gate's answer and the model read's summary and suggestion. The model read's sentence goes only where no scan finding lies over it, because psyche's document holds no place for a finding in it. The summary and the quality gate's words go unscanned. Each restates the source text, which psyche reads whole beside its findings.
type Suggestion ¶
type Suggestion struct {
Kind string `json:"kind"`
Text string `json:"text"`
Unit *int `json:"unit"`
}
Suggestion is one command, link or piece of code that the text suggests, from the scan's finding that matched it.