Documentation
¶
Overview ¶
Package engine is NovaTrail's engine: it picks a learner's next lesson or task by a rule, and gives the choice a reason code, which the adult sees and the learner is not told.
It is a library with no input or output of its own. The api service — at stage 1, the learner simulator, sim — hands it the learner model's estimates, the skill graphs of the learner's modules, the lessons and the pool of tasks, the learner's lesson runs, and a summary of what has been handed out before, and passes the time in as a number; api keeps every choice the library makes. The library estimates no mastery — that is the learner model's — gives no verdict, calls no AI model, reads no module package or database, and keeps nothing between calls. The rule takes no randomness, so it takes no seed (R07).
The same input gives the same choice and the same reason code, bit for bit, on any build by Go's gc compiler of one version of this module and of the learner model — on any architecture it knows, WebAssembly included, with any Go no older than go.mod names. The code imports nothing but Go's standard library and the learner model, and only the packages its rules allow (R10).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalid = errors.New("engine: invalid input")
ErrInvalid is an input that breaks a rule the engine relies on: a choice is never made of it. It comes as a value and never by panicking; errors.Is tells it apart, and the message says what and where. An error of learner-model the input brought, from Readout.Task, is wrapped, so that errors.Is finds learner-model's kind too.
Functions ¶
This section is empty.
Types ¶
type Candidate ¶
type Candidate struct {
Task learnermodel.Task
Traps []ItemTraps
}
Candidate is a task of the pool: its description, and the traps of its items.
type Choice ¶
type Choice struct {
Kind ChoiceKind
ID string
Reason ReasonCode
}
Choice is the engine's choice: a lesson or a task by its full ID — of a template, the template's — or nothing to give, with no ID; and the reason code of the branch that made it, ReasonUnspecified beside nothing to give.
func Choose ¶
Choose picks what the learner is given next, and the reason code of the choice. It refuses, with ErrInvalid, an input whose rules it relies on are broken: a module, a task of the pool or a lesson twice by ID; a skill of a graph, a task of the pool or a lesson that is not its module's by ID; a skill of a lesson that is not in the graph of its module; the traps of an item twice, or at a place where its task has no item; a run's end outside its list, an open run with a time of its end, and two open runs of one lesson; a skill, a module or a task twice in the summary, and a reason code of the summary outside its list; a skill twice in the results of the last attempt, and a result with first right verdicts fewer than none or more than its first verdicts; a module of the engine with no reading of the learner model, and an anchor skill a graph names with none or with a status off its list; and a candidate task the reading refuses, or one with the P of an item outside [0, 1], NaN and the infinities included. The checks run in one order and each names the least ID that breaks it, so that the order of the input's lists does not change the error either.
Choose runs the rule: the lesson of an open run; then on the skill chosen on the map, or in "My subjects" — consolidation in the module of the last closed attempt, then the modules in turn, with the repetition, the lessons on the new and the author's order —; then a second pass with the tasks on pause, and gives a lesson or a task with the code of its branch, or nothing to give.
type ChoiceKind ¶
type ChoiceKind int32
ChoiceKind is what a choice gives: ChoiceKind of cause.proto, names and numbers.
const ( ChoiceUnspecified ChoiceKind = 0 // never given ChoiceLesson ChoiceKind = 1 ChoiceTask ChoiceKind = 2 // a task outside a lesson ChoiceNothing ChoiceKind = 3 )
type Input ¶
type Input struct {
Time int64 // the time of the choice
// The learner model's reading at Time, by learnermodel.Read: the modules of the engine and
// the modules of the evidence log.
Readout learnermodel.Readout
Modules []Module // the modules of the engine: connected, and suited to the learner
// The full ID of the skill the learner chose on the skill map; empty in "My subjects".
MapSkill string
Runs []Run // the lesson runs of the profile in the modules of the engine
RubricDone []RubricDone // the attempts of tasks with a rubric closed by "Done"
Last Last // the last closed attempt of the profile, when HasLast
HasLast bool
Summary Summary // what was handed out before
}
Input is all that one choice reads. The order of its lists does not change the choice: the rule orders by itself, by the order of the graph, of the lessons and of the IDs.
type ItemTraps ¶
ItemTraps is the traps of an item, by its place: the trap_values of its checks, by full ID.
type Last ¶
type Last struct {
Task string // the full ID of its task, whose beginning is its module
Left bool // whether it was closed as left: its outcome is "left"
Lesson string // the full ID of the lesson, when InLesson
InLesson bool // whether the attempt is a segment of a run of that lesson
Results []SkillResult // the result on each of its primary skills
}
Last is the last closed attempt of the profile.
type Lesson ¶
type Lesson struct {
ID string
Skills []string
Tasks []learnermodel.Task
}
Lesson is a lesson of a module: its full ID, its skills, and the descriptions of the tasks of its segments, in the order of the segments.
type Module ¶
type Module struct {
Graph learnermodel.Graph
Pool []Candidate
Lessons []Lesson // the lessons that suit the learner whole
}
Module is a module of the engine: the graph of its current version, and the pool and the lessons api gives the learner of it.
type ModuleChoices ¶
ModuleChoices is the number of choices of a module, a lesson counted once.
type ReasonCode ¶
type ReasonCode int32
ReasonCode is why the engine gave what it chose: one value of the closed list ReasonCode of cause.proto in spec's contracts, with its number, which api translates the code by. The adult sees it; the learner is not told it. A test holds the names and numbers to the file.
const ( ReasonUnspecified ReasonCode = 0 // a choice of nothing ReasonConsolidation ReasonCode = 1 // after a wrong answer, another task on the skill ReasonNewSkill ReasonCode = 2 // a skill not given before, whose prerequisites are met ReasonQueue ReasonCode = 3 // the skill within reach not given for longest in its module ReasonRepetition ReasonCode = 4 // the review date of a mastered skill has come ReasonProbe ReasonCode = 5 // a skill put aside comes back as a check ReasonSkillChosen ReasonCode = 6 // the skill chosen on the skill map ReasonAuthorOrder ReasonCode = 7 // a skill with a rubric or without assessment, by the graph ReasonOpenRun ReasonCode = 8 // the lesson of a run that is open ReasonRotation ReasonCode = 9 // a skill given before comes round again, outside the queue )
type RubricDone ¶
RubricDone is an attempt of a task with a rubric that "Done" closed, and when. The attempts of one task repeat by right: a task with a rubric is given again by a new attempt.
type Run ¶
type Run struct {
Lesson string
Skills []string
End RunEnd // RunOpen while it is open
EndedAt int64 // zero while it is open
}
Run is a lesson run of the profile: its lesson and the lesson's skills — translated, on a package before — how it ended, and when. The runs of one lesson repeat by right: a lesson is given again by a new run.
type RunEnd ¶
type RunEnd int32
RunEnd is how a lesson run ended: RunEndReason of cause.proto, names and numbers. Its zero is a run that is open.
type SkillIssue ¶
type SkillIssue struct {
Skill string
LastIssued int64
Issued bool
LastCode ReasonCode
LastResult SkillResult
HasLast bool
}
SkillIssue is when a skill was last handed out, by a task on it or by a lesson that teaches it, when Issued; and, when HasLast, the reason code of the choice of its last closed attempt and the attempt's result on it.
type SkillResult ¶
SkillResult is the result of an attempt on a skill, in facts: of the items of the attempt the skill is primary in, how many got a first verdict, how many of those are right, and whether the solution was shown. The engine tells a failure from them, by the same rule as the learner model.
type Summary ¶
type Summary struct {
Skills []SkillIssue
Modules []ModuleChoices
Tasks []TaskSolution
}
Summary is what api gives of what was handed out before, from the records of choices and attempts it keeps.
type TaskSolution ¶
TaskSolution is when the solution of a task with a key last went to the learner's device. A task with a rubric is not here: its solution, open after "Done", does not count, and the engine reads such a task by RubricDone.