@nakafa/aksara-contracts 0.43.0 → 0.45.0
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/README.md +22 -1
- package/dist/math/resolution.js +1 -1
- package/dist/math/scene.js +1 -1
- package/dist/preview/artifact.d.ts +44 -0
- package/dist/preview/document.d.ts +36 -12
- package/dist/preview/spec.d.ts +196 -36
- package/dist/preview/target.d.ts +10 -3
- package/dist/program/snapshot/digest.d.ts +1 -1
- package/dist/program/snapshot/digest.js +1 -1
- package/dist/program/snapshot/hash.d.ts +153 -0
- package/dist/program/snapshot/hash.js +31 -0
- package/dist/projection/digest.d.ts +74 -22
- package/dist/projection/material.d.ts +10 -0
- package/dist/projection/material.js +15 -0
- package/dist/projection/question.d.ts +188 -0
- package/dist/projection/spec.d.ts +45 -0
- package/dist/projection/verify.d.ts +127 -75
- package/dist/question/answer.d.ts +149 -0
- package/dist/question/answer.js +248 -0
- package/dist/question/item.d.ts +276 -1
- package/dist/question/item.js +63 -38
- package/dist/question/label.d.ts +3 -0
- package/dist/question/label.js +3 -0
- package/dist/question/points.d.ts +18 -0
- package/dist/question/points.js +22 -0
- package/dist/question/response.d.ts +187 -5
- package/dist/question/response.js +41 -4
- package/dist/question/rubric.d.ts +234 -0
- package/dist/question/rubric.js +182 -0
- package/dist/release/rollback/spec.d.ts +264 -0
- package/dist/release/snapshot/data.d.ts +52 -3
- package/dist/release/snapshot/{program-evidence.d.ts → evidence/program.d.ts} +2 -2
- package/dist/release/snapshot/{program-evidence.js → evidence/program.js} +1 -1
- package/dist/release/snapshot/{quran-evidence.d.ts → evidence/quran.d.ts} +2 -2
- package/dist/release/snapshot/{quran-evidence.js → evidence/quran.js} +1 -1
- package/dist/release/snapshot/{tryout-evidence.d.ts → evidence/tryout.d.ts} +2 -2
- package/dist/release/snapshot/{tryout-evidence.js → evidence/tryout.js} +4 -4
- package/dist/release/snapshot/evidence.d.ts +2 -2
- package/dist/release/snapshot/evidence.js +3 -3
- package/dist/release/snapshot/verify.d.ts +88 -31
- package/dist/runtime/spec.d.ts +25 -22
- package/dist/runtime/verify.d.ts +46 -44
- package/dist/transport/batch.d.ts +88 -0
- package/dist/transport/group.d.ts +288 -9
- package/dist/transport/request.d.ts +1858 -1018
- package/dist/transport/response.d.ts +499 -131
- package/dist/transport/snapshot.d.ts +104 -6
- package/dist/tryout/catalog.d.ts +28 -10
- package/dist/tryout/catalog.js +6 -2
- package/dist/tryout/closure/accounting.d.ts +16 -0
- package/dist/tryout/closure/accounting.js +68 -0
- package/dist/tryout/closure/locale.d.ts +14 -0
- package/dist/tryout/{locale-closure.js → closure/locale.js} +13 -72
- package/dist/tryout/{placement-closure.js → closure/placement.js} +1 -0
- package/dist/tryout/{catalog-hash.d.ts → hash/catalog.d.ts} +25 -20
- package/dist/tryout/{catalog-hash.js → hash/catalog.js} +8 -1
- package/dist/tryout/{content-hash.d.ts → hash/content.d.ts} +43 -0
- package/dist/tryout/{placement-hash.d.ts → hash/placement.d.ts} +1 -1
- package/dist/tryout/{placement-hash.js → hash/placement.js} +2 -1
- package/dist/tryout/placement.d.ts +136 -1
- package/dist/tryout/placement.js +16 -2
- package/dist/tryout/scoring.d.ts +37 -0
- package/dist/tryout/scoring.js +89 -0
- package/dist/tryout/spec.d.ts +32 -4
- package/dist/tryout/spec.js +35 -4
- package/package.json +28 -20
- package/dist/program/snapshot/row-hash.d.ts +0 -155
- package/dist/program/snapshot/row-hash.js +0 -34
- package/dist/tryout/locale-closure.d.ts +0 -20
- /package/dist/math/{arc-precision.d.ts → arc.d.ts} +0 -0
- /package/dist/math/{arc-precision.js → arc.js} +0 -0
- /package/dist/release/snapshot/{evidence-requirement.d.ts → evidence/requirement.d.ts} +0 -0
- /package/dist/release/snapshot/{evidence-requirement.js → evidence/requirement.js} +0 -0
- /package/dist/tryout/{placement-closure.d.ts → closure/placement.d.ts} +0 -0
- /package/dist/tryout/{row-hash.d.ts → digest.d.ts} +0 -0
- /package/dist/tryout/{row-hash.js → digest.js} +0 -0
- /package/dist/tryout/{content-hash.js → hash/content.js} +0 -0
|
@@ -34,16 +34,15 @@ export declare const digestTryoutCatalog: <E, R>(records: Stream.Stream<{
|
|
|
34
34
|
readonly title: string;
|
|
35
35
|
readonly countryKey: string;
|
|
36
36
|
readonly examKey: string;
|
|
37
|
-
readonly kind: "
|
|
37
|
+
readonly kind: "track";
|
|
38
38
|
readonly order: number;
|
|
39
|
-
readonly publicPath
|
|
39
|
+
readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
|
|
40
40
|
readonly questionCount: number;
|
|
41
|
-
readonly
|
|
42
|
-
readonly
|
|
43
|
-
readonly setKey: string;
|
|
44
|
-
readonly timeLimitSeconds: number;
|
|
41
|
+
readonly sectionCount: number;
|
|
42
|
+
readonly setCount: number;
|
|
45
43
|
readonly trackKey: string;
|
|
46
|
-
readonly
|
|
44
|
+
readonly trackKind: "institution" | "subject" | "year";
|
|
45
|
+
readonly visibleSectionCount: number;
|
|
47
46
|
} | {
|
|
48
47
|
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
49
48
|
readonly description?: string | undefined;
|
|
@@ -63,7 +62,7 @@ export declare const digestTryoutCatalog: <E, R>(records: Stream.Stream<{
|
|
|
63
62
|
readonly order: number;
|
|
64
63
|
readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
|
|
65
64
|
readonly questionCount: number;
|
|
66
|
-
readonly scoringStrategy: "irt" | "raw";
|
|
65
|
+
readonly scoringStrategy: "irt" | "penalized" | "raw";
|
|
67
66
|
readonly sectionCount: number;
|
|
68
67
|
readonly setKey: string;
|
|
69
68
|
readonly trackKey: string;
|
|
@@ -82,15 +81,21 @@ export declare const digestTryoutCatalog: <E, R>(records: Stream.Stream<{
|
|
|
82
81
|
readonly title: string;
|
|
83
82
|
readonly countryKey: string;
|
|
84
83
|
readonly examKey: string;
|
|
85
|
-
readonly kind: "
|
|
84
|
+
readonly kind: "section";
|
|
85
|
+
readonly marks?: {
|
|
86
|
+
readonly blank: number;
|
|
87
|
+
readonly correct: number;
|
|
88
|
+
readonly wrong: number;
|
|
89
|
+
};
|
|
86
90
|
readonly order: number;
|
|
87
|
-
readonly publicPath
|
|
91
|
+
readonly publicPath?: (string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">) | undefined;
|
|
88
92
|
readonly questionCount: number;
|
|
89
|
-
readonly
|
|
90
|
-
readonly
|
|
93
|
+
readonly questionSourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraCorpusSourcePath">;
|
|
94
|
+
readonly sectionKey: string;
|
|
95
|
+
readonly setKey: string;
|
|
96
|
+
readonly timeLimitSeconds: number;
|
|
91
97
|
readonly trackKey: string;
|
|
92
|
-
readonly
|
|
93
|
-
readonly visibleSectionCount: number;
|
|
98
|
+
readonly visibility: "internal-entry" | "visible";
|
|
94
99
|
} | {
|
|
95
100
|
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
96
101
|
readonly description?: string | undefined;
|
|
@@ -103,12 +108,11 @@ export declare const digestTryoutCatalog: <E, R>(records: Stream.Stream<{
|
|
|
103
108
|
};
|
|
104
109
|
readonly sourceRevision: string;
|
|
105
110
|
readonly title: string;
|
|
111
|
+
readonly countryCode: string;
|
|
106
112
|
readonly countryKey: string;
|
|
107
|
-
readonly
|
|
108
|
-
readonly kind: "exam";
|
|
113
|
+
readonly kind: "country";
|
|
109
114
|
readonly order: number;
|
|
110
115
|
readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
|
|
111
|
-
readonly scoringStrategy: "irt" | "raw";
|
|
112
116
|
} | {
|
|
113
117
|
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
114
118
|
readonly description?: string | undefined;
|
|
@@ -121,14 +125,15 @@ export declare const digestTryoutCatalog: <E, R>(records: Stream.Stream<{
|
|
|
121
125
|
};
|
|
122
126
|
readonly sourceRevision: string;
|
|
123
127
|
readonly title: string;
|
|
124
|
-
readonly countryCode: string;
|
|
125
128
|
readonly countryKey: string;
|
|
126
|
-
readonly
|
|
129
|
+
readonly examKey: string;
|
|
130
|
+
readonly kind: "exam";
|
|
127
131
|
readonly order: number;
|
|
128
132
|
readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
|
|
133
|
+
readonly scoringStrategy: "irt" | "penalized" | "raw";
|
|
129
134
|
};
|
|
130
135
|
readonly rowHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
131
136
|
}, E, R>) => Effect.Effect<{
|
|
132
137
|
count: number;
|
|
133
138
|
digest: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
134
|
-
}, E | import("#contracts/tryout/
|
|
139
|
+
}, E | import("#contracts/tryout/digest").TryoutDigestError, R>;
|
|
@@ -3,8 +3,9 @@ import { canonicalizeLearningGraphIdentity } from "#contracts/graph/spec";
|
|
|
3
3
|
import { compareCodeUnits } from "#contracts/text/order";
|
|
4
4
|
import { hashTryoutCanonical } from "#contracts/tryout/canonical";
|
|
5
5
|
import { TryoutCatalogRecordSchema, } from "#contracts/tryout/catalog";
|
|
6
|
+
import { digestTryoutRecords } from "#contracts/tryout/digest";
|
|
6
7
|
import { tryoutCatalogIdentity } from "#contracts/tryout/identity";
|
|
7
|
-
import {
|
|
8
|
+
import { canonicalTryoutMarks } from "#contracts/tryout/spec";
|
|
8
9
|
const CATALOG_DOMAIN = "nakafa.aksara.tryout-catalog";
|
|
9
10
|
/** Includes an optional field without serializing absence as null. */
|
|
10
11
|
function optionalField(key, value) {
|
|
@@ -96,6 +97,9 @@ export function canonicalizeTryoutCatalogFacts(row) {
|
|
|
96
97
|
...shared,
|
|
97
98
|
countryKey: row.countryKey,
|
|
98
99
|
examKey: row.examKey,
|
|
100
|
+
...(row.marks === undefined
|
|
101
|
+
? {}
|
|
102
|
+
: { marks: canonicalTryoutMarks(row.marks) }),
|
|
99
103
|
questionCount: row.questionCount,
|
|
100
104
|
questionSourcePath: row.questionSourcePath,
|
|
101
105
|
sectionKey: row.sectionKey,
|
|
@@ -173,6 +177,9 @@ export function canonicalizeTryoutCatalog(row) {
|
|
|
173
177
|
countryKey: row.countryKey,
|
|
174
178
|
examKey: row.examKey,
|
|
175
179
|
kind: row.kind,
|
|
180
|
+
...(row.marks === undefined
|
|
181
|
+
? {}
|
|
182
|
+
: { marks: canonicalTryoutMarks(row.marks) }),
|
|
176
183
|
order: row.order,
|
|
177
184
|
...optionalField("publicPath", row.publicPath),
|
|
178
185
|
questionCount: row.questionCount,
|
|
@@ -41,6 +41,49 @@ export declare const TryoutContentInputSchema: Schema.Struct<{
|
|
|
41
41
|
readonly optionKey: Schema.String;
|
|
42
42
|
readonly order: Schema.Int;
|
|
43
43
|
}>>;
|
|
44
|
+
}>, Schema.Struct<{
|
|
45
|
+
readonly criteria: Schema.$Array<Schema.Struct<{
|
|
46
|
+
readonly criterionKey: Schema.String;
|
|
47
|
+
readonly finalAnswer: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
48
|
+
readonly acceptsFractions: Schema.Boolean;
|
|
49
|
+
readonly kind: Schema.Literal<"number">;
|
|
50
|
+
readonly tolerance: Schema.optionalKey<Schema.Struct<{
|
|
51
|
+
readonly kind: Schema.Literals<readonly ["absolute", "relative"]>;
|
|
52
|
+
readonly value: Schema.String;
|
|
53
|
+
}>>;
|
|
54
|
+
readonly value: Schema.String;
|
|
55
|
+
}>, Schema.Struct<{
|
|
56
|
+
readonly acceptedAnswers: Schema.NonEmptyArray<Schema.Trimmed>;
|
|
57
|
+
readonly collapseWhitespace: Schema.Boolean;
|
|
58
|
+
readonly ignoreCase: Schema.Boolean;
|
|
59
|
+
readonly kind: Schema.Literal<"text">;
|
|
60
|
+
}>]>>;
|
|
61
|
+
readonly order: Schema.Int;
|
|
62
|
+
readonly label: Schema.$Record<Schema.Literals<readonly ["en", "id", "de"]>, Schema.String>;
|
|
63
|
+
readonly levels: Schema.$Array<Schema.Struct<{
|
|
64
|
+
readonly levelKey: Schema.String;
|
|
65
|
+
readonly order: Schema.Int;
|
|
66
|
+
readonly points: Schema.Int;
|
|
67
|
+
readonly label: Schema.$Record<Schema.Literals<readonly ["en", "id", "de"]>, Schema.String>;
|
|
68
|
+
}>>;
|
|
69
|
+
}>>;
|
|
70
|
+
readonly kind: Schema.Literal<"rubric">;
|
|
71
|
+
}>, Schema.Struct<{
|
|
72
|
+
readonly key: Schema.Union<readonly [Schema.Struct<{
|
|
73
|
+
readonly acceptsFractions: Schema.Boolean;
|
|
74
|
+
readonly kind: Schema.Literal<"number">;
|
|
75
|
+
readonly tolerance: Schema.optionalKey<Schema.Struct<{
|
|
76
|
+
readonly kind: Schema.Literals<readonly ["absolute", "relative"]>;
|
|
77
|
+
readonly value: Schema.String;
|
|
78
|
+
}>>;
|
|
79
|
+
readonly value: Schema.String;
|
|
80
|
+
}>, Schema.Struct<{
|
|
81
|
+
readonly acceptedAnswers: Schema.NonEmptyArray<Schema.Trimmed>;
|
|
82
|
+
readonly collapseWhitespace: Schema.Boolean;
|
|
83
|
+
readonly ignoreCase: Schema.Boolean;
|
|
84
|
+
readonly kind: Schema.Literal<"text">;
|
|
85
|
+
}>]>;
|
|
86
|
+
readonly kind: Schema.Literal<"short-answer">;
|
|
44
87
|
}>, Schema.Struct<{
|
|
45
88
|
readonly kind: Schema.Literal<"single-choice">;
|
|
46
89
|
readonly options: Schema.$Array<Schema.Struct<{
|
|
@@ -8,4 +8,4 @@ export declare function makeTryoutPlacementRecord(row: TryoutPlacement): TryoutP
|
|
|
8
8
|
export declare function digestTryoutPlacements<E, R>(records: Stream.Stream<TryoutPlacementRecord, E, R>): import("effect/Effect").Effect<{
|
|
9
9
|
count: number;
|
|
10
10
|
digest: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
11
|
-
}, E | import("#contracts/tryout/
|
|
11
|
+
}, E | import("#contracts/tryout/digest").TryoutDigestError, R>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { canonicalQuestionBlueprint } from "#contracts/question/item";
|
|
2
2
|
import { canonicalQuestionResponse } from "#contracts/question/response";
|
|
3
3
|
import { hashTryoutCanonical } from "#contracts/tryout/canonical";
|
|
4
|
+
import { digestTryoutRecords } from "#contracts/tryout/digest";
|
|
4
5
|
import { tryoutPlacementIdentity } from "#contracts/tryout/identity";
|
|
5
6
|
import { canonicalAssessmentLanguagePolicy } from "#contracts/tryout/language";
|
|
6
7
|
import { TryoutPlacementRecordSchema, } from "#contracts/tryout/placement";
|
|
7
|
-
import { digestTryoutRecords } from "#contracts/tryout/row-hash";
|
|
8
8
|
const PLACEMENT_DOMAIN = "nakafa.aksara.tryout-placements";
|
|
9
9
|
/** Serializes one artifact-bound placement with stable field order. */
|
|
10
10
|
export function canonicalizeTryoutPlacement(row) {
|
|
@@ -21,6 +21,7 @@ export function canonicalizeTryoutPlacement(row) {
|
|
|
21
21
|
deliveryLanguage: row.deliveryLanguage,
|
|
22
22
|
examKey: row.examKey,
|
|
23
23
|
languagePolicy: canonicalAssessmentLanguagePolicy(row.languagePolicy),
|
|
24
|
+
...(row.points === undefined ? {} : { points: row.points }),
|
|
24
25
|
questionArtifactHash: row.questionArtifactHash,
|
|
25
26
|
questionArtifactLocale: row.questionArtifactLocale,
|
|
26
27
|
questionContentKey: row.questionContentKey,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Active placement before immutable artifact hashes are bound. Absent points
|
|
4
|
+
* mean the default single point; read worth through `questionPoints`.
|
|
5
|
+
*/
|
|
3
6
|
export declare const TryoutPlacementSourceSchema: Schema.Struct<{
|
|
4
7
|
answerArtifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
|
|
5
8
|
answerContentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
|
|
@@ -18,6 +21,7 @@ export declare const TryoutPlacementSourceSchema: Schema.Struct<{
|
|
|
18
21
|
readonly kind: Schema.Literal<"fixed">;
|
|
19
22
|
readonly language: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraDeliveryLanguage">;
|
|
20
23
|
}>]>;
|
|
24
|
+
points: Schema.optionalKey<Schema.Int>;
|
|
21
25
|
questionArtifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
|
|
22
26
|
questionContentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
|
|
23
27
|
questionOrder: Schema.Finite;
|
|
@@ -44,6 +48,49 @@ export declare const TryoutPlacementSourceSchema: Schema.Struct<{
|
|
|
44
48
|
readonly optionKey: Schema.String;
|
|
45
49
|
readonly order: Schema.Int;
|
|
46
50
|
}>>;
|
|
51
|
+
}>, Schema.Struct<{
|
|
52
|
+
readonly criteria: Schema.$Array<Schema.Struct<{
|
|
53
|
+
readonly criterionKey: Schema.String;
|
|
54
|
+
readonly finalAnswer: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
55
|
+
readonly acceptsFractions: Schema.Boolean;
|
|
56
|
+
readonly kind: Schema.Literal<"number">;
|
|
57
|
+
readonly tolerance: Schema.optionalKey<Schema.Struct<{
|
|
58
|
+
readonly kind: Schema.Literals<readonly ["absolute", "relative"]>;
|
|
59
|
+
readonly value: Schema.String;
|
|
60
|
+
}>>;
|
|
61
|
+
readonly value: Schema.String;
|
|
62
|
+
}>, Schema.Struct<{
|
|
63
|
+
readonly acceptedAnswers: Schema.NonEmptyArray<Schema.Trimmed>;
|
|
64
|
+
readonly collapseWhitespace: Schema.Boolean;
|
|
65
|
+
readonly ignoreCase: Schema.Boolean;
|
|
66
|
+
readonly kind: Schema.Literal<"text">;
|
|
67
|
+
}>]>>;
|
|
68
|
+
readonly order: Schema.Int;
|
|
69
|
+
readonly label: Schema.$Record<Schema.Literals<readonly ["en", "id", "de"]>, Schema.String>;
|
|
70
|
+
readonly levels: Schema.$Array<Schema.Struct<{
|
|
71
|
+
readonly levelKey: Schema.String;
|
|
72
|
+
readonly order: Schema.Int;
|
|
73
|
+
readonly points: Schema.Int;
|
|
74
|
+
readonly label: Schema.$Record<Schema.Literals<readonly ["en", "id", "de"]>, Schema.String>;
|
|
75
|
+
}>>;
|
|
76
|
+
}>>;
|
|
77
|
+
readonly kind: Schema.Literal<"rubric">;
|
|
78
|
+
}>, Schema.Struct<{
|
|
79
|
+
readonly key: Schema.Union<readonly [Schema.Struct<{
|
|
80
|
+
readonly acceptsFractions: Schema.Boolean;
|
|
81
|
+
readonly kind: Schema.Literal<"number">;
|
|
82
|
+
readonly tolerance: Schema.optionalKey<Schema.Struct<{
|
|
83
|
+
readonly kind: Schema.Literals<readonly ["absolute", "relative"]>;
|
|
84
|
+
readonly value: Schema.String;
|
|
85
|
+
}>>;
|
|
86
|
+
readonly value: Schema.String;
|
|
87
|
+
}>, Schema.Struct<{
|
|
88
|
+
readonly acceptedAnswers: Schema.NonEmptyArray<Schema.Trimmed>;
|
|
89
|
+
readonly collapseWhitespace: Schema.Boolean;
|
|
90
|
+
readonly ignoreCase: Schema.Boolean;
|
|
91
|
+
readonly kind: Schema.Literal<"text">;
|
|
92
|
+
}>]>;
|
|
93
|
+
readonly kind: Schema.Literal<"short-answer">;
|
|
47
94
|
}>, Schema.Struct<{
|
|
48
95
|
readonly kind: Schema.Literal<"single-choice">;
|
|
49
96
|
readonly options: Schema.$Array<Schema.Struct<{
|
|
@@ -80,6 +127,7 @@ export declare const TryoutPlacementSchema: Schema.Struct<{
|
|
|
80
127
|
readonly kind: Schema.Literal<"fixed">;
|
|
81
128
|
readonly language: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraDeliveryLanguage">;
|
|
82
129
|
}>]>;
|
|
130
|
+
readonly points: Schema.optionalKey<Schema.Int>;
|
|
83
131
|
readonly questionArtifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
|
|
84
132
|
readonly questionContentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
|
|
85
133
|
readonly questionOrder: Schema.Finite;
|
|
@@ -106,6 +154,49 @@ export declare const TryoutPlacementSchema: Schema.Struct<{
|
|
|
106
154
|
readonly optionKey: Schema.String;
|
|
107
155
|
readonly order: Schema.Int;
|
|
108
156
|
}>>;
|
|
157
|
+
}>, Schema.Struct<{
|
|
158
|
+
readonly criteria: Schema.$Array<Schema.Struct<{
|
|
159
|
+
readonly criterionKey: Schema.String;
|
|
160
|
+
readonly finalAnswer: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
161
|
+
readonly acceptsFractions: Schema.Boolean;
|
|
162
|
+
readonly kind: Schema.Literal<"number">;
|
|
163
|
+
readonly tolerance: Schema.optionalKey<Schema.Struct<{
|
|
164
|
+
readonly kind: Schema.Literals<readonly ["absolute", "relative"]>;
|
|
165
|
+
readonly value: Schema.String;
|
|
166
|
+
}>>;
|
|
167
|
+
readonly value: Schema.String;
|
|
168
|
+
}>, Schema.Struct<{
|
|
169
|
+
readonly acceptedAnswers: Schema.NonEmptyArray<Schema.Trimmed>;
|
|
170
|
+
readonly collapseWhitespace: Schema.Boolean;
|
|
171
|
+
readonly ignoreCase: Schema.Boolean;
|
|
172
|
+
readonly kind: Schema.Literal<"text">;
|
|
173
|
+
}>]>>;
|
|
174
|
+
readonly order: Schema.Int;
|
|
175
|
+
readonly label: Schema.$Record<Schema.Literals<readonly ["en", "id", "de"]>, Schema.String>;
|
|
176
|
+
readonly levels: Schema.$Array<Schema.Struct<{
|
|
177
|
+
readonly levelKey: Schema.String;
|
|
178
|
+
readonly order: Schema.Int;
|
|
179
|
+
readonly points: Schema.Int;
|
|
180
|
+
readonly label: Schema.$Record<Schema.Literals<readonly ["en", "id", "de"]>, Schema.String>;
|
|
181
|
+
}>>;
|
|
182
|
+
}>>;
|
|
183
|
+
readonly kind: Schema.Literal<"rubric">;
|
|
184
|
+
}>, Schema.Struct<{
|
|
185
|
+
readonly key: Schema.Union<readonly [Schema.Struct<{
|
|
186
|
+
readonly acceptsFractions: Schema.Boolean;
|
|
187
|
+
readonly kind: Schema.Literal<"number">;
|
|
188
|
+
readonly tolerance: Schema.optionalKey<Schema.Struct<{
|
|
189
|
+
readonly kind: Schema.Literals<readonly ["absolute", "relative"]>;
|
|
190
|
+
readonly value: Schema.String;
|
|
191
|
+
}>>;
|
|
192
|
+
readonly value: Schema.String;
|
|
193
|
+
}>, Schema.Struct<{
|
|
194
|
+
readonly acceptedAnswers: Schema.NonEmptyArray<Schema.Trimmed>;
|
|
195
|
+
readonly collapseWhitespace: Schema.Boolean;
|
|
196
|
+
readonly ignoreCase: Schema.Boolean;
|
|
197
|
+
readonly kind: Schema.Literal<"text">;
|
|
198
|
+
}>]>;
|
|
199
|
+
readonly kind: Schema.Literal<"short-answer">;
|
|
109
200
|
}>, Schema.Struct<{
|
|
110
201
|
readonly kind: Schema.Literal<"single-choice">;
|
|
111
202
|
readonly options: Schema.$Array<Schema.Struct<{
|
|
@@ -146,6 +237,7 @@ export declare const TryoutPlacementRecordSchema: Schema.Struct<{
|
|
|
146
237
|
readonly kind: Schema.Literal<"fixed">;
|
|
147
238
|
readonly language: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraDeliveryLanguage">;
|
|
148
239
|
}>]>;
|
|
240
|
+
readonly points: Schema.optionalKey<Schema.Int>;
|
|
149
241
|
readonly questionArtifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
|
|
150
242
|
readonly questionContentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
|
|
151
243
|
readonly questionOrder: Schema.Finite;
|
|
@@ -172,6 +264,49 @@ export declare const TryoutPlacementRecordSchema: Schema.Struct<{
|
|
|
172
264
|
readonly optionKey: Schema.String;
|
|
173
265
|
readonly order: Schema.Int;
|
|
174
266
|
}>>;
|
|
267
|
+
}>, Schema.Struct<{
|
|
268
|
+
readonly criteria: Schema.$Array<Schema.Struct<{
|
|
269
|
+
readonly criterionKey: Schema.String;
|
|
270
|
+
readonly finalAnswer: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
271
|
+
readonly acceptsFractions: Schema.Boolean;
|
|
272
|
+
readonly kind: Schema.Literal<"number">;
|
|
273
|
+
readonly tolerance: Schema.optionalKey<Schema.Struct<{
|
|
274
|
+
readonly kind: Schema.Literals<readonly ["absolute", "relative"]>;
|
|
275
|
+
readonly value: Schema.String;
|
|
276
|
+
}>>;
|
|
277
|
+
readonly value: Schema.String;
|
|
278
|
+
}>, Schema.Struct<{
|
|
279
|
+
readonly acceptedAnswers: Schema.NonEmptyArray<Schema.Trimmed>;
|
|
280
|
+
readonly collapseWhitespace: Schema.Boolean;
|
|
281
|
+
readonly ignoreCase: Schema.Boolean;
|
|
282
|
+
readonly kind: Schema.Literal<"text">;
|
|
283
|
+
}>]>>;
|
|
284
|
+
readonly order: Schema.Int;
|
|
285
|
+
readonly label: Schema.$Record<Schema.Literals<readonly ["en", "id", "de"]>, Schema.String>;
|
|
286
|
+
readonly levels: Schema.$Array<Schema.Struct<{
|
|
287
|
+
readonly levelKey: Schema.String;
|
|
288
|
+
readonly order: Schema.Int;
|
|
289
|
+
readonly points: Schema.Int;
|
|
290
|
+
readonly label: Schema.$Record<Schema.Literals<readonly ["en", "id", "de"]>, Schema.String>;
|
|
291
|
+
}>>;
|
|
292
|
+
}>>;
|
|
293
|
+
readonly kind: Schema.Literal<"rubric">;
|
|
294
|
+
}>, Schema.Struct<{
|
|
295
|
+
readonly key: Schema.Union<readonly [Schema.Struct<{
|
|
296
|
+
readonly acceptsFractions: Schema.Boolean;
|
|
297
|
+
readonly kind: Schema.Literal<"number">;
|
|
298
|
+
readonly tolerance: Schema.optionalKey<Schema.Struct<{
|
|
299
|
+
readonly kind: Schema.Literals<readonly ["absolute", "relative"]>;
|
|
300
|
+
readonly value: Schema.String;
|
|
301
|
+
}>>;
|
|
302
|
+
readonly value: Schema.String;
|
|
303
|
+
}>, Schema.Struct<{
|
|
304
|
+
readonly acceptedAnswers: Schema.NonEmptyArray<Schema.Trimmed>;
|
|
305
|
+
readonly collapseWhitespace: Schema.Boolean;
|
|
306
|
+
readonly ignoreCase: Schema.Boolean;
|
|
307
|
+
readonly kind: Schema.Literal<"text">;
|
|
308
|
+
}>]>;
|
|
309
|
+
readonly kind: Schema.Literal<"short-answer">;
|
|
175
310
|
}>, Schema.Struct<{
|
|
176
311
|
readonly kind: Schema.Literal<"single-choice">;
|
|
177
312
|
readonly options: Schema.$Array<Schema.Struct<{
|
package/dist/tryout/placement.js
CHANGED
|
@@ -3,7 +3,8 @@ import { ContentKeySchema, CorpusSourcePathSchema, Sha256HashSchema, } from "#co
|
|
|
3
3
|
import { AppLocaleSchema, ArtifactLocaleSchema, DeliveryLanguageSchema, } from "#contracts/locale";
|
|
4
4
|
import { QuestionKeySchema, questionKeyParts, } from "#contracts/question/identity";
|
|
5
5
|
import { QuestionBlueprintSchema } from "#contracts/question/item";
|
|
6
|
-
import {
|
|
6
|
+
import { AuthoredQuestionPointsSchema } from "#contracts/question/points";
|
|
7
|
+
import { QuestionResponseSchema, } from "#contracts/question/response";
|
|
7
8
|
import { RendererDomainSchema } from "#contracts/renderer/domain";
|
|
8
9
|
import { TryoutKeySchema } from "#contracts/tryout/key";
|
|
9
10
|
import { AssessmentLanguagePolicySchema, deliveryLanguageForPolicy, } from "#contracts/tryout/language";
|
|
@@ -18,6 +19,7 @@ const PlacementFields = {
|
|
|
18
19
|
deliveryLanguage: DeliveryLanguageSchema,
|
|
19
20
|
examKey: TryoutKeySchema,
|
|
20
21
|
languagePolicy: AssessmentLanguagePolicySchema,
|
|
22
|
+
points: Schema.optionalKey(AuthoredQuestionPointsSchema),
|
|
21
23
|
questionArtifactLocale: ArtifactLocaleSchema,
|
|
22
24
|
questionContentKey: ContentKeySchema,
|
|
23
25
|
questionOrder: PositiveCountSchema,
|
|
@@ -58,11 +60,21 @@ function hasCoherentPlacementLanguages(input) {
|
|
|
58
60
|
input.questionArtifactLocale === expectedDeliveryLanguage &&
|
|
59
61
|
input.answerArtifactLocale === input.appLocale);
|
|
60
62
|
}
|
|
61
|
-
/**
|
|
63
|
+
/** Requires a rubric placement to take its worth from the rubric total. */
|
|
64
|
+
function hasCoherentPlacementPoints(input) {
|
|
65
|
+
return input.points === undefined || input.response.kind !== "rubric";
|
|
66
|
+
}
|
|
67
|
+
const PLACEMENT_POINTS_MESSAGE = "Rubric placements derive their points from the rubric total.";
|
|
68
|
+
/**
|
|
69
|
+
* Active placement before immutable artifact hashes are bound. Absent points
|
|
70
|
+
* mean the default single point; read worth through `questionPoints`.
|
|
71
|
+
*/
|
|
62
72
|
export const TryoutPlacementSourceSchema = Schema.Struct(PlacementFields).pipe(Schema.check(Schema.makeFilter(hasCoherentPlacementKeys, {
|
|
63
73
|
message: "Placement source, content keys, and authored order must agree.",
|
|
64
74
|
})), Schema.check(Schema.makeFilter(hasCoherentPlacementLanguages, {
|
|
65
75
|
message: "Placement app, delivery, question, and answer languages must agree.",
|
|
76
|
+
})), Schema.check(Schema.makeFilter(hasCoherentPlacementPoints, {
|
|
77
|
+
message: PLACEMENT_POINTS_MESSAGE,
|
|
66
78
|
})));
|
|
67
79
|
/** Artifact-bound placement retained by signed attempt state. */
|
|
68
80
|
export const TryoutPlacementSchema = Schema.Struct({
|
|
@@ -74,6 +86,8 @@ export const TryoutPlacementSchema = Schema.Struct({
|
|
|
74
86
|
message: "Placement source, content keys, and authored order must agree.",
|
|
75
87
|
})), Schema.check(Schema.makeFilter(hasCoherentPlacementLanguages, {
|
|
76
88
|
message: "Placement app, delivery, question, and answer languages must agree.",
|
|
89
|
+
})), Schema.check(Schema.makeFilter(hasCoherentPlacementPoints, {
|
|
90
|
+
message: PLACEMENT_POINTS_MESSAGE,
|
|
77
91
|
})));
|
|
78
92
|
/** Hashed immutable placement accepted by snapshot publication. */
|
|
79
93
|
export const TryoutPlacementRecordSchema = Schema.Struct({
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import type { TryoutCatalogRow, TryoutSection, TryoutSet } from "#contracts/tryout/catalog";
|
|
3
|
+
import type { TryoutPlacement } from "#contracts/tryout/placement";
|
|
4
|
+
import type { TryoutScoring } from "#contracts/tryout/spec";
|
|
5
|
+
declare const TryoutScoringError_base: Schema.Class<TryoutScoringError, Schema.TaggedStruct<"TryoutScoringError", {
|
|
6
|
+
readonly code: Schema.Literals<readonly ["marks", "rubric", "strategy"]>;
|
|
7
|
+
readonly identity: Schema.String;
|
|
8
|
+
}>, import("effect/Cause").YieldableError>;
|
|
9
|
+
/**
|
|
10
|
+
* A signed try-out row cannot be scored as published. `strategy` means a set
|
|
11
|
+
* disagrees with its exam's strategy, `marks` means a section of a penalized
|
|
12
|
+
* set lacks marks or a section of another set has them, and `rubric` means a
|
|
13
|
+
* rubric placement sits in a set that does not sum raw points.
|
|
14
|
+
*/
|
|
15
|
+
export declare class TryoutScoringError extends TryoutScoringError_base {
|
|
16
|
+
}
|
|
17
|
+
/** Exam strategies, sets, and sections gathered while a catalog is read. */
|
|
18
|
+
export interface TryoutScoringFacts {
|
|
19
|
+
readonly exams: Map<string, TryoutScoring>;
|
|
20
|
+
readonly sections: TryoutSection[];
|
|
21
|
+
readonly sets: Map<string, TryoutSet>;
|
|
22
|
+
}
|
|
23
|
+
/** Creates empty scoring facts for one snapshot verification pass. */
|
|
24
|
+
export declare function makeTryoutScoringFacts(): TryoutScoringFacts;
|
|
25
|
+
/** Records the scoring facts carried by one localized catalog row. */
|
|
26
|
+
export declare function recordTryoutScoringFacts(facts: TryoutScoringFacts, row: TryoutCatalogRow): void;
|
|
27
|
+
/**
|
|
28
|
+
* Requires every set to repeat its exam's strategy and marks on exactly the
|
|
29
|
+
* sections of penalized sets, once the complete catalog has been recorded.
|
|
30
|
+
*/
|
|
31
|
+
export declare const validateTryoutScoringFacts: (facts: TryoutScoringFacts) => Effect.Effect<void, TryoutScoringError, never>;
|
|
32
|
+
/**
|
|
33
|
+
* Requires one rubric placement to belong to a raw-scored set, because a
|
|
34
|
+
* rubric awards points per criterion instead of a correct or wrong outcome.
|
|
35
|
+
*/
|
|
36
|
+
export declare function validateTryoutPlacementScoring(facts: TryoutScoringFacts, row: TryoutPlacement): Effect.Effect<void, never, never> | Effect.Effect<never, TryoutScoringError, never>;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import { tryoutCatalogIdentity, tryoutCatalogNodeIdentity, tryoutPlacementIdentity, } from "#contracts/tryout/identity";
|
|
3
|
+
/**
|
|
4
|
+
* A signed try-out row cannot be scored as published. `strategy` means a set
|
|
5
|
+
* disagrees with its exam's strategy, `marks` means a section of a penalized
|
|
6
|
+
* set lacks marks or a section of another set has them, and `rubric` means a
|
|
7
|
+
* rubric placement sits in a set that does not sum raw points.
|
|
8
|
+
*/
|
|
9
|
+
export class TryoutScoringError extends Schema.TaggedError()("TryoutScoringError", {
|
|
10
|
+
code: Schema.Literals(["marks", "rubric", "strategy"]),
|
|
11
|
+
identity: Schema.String,
|
|
12
|
+
}) {
|
|
13
|
+
}
|
|
14
|
+
/** Creates empty scoring facts for one snapshot verification pass. */
|
|
15
|
+
export function makeTryoutScoringFacts() {
|
|
16
|
+
return { exams: new Map(), sections: [], sets: new Map() };
|
|
17
|
+
}
|
|
18
|
+
/** Records the scoring facts carried by one localized catalog row. */
|
|
19
|
+
export function recordTryoutScoringFacts(facts, row) {
|
|
20
|
+
if (row.kind === "exam") {
|
|
21
|
+
facts.exams.set(tryoutCatalogIdentity(row), row.scoringStrategy);
|
|
22
|
+
}
|
|
23
|
+
if (row.kind === "set") {
|
|
24
|
+
facts.sets.set(tryoutCatalogIdentity(row), row);
|
|
25
|
+
}
|
|
26
|
+
if (row.kind === "section") {
|
|
27
|
+
facts.sections.push(row);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** Returns the strategy of the set that owns one section or placement. */
|
|
31
|
+
function setStrategy(facts, row) {
|
|
32
|
+
const identity = tryoutCatalogNodeIdentity({
|
|
33
|
+
appLocale: row.appLocale,
|
|
34
|
+
countryKey: row.countryKey,
|
|
35
|
+
examKey: row.examKey,
|
|
36
|
+
kind: "set",
|
|
37
|
+
setKey: row.setKey,
|
|
38
|
+
trackKey: row.trackKey,
|
|
39
|
+
});
|
|
40
|
+
return facts.sets.get(identity)?.scoringStrategy;
|
|
41
|
+
}
|
|
42
|
+
/** Requires one set to score with the strategy its exam declares. */
|
|
43
|
+
function validateSetStrategy(facts, row) {
|
|
44
|
+
const exam = tryoutCatalogNodeIdentity({
|
|
45
|
+
appLocale: row.appLocale,
|
|
46
|
+
countryKey: row.countryKey,
|
|
47
|
+
examKey: row.examKey,
|
|
48
|
+
kind: "exam",
|
|
49
|
+
});
|
|
50
|
+
if (facts.exams.get(exam) === row.scoringStrategy) {
|
|
51
|
+
return Effect.void;
|
|
52
|
+
}
|
|
53
|
+
return Effect.fail(new TryoutScoringError({
|
|
54
|
+
code: "strategy",
|
|
55
|
+
identity: tryoutCatalogIdentity(row),
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
/** Requires marks on exactly the sections of penalized sets. */
|
|
59
|
+
function validateSectionMarks(facts, row) {
|
|
60
|
+
const penalized = setStrategy(facts, row) === "penalized";
|
|
61
|
+
if (penalized === (row.marks !== undefined)) {
|
|
62
|
+
return Effect.void;
|
|
63
|
+
}
|
|
64
|
+
return Effect.fail(new TryoutScoringError({
|
|
65
|
+
code: "marks",
|
|
66
|
+
identity: tryoutCatalogIdentity(row),
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Requires every set to repeat its exam's strategy and marks on exactly the
|
|
71
|
+
* sections of penalized sets, once the complete catalog has been recorded.
|
|
72
|
+
*/
|
|
73
|
+
export const validateTryoutScoringFacts = Effect.fn("AksaraContracts.validateTryoutScoringFacts")(function* (facts) {
|
|
74
|
+
yield* Effect.forEach(facts.sets.values(), (row) => validateSetStrategy(facts, row), { discard: true });
|
|
75
|
+
yield* Effect.forEach(facts.sections, (row) => validateSectionMarks(facts, row), { discard: true });
|
|
76
|
+
});
|
|
77
|
+
/**
|
|
78
|
+
* Requires one rubric placement to belong to a raw-scored set, because a
|
|
79
|
+
* rubric awards points per criterion instead of a correct or wrong outcome.
|
|
80
|
+
*/
|
|
81
|
+
export function validateTryoutPlacementScoring(facts, row) {
|
|
82
|
+
if (row.response.kind !== "rubric" || setStrategy(facts, row) === "raw") {
|
|
83
|
+
return Effect.void;
|
|
84
|
+
}
|
|
85
|
+
return Effect.fail(new TryoutScoringError({
|
|
86
|
+
code: "rubric",
|
|
87
|
+
identity: tryoutPlacementIdentity(row),
|
|
88
|
+
}));
|
|
89
|
+
}
|
package/dist/tryout/spec.d.ts
CHANGED
|
@@ -1,9 +1,37 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
/**
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Scoring strategy declared by one authored exam and repeated on its sets.
|
|
4
|
+
* Every strategy reads a question's worth through `questionPoints`. `raw` sums
|
|
5
|
+
* the worth of correct answers and the points of reached rubric levels.
|
|
6
|
+
* `penalized` adds, for each question, its section's marks for a correct,
|
|
7
|
+
* wrong, or blank answer times the question's worth. `irt` estimates ability
|
|
8
|
+
* from correct and wrong outcomes. Rubric questions belong only to raw exams.
|
|
9
|
+
*/
|
|
10
|
+
export declare const TryoutScoringSchema: Schema.Literals<readonly ["irt", "penalized", "raw"]>;
|
|
4
11
|
export type TryoutScoring = typeof TryoutScoringSchema.Type;
|
|
5
|
-
/**
|
|
6
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Whole marks one section of a penalized exam awards per point of a question
|
|
14
|
+
* for a correct, wrong, or blank answer, such as `+4`, `-1`, and `0`. A wrong
|
|
15
|
+
* answer costs marks, a blank never scores below a wrong answer, and a correct
|
|
16
|
+
* answer always scores above a blank.
|
|
17
|
+
*/
|
|
18
|
+
export declare const TryoutMarksSchema: Schema.Struct<{
|
|
19
|
+
readonly blank: Schema.Int;
|
|
20
|
+
readonly correct: Schema.Int;
|
|
21
|
+
readonly wrong: Schema.Int;
|
|
22
|
+
}>;
|
|
23
|
+
export type TryoutMarks = typeof TryoutMarksSchema.Type;
|
|
24
|
+
/** Returns section marks in stable field order for signed canonicalizers. */
|
|
25
|
+
export declare function canonicalTryoutMarks(marks: TryoutMarks): {
|
|
26
|
+
blank: number;
|
|
27
|
+
correct: number;
|
|
28
|
+
wrong: number;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Navigation role of one authored track: one exam `year`, one `subject`, or
|
|
32
|
+
* the sets of one `institution`, such as a Studienkolleg.
|
|
33
|
+
*/
|
|
34
|
+
export declare const TryoutTrackKindSchema: Schema.Literals<readonly ["institution", "subject", "year"]>;
|
|
7
35
|
/** Public route behavior of one authored section. */
|
|
8
36
|
export declare const TryoutVisibilitySchema: Schema.Literals<readonly ["internal-entry", "visible"]>;
|
|
9
37
|
/** Bounded authored revision shared by one try-out source hierarchy. */
|
package/dist/tryout/spec.js
CHANGED
|
@@ -1,9 +1,40 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
const TRYOUT_CONTENT_HASH_PATTERN = /^[a-f\d]{64}$/u;
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Scoring strategy declared by one authored exam and repeated on its sets.
|
|
5
|
+
* Every strategy reads a question's worth through `questionPoints`. `raw` sums
|
|
6
|
+
* the worth of correct answers and the points of reached rubric levels.
|
|
7
|
+
* `penalized` adds, for each question, its section's marks for a correct,
|
|
8
|
+
* wrong, or blank answer times the question's worth. `irt` estimates ability
|
|
9
|
+
* from correct and wrong outcomes. Rubric questions belong only to raw exams.
|
|
10
|
+
*/
|
|
11
|
+
export const TryoutScoringSchema = Schema.Literals(["irt", "penalized", "raw"]);
|
|
12
|
+
/**
|
|
13
|
+
* Whole marks one section of a penalized exam awards per point of a question
|
|
14
|
+
* for a correct, wrong, or blank answer, such as `+4`, `-1`, and `0`. A wrong
|
|
15
|
+
* answer costs marks, a blank never scores below a wrong answer, and a correct
|
|
16
|
+
* answer always scores above a blank.
|
|
17
|
+
*/
|
|
18
|
+
export const TryoutMarksSchema = Schema.Struct({
|
|
19
|
+
blank: Schema.Int,
|
|
20
|
+
correct: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
21
|
+
wrong: Schema.Int.check(Schema.isLessThan(0)),
|
|
22
|
+
}).check(Schema.makeFilter(({ blank, correct, wrong }) => wrong <= blank && blank < correct, {
|
|
23
|
+
message: "Expected wrong marks at or below blank marks, and blank marks below correct marks.",
|
|
24
|
+
}));
|
|
25
|
+
/** Returns section marks in stable field order for signed canonicalizers. */
|
|
26
|
+
export function canonicalTryoutMarks(marks) {
|
|
27
|
+
return { blank: marks.blank, correct: marks.correct, wrong: marks.wrong };
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Navigation role of one authored track: one exam `year`, one `subject`, or
|
|
31
|
+
* the sets of one `institution`, such as a Studienkolleg.
|
|
32
|
+
*/
|
|
33
|
+
export const TryoutTrackKindSchema = Schema.Literals([
|
|
34
|
+
"institution",
|
|
35
|
+
"subject",
|
|
36
|
+
"year",
|
|
37
|
+
]);
|
|
7
38
|
/** Public route behavior of one authored section. */
|
|
8
39
|
export const TryoutVisibilitySchema = Schema.Literals([
|
|
9
40
|
"internal-entry",
|