@nakafa/aksara-contracts 8.4.1 → 8.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assessment/answer.d.ts +2 -0
- package/dist/assessment/answer.js +5 -3
- package/dist/assessment/closure.js +2 -1
- package/dist/assessment/fit.d.ts +16 -2
- package/dist/assessment/fit.js +23 -5
- package/dist/assessment/graphic.d.ts +27 -0
- package/dist/assessment/graphic.js +17 -1
- package/dist/assessment/hash.d.ts +71 -3
- package/dist/assessment/interaction.d.ts +18 -1
- package/dist/assessment/interaction.js +2 -1
- package/dist/assessment/item.d.ts +85 -0
- package/dist/assessment/item.js +1 -1
- package/dist/assessment/joint.d.ts +4 -3
- package/dist/assessment/joint.js +4 -3
- package/dist/assessment/key.d.ts +138 -0
- package/dist/assessment/key.js +6 -0
- package/dist/assessment/paper.d.ts +316 -0
- package/dist/assessment/profile.d.ts +3 -3
- package/dist/assessment/profile.js +4 -4
- package/dist/assessment/rows.d.ts +285 -3
- package/dist/assessment/scoring.d.ts +12 -6
- package/dist/assessment/scoring.js +25 -8
- package/dist/assessment/sketch.d.ts +125 -0
- package/dist/assessment/sketch.js +175 -0
- package/dist/assessment/snapshot.d.ts +746 -10
- package/dist/assessment/structure.js +4 -4
- package/dist/hash/sha256.d.ts +16 -0
- package/dist/hash/sha256.js +164 -0
- package/dist/hash/stream.d.ts +7 -5
- package/dist/hash/stream.js +13 -18
- package/dist/math/boundary.js +3 -22
- package/dist/math/edge.d.ts +11 -0
- package/dist/math/edge.js +74 -0
- package/dist/math/graph.d.ts +9 -0
- package/dist/math/graph.js +66 -0
- package/dist/math/plane.js +6 -0
- package/dist/math/shape.d.ts +392 -0
- package/dist/math/shape.js +59 -0
- package/dist/math/straight.d.ts +13 -0
- package/dist/math/straight.js +26 -0
- package/dist/release/snapshot/data.d.ts +88 -2
- package/dist/release/snapshot/verify.d.ts +285 -3
- package/dist/transport/group.d.ts +264 -6
- package/dist/transport/request.d.ts +1886 -22
- package/dist/transport/snapshot.d.ts +176 -4
- package/dist/visual/biology/blood.d.ts +91 -0
- package/dist/visual/biology/blood.js +55 -0
- package/dist/visual/biology/heart.d.ts +92 -0
- package/dist/visual/biology/heart.js +54 -0
- package/dist/visual/biology/mitochondrion.d.ts +91 -0
- package/dist/visual/biology/mitochondrion.js +45 -0
- package/dist/visual/biology/muscle.d.ts +103 -0
- package/dist/visual/biology/muscle.js +62 -0
- package/dist/visual/biology/neuron.d.ts +97 -0
- package/dist/visual/biology/neuron.js +48 -0
- package/dist/visual/biology/paddy.d.ts +100 -0
- package/dist/visual/biology/paddy.js +54 -0
- package/dist/visual/biology/synapse.d.ts +101 -0
- package/dist/visual/biology/synapse.js +46 -0
- package/dist/visual/biology/vessel.d.ts +104 -0
- package/dist/visual/biology/vessel.js +60 -0
- package/dist/visual/biology/yeast.d.ts +108 -0
- package/dist/visual/biology/yeast.js +61 -0
- package/dist/visual/catalog.d.ts +2177 -778
- package/dist/visual/catalog.js +28 -0
- package/dist/visual/mathematics/journey.d.ts +118 -0
- package/dist/visual/mathematics/journey.js +125 -0
- package/dist/visual/mathematics/logic.d.ts +90 -0
- package/dist/visual/mathematics/logic.js +49 -0
- package/dist/visual/mathematics/network.d.ts +101 -0
- package/dist/visual/mathematics/network.js +97 -0
- package/dist/visual/mathematics/numeral.d.ts +81 -0
- package/dist/visual/mathematics/numeral.js +48 -0
- package/dist/visual/mathematics/sets.d.ts +92 -0
- package/dist/visual/mathematics/sets.js +95 -0
- package/dist/visual/physics/thermodynamics.d.ts +117 -0
- package/dist/visual/physics/thermodynamics.js +95 -0
- package/package.json +2 -2
|
@@ -8,6 +8,8 @@ import { BigDecimal, Option, Schema } from "effect";
|
|
|
8
8
|
*/
|
|
9
9
|
export declare const DecimalSchema: Schema.String;
|
|
10
10
|
export type Decimal = typeof DecimalSchema.Type;
|
|
11
|
+
/** One canonical decimal strictly greater than zero, such as a tolerance. */
|
|
12
|
+
export declare const PositiveDecimalSchema: Schema.String;
|
|
11
13
|
/**
|
|
12
14
|
* Largest accepted distance from the exact value, inclusive. An absolute
|
|
13
15
|
* tolerance `t` accepts `|answer - value| <= t`. A relative tolerance `r`
|
|
@@ -27,6 +27,10 @@ export const DecimalSchema = Schema.String.check(Schema.isPattern(DECIMAL_PATTER
|
|
|
27
27
|
function isPositiveDecimal(value) {
|
|
28
28
|
return value !== "0" && !value.startsWith("-");
|
|
29
29
|
}
|
|
30
|
+
/** One canonical decimal strictly greater than zero, such as a tolerance. */
|
|
31
|
+
export const PositiveDecimalSchema = DecimalSchema.check(Schema.makeFilter(isPositiveDecimal, {
|
|
32
|
+
message: "Expected a positive tolerance.",
|
|
33
|
+
}));
|
|
30
34
|
/**
|
|
31
35
|
* Largest accepted distance from the exact value, inclusive. An absolute
|
|
32
36
|
* tolerance `t` accepts `|answer - value| <= t`. A relative tolerance `r`
|
|
@@ -35,9 +39,7 @@ function isPositiveDecimal(value) {
|
|
|
35
39
|
*/
|
|
36
40
|
export const ToleranceSchema = Schema.Struct({
|
|
37
41
|
kind: Schema.Literals(["absolute", "relative"]),
|
|
38
|
-
value:
|
|
39
|
-
message: "Expected a positive tolerance.",
|
|
40
|
-
})),
|
|
42
|
+
value: PositiveDecimalSchema,
|
|
41
43
|
}).check(Schema.makeFilter(({ kind, value }) => kind === "absolute" || value.startsWith("0."), { message: "Expected a relative tolerance below one." }));
|
|
42
44
|
/**
|
|
43
45
|
* Deterministic numeric answer key. A learner number, read by
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Array as Arr, Effect, HashMap, HashSet, Option, Result, Schema, Stream, } from "effect";
|
|
2
|
+
import { hasKeyedRubrics } from "#contracts/assessment/fit";
|
|
2
3
|
import { catalogLocaleBreach } from "#contracts/assessment/locales";
|
|
3
4
|
import { verifyPaperPlaces, verifyPaperStimuli, } from "#contracts/assessment/paper";
|
|
4
5
|
import { explanationIdentity, indexRows, placedHashes, stimulusIdentity, } from "#contracts/assessment/rows";
|
|
@@ -81,7 +82,7 @@ const verifyItems = Effect.fn("AksaraContracts.verifyAssessmentItems")(function*
|
|
|
81
82
|
yield* require(Option.exists(family, ({ stimulus }) => stimulus === version.stimulus?.id), "family", version.family);
|
|
82
83
|
yield* require(version.stimulus === undefined ||
|
|
83
84
|
HashSet.has(rows.stimuli, stimulusIdentity(version.stimulus)), "stimulus", version.family);
|
|
84
|
-
yield* require(HashMap.
|
|
85
|
+
yield* require(Option.exists(HashMap.get(rows.keys, version.hash), (key) => hasKeyedRubrics(version, key)), "key", version.hash);
|
|
85
86
|
yield* require(HashSet.has(placed, version.hash), "unplaced", version.hash);
|
|
86
87
|
}
|
|
87
88
|
for (const identity of requiredExplanations(rows)) {
|
package/dist/assessment/fit.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AssessmentDocument } from "#contracts/assessment/document";
|
|
2
2
|
import type { Interaction } from "#contracts/assessment/interaction";
|
|
3
|
+
import type { InteractionKey } from "#contracts/assessment/key";
|
|
3
4
|
import type { ScoringOverride } from "#contracts/assessment/scoring";
|
|
4
5
|
/**
|
|
5
6
|
* Checks that the interactions of a version and its prompt agree: each
|
|
@@ -12,10 +13,23 @@ export declare function hasPlacedInteractions(version: {
|
|
|
12
13
|
}): boolean;
|
|
13
14
|
/**
|
|
14
15
|
* Checks the scoring rules that a version sets itself: each names one of its
|
|
15
|
-
* interactions once, and fits its kind. An extended text
|
|
16
|
-
* must carry its rubric.
|
|
16
|
+
* interactions once, and fits its kind. An extended text and a sketch have no
|
|
17
|
+
* default, so each must carry its rubric.
|
|
17
18
|
*/
|
|
18
19
|
export declare function hasFittingRules(version: {
|
|
19
20
|
readonly interactions: readonly Interaction[];
|
|
20
21
|
readonly scoring: readonly ScoringOverride[];
|
|
21
22
|
}): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Checks that a version's key and its rubrics meet: the key answers every
|
|
25
|
+
* sketch of the version, and each sketch it answers is scored by a rubric of
|
|
26
|
+
* the version with exactly the key's criteria, so no feature is worth no points
|
|
27
|
+
* and no points go unchecked. It is the check where a key and its version's
|
|
28
|
+
* scoring meet, so it needs both records.
|
|
29
|
+
*/
|
|
30
|
+
export declare function hasKeyedRubrics(version: {
|
|
31
|
+
readonly interactions: readonly Interaction[];
|
|
32
|
+
readonly scoring: readonly ScoringOverride[];
|
|
33
|
+
}, key: {
|
|
34
|
+
readonly answers: readonly InteractionKey[];
|
|
35
|
+
}): boolean;
|
package/dist/assessment/fit.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Array as Arr, HashSet } from "effect";
|
|
1
|
+
import { Array as Arr, Equal, HashSet } from "effect";
|
|
2
2
|
import { documentPlacements } from "#contracts/assessment/document";
|
|
3
3
|
import { hasDistinctIds, hasUniqueIds } from "#contracts/assessment/identity";
|
|
4
4
|
import { canSitInText } from "#contracts/assessment/interaction";
|
|
5
|
-
import { supportsRule } from "#contracts/assessment/scoring";
|
|
5
|
+
import { supportsRule, takesRubric } from "#contracts/assessment/scoring";
|
|
6
6
|
/**
|
|
7
7
|
* Checks that the prompt places one interaction where its kind belongs: a
|
|
8
8
|
* field exactly once, in text or as a block; a gap match once for each gap, in
|
|
@@ -32,11 +32,29 @@ export function hasPlacedInteractions(version) {
|
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* Checks the scoring rules that a version sets itself: each names one of its
|
|
35
|
-
* interactions once, and fits its kind. An extended text
|
|
36
|
-
* must carry its rubric.
|
|
35
|
+
* interactions once, and fits its kind. An extended text and a sketch have no
|
|
36
|
+
* default, so each must carry its rubric.
|
|
37
37
|
*/
|
|
38
38
|
export function hasFittingRules(version) {
|
|
39
39
|
return (hasDistinctIds(Arr.map(version.scoring, ({ interaction }) => interaction)) &&
|
|
40
40
|
Arr.every(version.scoring, ({ interaction, rule }) => Arr.some(version.interactions, (candidate) => candidate.id === interaction && supportsRule(candidate.kind, rule))) &&
|
|
41
|
-
Arr.every(Arr.filter(version.interactions, ({ kind }) => kind
|
|
41
|
+
Arr.every(Arr.filter(version.interactions, ({ kind }) => takesRubric(kind)), ({ id }) => Arr.some(version.scoring, ({ interaction, rule }) => interaction === id && rule.kind === "rubric")));
|
|
42
|
+
}
|
|
43
|
+
/** Checks that two lists name the same identifiers, in any order. */
|
|
44
|
+
function sameIds(left, right) {
|
|
45
|
+
return Equal.equals(HashSet.fromIterable(left), HashSet.fromIterable(right));
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Checks that a version's key and its rubrics meet: the key answers every
|
|
49
|
+
* sketch of the version, and each sketch it answers is scored by a rubric of
|
|
50
|
+
* the version with exactly the key's criteria, so no feature is worth no points
|
|
51
|
+
* and no points go unchecked. It is the check where a key and its version's
|
|
52
|
+
* scoring meet, so it needs both records.
|
|
53
|
+
*/
|
|
54
|
+
export function hasKeyedRubrics(version, key) {
|
|
55
|
+
return (Arr.every(Arr.filter(version.interactions, ({ kind }) => kind === "sketch"), ({ id }) => Arr.some(key.answers, (answer) => answer.kind === "sketch" && answer.interaction === id)) &&
|
|
56
|
+
Arr.every(key.answers, (answer) => answer.kind !== "sketch" ||
|
|
57
|
+
Arr.some(version.scoring, ({ interaction, rule }) => interaction === answer.interaction &&
|
|
58
|
+
rule.kind === "rubric" &&
|
|
59
|
+
sameIds(Arr.map(rule.criteria, ({ id }) => id), Arr.map(answer.criteria, ({ criterion }) => criterion)))));
|
|
42
60
|
}
|
|
@@ -93,3 +93,30 @@ export declare const GraphPointInteractionSchema: Schema.Struct<{
|
|
|
93
93
|
readonly placing: Schema.Literals<readonly ["points", "lines"]>;
|
|
94
94
|
readonly snap: Schema.optionalKey<Schema.Finite>;
|
|
95
95
|
}>;
|
|
96
|
+
/**
|
|
97
|
+
* Sketch the graph of a function on a plane of Cartesian axes, in one stroke or
|
|
98
|
+
* more, and place what the item asks for besides: points, such as zeros,
|
|
99
|
+
* intercepts and turning points, and asymptotes as lines. `frame` is the view
|
|
100
|
+
* the plane opens on, and the learner may pan and zoom past it; `grid`, when
|
|
101
|
+
* present, is the step of its grid lines. The features the graph must show are
|
|
102
|
+
* in the key. QTI has no interaction for a drawn graph, so it maps to
|
|
103
|
+
* `qti-portable-custom-interaction`.
|
|
104
|
+
*/
|
|
105
|
+
export declare const SketchInteractionSchema: Schema.Struct<{
|
|
106
|
+
readonly id: Schema.String;
|
|
107
|
+
readonly label: Schema.Trimmed;
|
|
108
|
+
readonly frame: Schema.Struct<{
|
|
109
|
+
readonly kind: Schema.Literal<"cartesian">;
|
|
110
|
+
readonly x: Schema.Struct<{
|
|
111
|
+
readonly max: Schema.Finite;
|
|
112
|
+
readonly min: Schema.Finite;
|
|
113
|
+
}>;
|
|
114
|
+
readonly y: Schema.Struct<{
|
|
115
|
+
readonly max: Schema.Finite;
|
|
116
|
+
readonly min: Schema.Finite;
|
|
117
|
+
}>;
|
|
118
|
+
}>;
|
|
119
|
+
readonly grid: Schema.optionalKey<Schema.Finite>;
|
|
120
|
+
readonly kind: Schema.Literal<"sketch">;
|
|
121
|
+
readonly marks: Schema.$Array<Schema.Literals<readonly ["asymptote", "point"]>>;
|
|
122
|
+
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Schema } from "effect";
|
|
1
|
+
import { HashSet, Schema } from "effect";
|
|
2
2
|
import { ImageSchema } from "#contracts/assessment/figure";
|
|
3
3
|
import { hasUniqueIds, LocalIdSchema } from "#contracts/assessment/identity";
|
|
4
4
|
import { hasSelectionBounds, InteractionFields, } from "#contracts/assessment/part";
|
|
@@ -104,3 +104,19 @@ export const GraphPointInteractionSchema = Schema.Struct({
|
|
|
104
104
|
placing: Schema.Literals(["points", "lines"]),
|
|
105
105
|
snap: Schema.optionalKey(PositiveMeasureSchema),
|
|
106
106
|
});
|
|
107
|
+
/**
|
|
108
|
+
* Sketch the graph of a function on a plane of Cartesian axes, in one stroke or
|
|
109
|
+
* more, and place what the item asks for besides: points, such as zeros,
|
|
110
|
+
* intercepts and turning points, and asymptotes as lines. `frame` is the view
|
|
111
|
+
* the plane opens on, and the learner may pan and zoom past it; `grid`, when
|
|
112
|
+
* present, is the step of its grid lines. The features the graph must show are
|
|
113
|
+
* in the key. QTI has no interaction for a drawn graph, so it maps to
|
|
114
|
+
* `qti-portable-custom-interaction`.
|
|
115
|
+
*/
|
|
116
|
+
export const SketchInteractionSchema = Schema.Struct({
|
|
117
|
+
...InteractionFields,
|
|
118
|
+
frame: PlaneMathFrameSchema,
|
|
119
|
+
grid: Schema.optionalKey(PositiveMeasureSchema),
|
|
120
|
+
kind: Schema.Literal("sketch"),
|
|
121
|
+
marks: Schema.Array(Schema.Literals(["asymptote", "point"])).check(Schema.makeFilter((marks) => HashSet.size(HashSet.fromIterable(marks)) === marks.length, { message: "Expected each kind of mark once." })),
|
|
122
|
+
});
|
|
@@ -410,6 +410,23 @@ export declare const hashItemVersion: (body: Omit<{
|
|
|
410
410
|
readonly kind: "graphPoint";
|
|
411
411
|
readonly placing: "lines" | "points";
|
|
412
412
|
readonly snap?: number;
|
|
413
|
+
} | {
|
|
414
|
+
readonly id: string;
|
|
415
|
+
readonly label: string;
|
|
416
|
+
readonly frame: {
|
|
417
|
+
readonly kind: "cartesian";
|
|
418
|
+
readonly x: {
|
|
419
|
+
readonly max: number;
|
|
420
|
+
readonly min: number;
|
|
421
|
+
};
|
|
422
|
+
readonly y: {
|
|
423
|
+
readonly max: number;
|
|
424
|
+
readonly min: number;
|
|
425
|
+
};
|
|
426
|
+
};
|
|
427
|
+
readonly grid?: number;
|
|
428
|
+
readonly kind: "sketch";
|
|
429
|
+
readonly marks: readonly ("asymptote" | "point")[];
|
|
413
430
|
}, ...({
|
|
414
431
|
readonly id: string;
|
|
415
432
|
readonly label: string;
|
|
@@ -799,6 +816,23 @@ export declare const hashItemVersion: (body: Omit<{
|
|
|
799
816
|
readonly kind: "graphPoint";
|
|
800
817
|
readonly placing: "lines" | "points";
|
|
801
818
|
readonly snap?: number;
|
|
819
|
+
} | {
|
|
820
|
+
readonly id: string;
|
|
821
|
+
readonly label: string;
|
|
822
|
+
readonly frame: {
|
|
823
|
+
readonly kind: "cartesian";
|
|
824
|
+
readonly x: {
|
|
825
|
+
readonly max: number;
|
|
826
|
+
readonly min: number;
|
|
827
|
+
};
|
|
828
|
+
readonly y: {
|
|
829
|
+
readonly max: number;
|
|
830
|
+
readonly min: number;
|
|
831
|
+
};
|
|
832
|
+
};
|
|
833
|
+
readonly grid?: number;
|
|
834
|
+
readonly kind: "sketch";
|
|
835
|
+
readonly marks: readonly ("asymptote" | "point")[];
|
|
802
836
|
})[]];
|
|
803
837
|
readonly joint?: {
|
|
804
838
|
readonly levels: readonly [{
|
|
@@ -891,7 +925,7 @@ export declare const hashExamProfile: (profile: {
|
|
|
891
925
|
readonly seconds: number;
|
|
892
926
|
}[];
|
|
893
927
|
readonly defaults: readonly {
|
|
894
|
-
readonly interaction: "choice" | "extendedText" | "gapMatch" | "graphPoint" | "hotspot" | "inlineChoice" | "match" | "mathEntry" | "matrix" | "numericEntry" | "order" | "textEntry";
|
|
928
|
+
readonly interaction: "choice" | "extendedText" | "gapMatch" | "graphPoint" | "hotspot" | "inlineChoice" | "match" | "mathEntry" | "matrix" | "numericEntry" | "order" | "sketch" | "textEntry";
|
|
895
929
|
readonly rule: {
|
|
896
930
|
readonly kind: "allOrNothing";
|
|
897
931
|
} | {
|
|
@@ -950,7 +984,7 @@ export declare const hashExamProfile: (profile: {
|
|
|
950
984
|
};
|
|
951
985
|
readonly sections: readonly [{
|
|
952
986
|
readonly id: string;
|
|
953
|
-
readonly interactions: readonly ["choice" | "extendedText" | "gapMatch" | "graphPoint" | "hotspot" | "inlineChoice" | "match" | "mathEntry" | "matrix" | "numericEntry" | "order" | "textEntry", ...("choice" | "extendedText" | "gapMatch" | "graphPoint" | "hotspot" | "inlineChoice" | "match" | "mathEntry" | "matrix" | "numericEntry" | "order" | "textEntry")[]];
|
|
987
|
+
readonly interactions: readonly ["choice" | "extendedText" | "gapMatch" | "graphPoint" | "hotspot" | "inlineChoice" | "match" | "mathEntry" | "matrix" | "numericEntry" | "order" | "sketch" | "textEntry", ...("choice" | "extendedText" | "gapMatch" | "graphPoint" | "hotspot" | "inlineChoice" | "match" | "mathEntry" | "matrix" | "numericEntry" | "order" | "sketch" | "textEntry")[]];
|
|
954
988
|
readonly items: number;
|
|
955
989
|
readonly names: {
|
|
956
990
|
readonly de: string;
|
|
@@ -963,7 +997,7 @@ export declare const hashExamProfile: (profile: {
|
|
|
963
997
|
readonly tools: readonly ("calculator-basic" | "calculator-graphing" | "calculator-scientific" | "formula-sheet" | "hide-timer" | "highlighter" | "line-reader" | "mark-for-review" | "notes" | "option-eliminator" | "text-to-speech" | "zoom")[];
|
|
964
998
|
}, ...{
|
|
965
999
|
readonly id: string;
|
|
966
|
-
readonly interactions: readonly ["choice" | "extendedText" | "gapMatch" | "graphPoint" | "hotspot" | "inlineChoice" | "match" | "mathEntry" | "matrix" | "numericEntry" | "order" | "textEntry", ...("choice" | "extendedText" | "gapMatch" | "graphPoint" | "hotspot" | "inlineChoice" | "match" | "mathEntry" | "matrix" | "numericEntry" | "order" | "textEntry")[]];
|
|
1000
|
+
readonly interactions: readonly ["choice" | "extendedText" | "gapMatch" | "graphPoint" | "hotspot" | "inlineChoice" | "match" | "mathEntry" | "matrix" | "numericEntry" | "order" | "sketch" | "textEntry", ...("choice" | "extendedText" | "gapMatch" | "graphPoint" | "hotspot" | "inlineChoice" | "match" | "mathEntry" | "matrix" | "numericEntry" | "order" | "sketch" | "textEntry")[]];
|
|
967
1001
|
readonly items: number;
|
|
968
1002
|
readonly names: {
|
|
969
1003
|
readonly de: string;
|
|
@@ -1431,6 +1465,23 @@ export declare const verifyItemVersion: (version: {
|
|
|
1431
1465
|
readonly kind: "graphPoint";
|
|
1432
1466
|
readonly placing: "lines" | "points";
|
|
1433
1467
|
readonly snap?: number;
|
|
1468
|
+
} | {
|
|
1469
|
+
readonly id: string;
|
|
1470
|
+
readonly label: string;
|
|
1471
|
+
readonly frame: {
|
|
1472
|
+
readonly kind: "cartesian";
|
|
1473
|
+
readonly x: {
|
|
1474
|
+
readonly max: number;
|
|
1475
|
+
readonly min: number;
|
|
1476
|
+
};
|
|
1477
|
+
readonly y: {
|
|
1478
|
+
readonly max: number;
|
|
1479
|
+
readonly min: number;
|
|
1480
|
+
};
|
|
1481
|
+
};
|
|
1482
|
+
readonly grid?: number;
|
|
1483
|
+
readonly kind: "sketch";
|
|
1484
|
+
readonly marks: readonly ("asymptote" | "point")[];
|
|
1434
1485
|
}, ...({
|
|
1435
1486
|
readonly id: string;
|
|
1436
1487
|
readonly label: string;
|
|
@@ -1820,6 +1871,23 @@ export declare const verifyItemVersion: (version: {
|
|
|
1820
1871
|
readonly kind: "graphPoint";
|
|
1821
1872
|
readonly placing: "lines" | "points";
|
|
1822
1873
|
readonly snap?: number;
|
|
1874
|
+
} | {
|
|
1875
|
+
readonly id: string;
|
|
1876
|
+
readonly label: string;
|
|
1877
|
+
readonly frame: {
|
|
1878
|
+
readonly kind: "cartesian";
|
|
1879
|
+
readonly x: {
|
|
1880
|
+
readonly max: number;
|
|
1881
|
+
readonly min: number;
|
|
1882
|
+
};
|
|
1883
|
+
readonly y: {
|
|
1884
|
+
readonly max: number;
|
|
1885
|
+
readonly min: number;
|
|
1886
|
+
};
|
|
1887
|
+
};
|
|
1888
|
+
readonly grid?: number;
|
|
1889
|
+
readonly kind: "sketch";
|
|
1890
|
+
readonly marks: readonly ("asymptote" | "point")[];
|
|
1823
1891
|
})[]];
|
|
1824
1892
|
readonly joint?: {
|
|
1825
1893
|
readonly levels: readonly [{
|
|
@@ -212,13 +212,30 @@ export declare const InteractionSchema: Schema.Union<readonly [Schema.Struct<{
|
|
|
212
212
|
readonly label: Schema.Trimmed;
|
|
213
213
|
readonly expectedLines: Schema.optionalKey<Schema.Int>;
|
|
214
214
|
readonly kind: Schema.Literal<"extendedText">;
|
|
215
|
+
}>, Schema.Struct<{
|
|
216
|
+
readonly id: Schema.String;
|
|
217
|
+
readonly label: Schema.Trimmed;
|
|
218
|
+
readonly frame: Schema.Struct<{
|
|
219
|
+
readonly kind: Schema.Literal<"cartesian">;
|
|
220
|
+
readonly x: Schema.Struct<{
|
|
221
|
+
readonly max: Schema.Finite;
|
|
222
|
+
readonly min: Schema.Finite;
|
|
223
|
+
}>;
|
|
224
|
+
readonly y: Schema.Struct<{
|
|
225
|
+
readonly max: Schema.Finite;
|
|
226
|
+
readonly min: Schema.Finite;
|
|
227
|
+
}>;
|
|
228
|
+
}>;
|
|
229
|
+
readonly grid: Schema.optionalKey<Schema.Finite>;
|
|
230
|
+
readonly kind: Schema.Literal<"sketch">;
|
|
231
|
+
readonly marks: Schema.$Array<Schema.Literals<readonly ["asymptote", "point"]>>;
|
|
215
232
|
}>]>;
|
|
216
233
|
export type Interaction = typeof InteractionSchema.Type;
|
|
217
234
|
/**
|
|
218
235
|
* The kind of an interaction. It is read from the union itself, so a new
|
|
219
236
|
* interaction adds its kind here and nowhere else.
|
|
220
237
|
*/
|
|
221
|
-
export declare const InteractionKindSchema: Schema.Union<[Schema.Literal<"choice"> | Schema.Literal<"extendedText"> | Schema.Literal<"gapMatch"> | Schema.Literal<"graphPoint"> | Schema.Literal<"hotspot"> | Schema.Literal<"inlineChoice"> | Schema.Literal<"match"> | Schema.Literal<"mathEntry"> | Schema.Literal<"matrix"> | Schema.Literal<"numericEntry"> | Schema.Literal<"order"> | Schema.Literal<"textEntry">, ...(Schema.Literal<"choice"> | Schema.Literal<"extendedText"> | Schema.Literal<"gapMatch"> | Schema.Literal<"graphPoint"> | Schema.Literal<"hotspot"> | Schema.Literal<"inlineChoice"> | Schema.Literal<"match"> | Schema.Literal<"mathEntry"> | Schema.Literal<"matrix"> | Schema.Literal<"numericEntry"> | Schema.Literal<"order"> | Schema.Literal<"textEntry">)[]]>;
|
|
238
|
+
export declare const InteractionKindSchema: Schema.Union<[Schema.Literal<"choice"> | Schema.Literal<"extendedText"> | Schema.Literal<"gapMatch"> | Schema.Literal<"graphPoint"> | Schema.Literal<"hotspot"> | Schema.Literal<"inlineChoice"> | Schema.Literal<"match"> | Schema.Literal<"mathEntry"> | Schema.Literal<"matrix"> | Schema.Literal<"numericEntry"> | Schema.Literal<"order"> | Schema.Literal<"sketch"> | Schema.Literal<"textEntry">, ...(Schema.Literal<"choice"> | Schema.Literal<"extendedText"> | Schema.Literal<"gapMatch"> | Schema.Literal<"graphPoint"> | Schema.Literal<"hotspot"> | Schema.Literal<"inlineChoice"> | Schema.Literal<"match"> | Schema.Literal<"mathEntry"> | Schema.Literal<"matrix"> | Schema.Literal<"numericEntry"> | Schema.Literal<"order"> | Schema.Literal<"sketch"> | Schema.Literal<"textEntry">)[]]>;
|
|
222
239
|
export type InteractionKind = typeof InteractionKindSchema.Type;
|
|
223
240
|
/**
|
|
224
241
|
* Checks that an interaction of this kind may sit inside a line of text, as a
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Array as Arr, Match, Schema } from "effect";
|
|
2
2
|
import { ChoiceInteractionSchema, GapMatchInteractionSchema, InlineChoiceInteractionSchema, MatchInteractionSchema, MatrixInteractionSchema, OrderInteractionSchema, } from "#contracts/assessment/choice";
|
|
3
3
|
import { ExtendedTextInteractionSchema, MathEntryInteractionSchema, NumericEntryInteractionSchema, TextEntryInteractionSchema, } from "#contracts/assessment/entry";
|
|
4
|
-
import { GraphPointInteractionSchema, HotspotInteractionSchema, } from "#contracts/assessment/graphic";
|
|
4
|
+
import { GraphPointInteractionSchema, HotspotInteractionSchema, SketchInteractionSchema, } from "#contracts/assessment/graphic";
|
|
5
5
|
/**
|
|
6
6
|
* Every interaction of Assessment v2, aligned with QTI 3.0.1. An interaction
|
|
7
7
|
* holds what the learner sees and does, and never an answer key: the key is a
|
|
@@ -21,6 +21,7 @@ export const InteractionSchema = Schema.Union([
|
|
|
21
21
|
GapMatchInteractionSchema,
|
|
22
22
|
GraphPointInteractionSchema,
|
|
23
23
|
ExtendedTextInteractionSchema,
|
|
24
|
+
SketchInteractionSchema,
|
|
24
25
|
]);
|
|
25
26
|
/**
|
|
26
27
|
* The kind of an interaction. It is read from the union itself, so a new
|
|
@@ -250,6 +250,23 @@ export declare const ItemVersionBodySchema: Schema.Struct<{
|
|
|
250
250
|
readonly label: Schema.Trimmed;
|
|
251
251
|
readonly expectedLines: Schema.optionalKey<Schema.Int>;
|
|
252
252
|
readonly kind: Schema.Literal<"extendedText">;
|
|
253
|
+
}>, Schema.Struct<{
|
|
254
|
+
readonly id: Schema.String;
|
|
255
|
+
readonly label: Schema.Trimmed;
|
|
256
|
+
readonly frame: Schema.Struct<{
|
|
257
|
+
readonly kind: Schema.Literal<"cartesian">;
|
|
258
|
+
readonly x: Schema.Struct<{
|
|
259
|
+
readonly max: Schema.Finite;
|
|
260
|
+
readonly min: Schema.Finite;
|
|
261
|
+
}>;
|
|
262
|
+
readonly y: Schema.Struct<{
|
|
263
|
+
readonly max: Schema.Finite;
|
|
264
|
+
readonly min: Schema.Finite;
|
|
265
|
+
}>;
|
|
266
|
+
}>;
|
|
267
|
+
readonly grid: Schema.optionalKey<Schema.Finite>;
|
|
268
|
+
readonly kind: Schema.Literal<"sketch">;
|
|
269
|
+
readonly marks: Schema.$Array<Schema.Literals<readonly ["asymptote", "point"]>>;
|
|
253
270
|
}>]>>;
|
|
254
271
|
joint: Schema.optionalKey<Schema.Struct<{
|
|
255
272
|
readonly levels: Schema.NonEmptyArray<Schema.Struct<{
|
|
@@ -510,6 +527,23 @@ export declare const ItemVersionSchema: Schema.Struct<{
|
|
|
510
527
|
readonly label: Schema.Trimmed;
|
|
511
528
|
readonly expectedLines: Schema.optionalKey<Schema.Int>;
|
|
512
529
|
readonly kind: Schema.Literal<"extendedText">;
|
|
530
|
+
}>, Schema.Struct<{
|
|
531
|
+
readonly id: Schema.String;
|
|
532
|
+
readonly label: Schema.Trimmed;
|
|
533
|
+
readonly frame: Schema.Struct<{
|
|
534
|
+
readonly kind: Schema.Literal<"cartesian">;
|
|
535
|
+
readonly x: Schema.Struct<{
|
|
536
|
+
readonly max: Schema.Finite;
|
|
537
|
+
readonly min: Schema.Finite;
|
|
538
|
+
}>;
|
|
539
|
+
readonly y: Schema.Struct<{
|
|
540
|
+
readonly max: Schema.Finite;
|
|
541
|
+
readonly min: Schema.Finite;
|
|
542
|
+
}>;
|
|
543
|
+
}>;
|
|
544
|
+
readonly grid: Schema.optionalKey<Schema.Finite>;
|
|
545
|
+
readonly kind: Schema.Literal<"sketch">;
|
|
546
|
+
readonly marks: Schema.$Array<Schema.Literals<readonly ["asymptote", "point"]>>;
|
|
513
547
|
}>]>>;
|
|
514
548
|
readonly joint: Schema.optionalKey<Schema.Struct<{
|
|
515
549
|
readonly levels: Schema.NonEmptyArray<Schema.Struct<{
|
|
@@ -951,6 +985,23 @@ export declare function versionStructure({ interactions, joint, scoring, }: Pick
|
|
|
951
985
|
readonly kind: "graphPoint";
|
|
952
986
|
readonly placing: "lines" | "points";
|
|
953
987
|
readonly snap?: number;
|
|
988
|
+
} | {
|
|
989
|
+
readonly id: string;
|
|
990
|
+
readonly label: string;
|
|
991
|
+
readonly frame: {
|
|
992
|
+
readonly kind: "cartesian";
|
|
993
|
+
readonly x: {
|
|
994
|
+
readonly max: number;
|
|
995
|
+
readonly min: number;
|
|
996
|
+
};
|
|
997
|
+
readonly y: {
|
|
998
|
+
readonly max: number;
|
|
999
|
+
readonly min: number;
|
|
1000
|
+
};
|
|
1001
|
+
};
|
|
1002
|
+
readonly grid?: number;
|
|
1003
|
+
readonly kind: "sketch";
|
|
1004
|
+
readonly marks: readonly ("asymptote" | "point")[];
|
|
954
1005
|
}, ...({
|
|
955
1006
|
readonly id: string;
|
|
956
1007
|
readonly label: string;
|
|
@@ -1340,6 +1391,23 @@ export declare function versionStructure({ interactions, joint, scoring, }: Pick
|
|
|
1340
1391
|
readonly kind: "graphPoint";
|
|
1341
1392
|
readonly placing: "lines" | "points";
|
|
1342
1393
|
readonly snap?: number;
|
|
1394
|
+
} | {
|
|
1395
|
+
readonly id: string;
|
|
1396
|
+
readonly label: string;
|
|
1397
|
+
readonly frame: {
|
|
1398
|
+
readonly kind: "cartesian";
|
|
1399
|
+
readonly x: {
|
|
1400
|
+
readonly max: number;
|
|
1401
|
+
readonly min: number;
|
|
1402
|
+
};
|
|
1403
|
+
readonly y: {
|
|
1404
|
+
readonly max: number;
|
|
1405
|
+
readonly min: number;
|
|
1406
|
+
};
|
|
1407
|
+
};
|
|
1408
|
+
readonly grid?: number;
|
|
1409
|
+
readonly kind: "sketch";
|
|
1410
|
+
readonly marks: readonly ("asymptote" | "point")[];
|
|
1343
1411
|
})[]];
|
|
1344
1412
|
joint: {
|
|
1345
1413
|
levels: [{
|
|
@@ -1615,6 +1683,23 @@ export declare const ItemSchema: Schema.Struct<{
|
|
|
1615
1683
|
readonly label: Schema.Trimmed;
|
|
1616
1684
|
readonly expectedLines: Schema.optionalKey<Schema.Int>;
|
|
1617
1685
|
readonly kind: Schema.Literal<"extendedText">;
|
|
1686
|
+
}>, Schema.Struct<{
|
|
1687
|
+
readonly id: Schema.String;
|
|
1688
|
+
readonly label: Schema.Trimmed;
|
|
1689
|
+
readonly frame: Schema.Struct<{
|
|
1690
|
+
readonly kind: Schema.Literal<"cartesian">;
|
|
1691
|
+
readonly x: Schema.Struct<{
|
|
1692
|
+
readonly max: Schema.Finite;
|
|
1693
|
+
readonly min: Schema.Finite;
|
|
1694
|
+
}>;
|
|
1695
|
+
readonly y: Schema.Struct<{
|
|
1696
|
+
readonly max: Schema.Finite;
|
|
1697
|
+
readonly min: Schema.Finite;
|
|
1698
|
+
}>;
|
|
1699
|
+
}>;
|
|
1700
|
+
readonly grid: Schema.optionalKey<Schema.Finite>;
|
|
1701
|
+
readonly kind: Schema.Literal<"sketch">;
|
|
1702
|
+
readonly marks: Schema.$Array<Schema.Literals<readonly ["asymptote", "point"]>>;
|
|
1618
1703
|
}>]>>;
|
|
1619
1704
|
readonly joint: Schema.optionalKey<Schema.Struct<{
|
|
1620
1705
|
readonly levels: Schema.NonEmptyArray<Schema.Struct<{
|
package/dist/assessment/item.js
CHANGED
|
@@ -57,7 +57,7 @@ const VersionFields = {
|
|
|
57
57
|
export const ItemVersionBodySchema = Schema.Struct(VersionFields).check(Schema.makeFilter(hasPlacedInteractions, {
|
|
58
58
|
message: "Expected the prompt to place each interaction once, as its kind allows, and no other.",
|
|
59
59
|
}), Schema.makeFilter(hasFittingRules, {
|
|
60
|
-
message: "Expected each scoring rule to fit its interaction, and each extended text to carry a rubric.",
|
|
60
|
+
message: "Expected each scoring rule to fit its interaction, and each extended text and sketch to carry a rubric.",
|
|
61
61
|
}), Schema.makeFilter(hasJointParts, {
|
|
62
62
|
message: "Expected a joint rule to name at least two interactions of the version, each level naming only those.",
|
|
63
63
|
}), Schema.makeFilter(hasOneItemRule, {
|
|
@@ -52,9 +52,10 @@ export declare function hasJointParts(version: {
|
|
|
52
52
|
}): boolean;
|
|
53
53
|
/**
|
|
54
54
|
* Checks that a version with a joint rule sets no scoring override: one rule
|
|
55
|
-
* scores the item. This also refuses an extended text in a joint
|
|
56
|
-
*
|
|
57
|
-
*
|
|
55
|
+
* scores the item. This also refuses an extended text or a sketch in a joint
|
|
56
|
+
* item, because each needs a rubric override (`fit`), and a joint item has
|
|
57
|
+
* none. No key can say that either is correct as a whole: each earns its
|
|
58
|
+
* criteria one by one.
|
|
58
59
|
*/
|
|
59
60
|
export declare function hasOneItemRule(version: {
|
|
60
61
|
readonly joint?: JointRule;
|
package/dist/assessment/joint.js
CHANGED
|
@@ -76,9 +76,10 @@ export function hasJointParts(version) {
|
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
78
|
* Checks that a version with a joint rule sets no scoring override: one rule
|
|
79
|
-
* scores the item. This also refuses an extended text in a joint
|
|
80
|
-
*
|
|
81
|
-
*
|
|
79
|
+
* scores the item. This also refuses an extended text or a sketch in a joint
|
|
80
|
+
* item, because each needs a rubric override (`fit`), and a joint item has
|
|
81
|
+
* none. No key can say that either is correct as a whole: each earns its
|
|
82
|
+
* criteria one by one.
|
|
82
83
|
*/
|
|
83
84
|
export function hasOneItemRule(version) {
|
|
84
85
|
return version.joint === undefined || version.scoring.length === 0;
|