Documentation
¶
Overview ¶
Package observation holds what module-kit does with an observation, novatrail.observation.v1: which one is valid, how the observations of two readers join into one, answer slot by answer slot, which verdict the observation gives with the options tapped beside it, and how the submission of an essay ends (R86 spec; R29). The verdict of each value is the package verdict's, by the check kinds of the module format. The observation's type is spec's, of the module github.com/altnovatrail/spec/contracts, so this package brings in the protobuf runtime, and verdict and the check of a module do not.
api and tutor's eval runner call it:
- api joins the two readings, Join, and gives the verdict on the joined observation, Verdicts, or on none, nil, when either is not valid or the call of AI gave none. It keeps the joined observation and the options tapped, and the same release gives the same verdict on them again, with no AI (R03 spec). In the reading mode single one reader reads, and api gives the verdict on that observation, Verdicts, with nothing to join, or on none, nil, when it is not valid or the call of AI gave none; it keeps the observation only when it is valid, as it keeps the joined one (R68 spec, R86 spec);
- the eval runner gives the verdict on the truth of a sample's markup, and on a reading of one reader, by Validate and Verdicts, and on the readings of a pair by Join and Verdicts (R95 spec);
- an essay has one reader and no verdict: Essay says whether its submission goes on to the assessment by the rubric, ends unreadable or ends unchecked.
An observation that is not valid is ErrNotValid, from Validate, Join, Verdicts and Essay alike, and it is no observation: every answer slot that AI reads gets unchecked by it. So unchecked in the verdict on a valid observation is the check's own, a predicate that could not run (R29).
Index ¶
- Variables
- func Join(items []formatv0.Item, first, second *observationv1.Observation) (*observationv1.Observation, error)
- func Validate(items []formatv0.Item, o *observationv1.Observation) error
- func Verdicts(ctx context.Context, items []formatv0.Item, o *observationv1.Observation, ...) ([]verdict.ItemVerdict, error)
- type Submission
- type Tapped
Constants ¶
This section is empty.
Variables ¶
var ErrNotValid = errors.New("not valid")
ErrNotValid is what an observation that is not valid gives: it is no observation, as a failure of AI is none, and every answer slot that AI reads gets unchecked (R29).
Functions ¶
func Join ¶
func Join(items []formatv0.Item, first, second *observationv1.Observation) (*observationv1.Observation, error)
Join joins the observations of two readers of a task into one, answer slot by answer slot, first being the reader whom tutor names first in the pair. It runs no predicate and takes no context: the join compares values as the check normalizes them.
- A value that the kind normalizes to nothing, such as = under number, is UNREADABLE_BLANK before any pairing.
- Two values join when both are in the kind's notation, the check compares them equal, as it compares a value with a trap value, and gives them the same verdict, its reason and trap too — a predicate the same integer, which gives one verdict —, or when both are out of the notation and their normal forms are the same. A value in the notation and one out of it never join. The joined value is the first, with the first's crop_box, or else the second's.
- Two reasons that are the same join into that reason, and every other pair into UNREADABLE_AMBIGUOUS, with no crop_box.
An error gives no joined observation: either observation is not valid, ErrNotValid, which says which; the task is an essay, which has one reader; or a check is one that the verdict refuses, such as one that holds the placeholder of a template, verdict.ErrPlaceholder, whatever was read. The joined observation is a new message, which shares nothing with the two.
func Validate ¶
func Validate(items []formatv0.Item, o *observationv1.Observation) error
Validate says whether an observation is valid for a task, given its items: nil when it is, and ErrNotValid, with every condition it breaks, when it is not. It holds every answer slot that AI reads, each once and in the task's order, and no other — neither a slot bound choice nor a place the task does not have; each with a value that is valid UTF-8 and not empty nor only white space, or with a reason of the table other than UNREADABLE_UNSPECIFIED; only a slot bound anywhere gives UNREADABLE_NO_FINAL_ANSWER, UNREADABLE_SEVERAL_FINAL_ANSWERS or a crop_box, the box only beside a value, whole thousandths from 0 to 1000 with ymin < ymax and xmin < xmax; and a slot bound sheet gives a value, UNREADABLE_BLANK or UNREADABLE_ILLEGIBLE. A nil observation is none, and not valid.
func Verdicts ¶
func Verdicts(ctx context.Context, items []formatv0.Item, o *observationv1.Observation, tapped []Tapped) ([]verdict.ItemVerdict, error)
Verdicts gives the verdict of every item of a task on an observation, in the task's order, each with its answer slots': a value gets the verdict that the check kind gives that value read, a predicate's in the sandbox of Starlark with ctx; a reason gets unreadable, with the reason of the verdict that the table names; and a slot bound choice gets the verdict of the option tapped, or blank when none was. The observation is one that Join gave, or one that Validate accepts — a reading of one reader, in the reading mode single or for the eval runner, the truth of a sample's markup —, or nil when there is none: AI failed, a limit ran out, or an observation is not valid. Then every answer slot that AI reads is unchecked, and the slots bound choice still get their verdicts.
tapped lists the options tapped, one for each answer slot bound choice that the learner tapped one of, in the task's order, as api gets them.
An error gives no verdict: ctx is done before the verdict, or stops a predicate as it runs; the task has a rubric, verdict.ErrNoVerdict; an item has no answer slots; the observation is not valid, ErrNotValid; an option tapped is not of an answer slot bound choice of the task, or not in order, or twice; or a check is one that the verdict refuses (verdict.OfSlot), whatever was read.
Types ¶
type Submission ¶
type Submission string
Submission is how the submission of an essay ends once it is read, as the test vectors of the observation write it: an essay gives no verdict.
const ( SubmissionAssessment Submission = "assessment" // the essay read goes on to the assessment by its rubric SubmissionUnreadable Submission = "unreadable" // blank or illegible: the learner writes the sheet again SubmissionUnchecked Submission = "unchecked" // no observation: AI failed, or the observation is not valid )
The ends of the submission of an essay.
func Essay ¶
func Essay(items []formatv0.Item, o *observationv1.Observation) (Submission, error)
Essay says how the submission of an essay ends on its observation: SubmissionAssessment when it gives the essay's text, which goes on to the assessment by the rubric, without the picture; SubmissionUnreadable when the sheet is blank or illegible, and the learner writes it again; and SubmissionUnchecked when there is no observation, nil — AI failed, or a limit ran out (R75 spec, R87 spec). A rubric normalizes nothing, so the text is the value as the reader gave it. An error gives no end: the task is no essay, whose one answer slot is bound sheet; or the observation is not valid, ErrNotValid, and the submission then ends unchecked.
type Tapped ¶
type Tapped struct {
Place *observationv1.AnswerSlotPlace
Value string
}
Tapped is the option that the learner tapped in an answer slot bound choice: the answer slot by its place, and the text of the option as the open view of the task writes it, as api gets it in novatrail.api.v1.TappedChoice.