@memberjunction/rubrics-base 0.0.0 → 6.2.0-edge.2
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/LICENSE +183 -0
- package/README.md +35 -28
- package/dist/RubricEngineBase.d.ts +150 -0
- package/dist/RubricEngineBase.d.ts.map +1 -0
- package/dist/RubricEngineBase.js +267 -0
- package/dist/RubricEngineBase.js.map +1 -0
- package/dist/RubricScoring.d.ts +60 -0
- package/dist/RubricScoring.d.ts.map +1 -0
- package/dist/RubricScoring.js +363 -0
- package/dist/RubricScoring.js.map +1 -0
- package/dist/RubricVersionDiff.d.ts +59 -0
- package/dist/RubricVersionDiff.d.ts.map +1 -0
- package/dist/RubricVersionDiff.js +256 -0
- package/dist/RubricVersionDiff.js.map +1 -0
- package/dist/authoring.d.ts +16 -0
- package/dist/authoring.d.ts.map +1 -0
- package/dist/authoring.js +98 -0
- package/dist/authoring.js.map +1 -0
- package/dist/canonical.d.ts +22 -0
- package/dist/canonical.d.ts.map +1 -0
- package/dist/canonical.js +152 -0
- package/dist/canonical.js.map +1 -0
- package/dist/evidence.d.ts +13 -0
- package/dist/evidence.d.ts.map +1 -0
- package/dist/evidence.js +38 -0
- package/dist/evidence.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/sampling.d.ts +71 -0
- package/dist/sampling.d.ts.map +1 -0
- package/dist/sampling.js +63 -0
- package/dist/sampling.js.map +1 -0
- package/dist/snapshot.d.ts +16 -0
- package/dist/snapshot.d.ts.map +1 -0
- package/dist/snapshot.js +114 -0
- package/dist/snapshot.js.map +1 -0
- package/dist/types.d.ts +170 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +39 -7
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
import { NormalizeUUID, UUIDsEqual } from '@memberjunction/global';
|
|
2
|
+
import { BandFor, Round6 } from './authoring.js';
|
|
3
|
+
import { EvidenceSatisfied } from './evidence.js';
|
|
4
|
+
export const SCORING_ENGINE_VERSION = '1.0';
|
|
5
|
+
/** Submit is refused. The message names the criterion when one answer is illegal. */
|
|
6
|
+
export class RubricValidationError extends Error {
|
|
7
|
+
constructor(message) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = 'RubricValidationError';
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Pure §6 scoring. No database. Scores are on a closed 0..1 scale.
|
|
14
|
+
*
|
|
15
|
+
* A levels answer scores the chosen level's NormalizedValue. A numeric answer scores
|
|
16
|
+
* (value − min) / (max − min), inverted when HigherIsBetter is false. A value outside
|
|
17
|
+
* the range or off Step is refused, not clamped.
|
|
18
|
+
*
|
|
19
|
+
* The not-applicable policy (the criterion's, otherwise the version's) changes weight:
|
|
20
|
+
* ExcludeAndRedistribute drops the node and the siblings' weights renormalize, and the
|
|
21
|
+
* node is not applicable. CountAsZero scores 0 and keeps the weight. FailEvaluation
|
|
22
|
+
* drops the node and raises NotApplicableFailure. NotAllowed refuses the submit and
|
|
23
|
+
* names the criterion.
|
|
24
|
+
*
|
|
25
|
+
* An unanswered applicable node is dropped from the math the same way, and it lowers
|
|
26
|
+
* completeness. Advisory nodes are stored when they have a score and never enter a
|
|
27
|
+
* rollup, a gate, completeness, or the verdict.
|
|
28
|
+
*
|
|
29
|
+
* Outcome, first match: Incomplete when completeness is below the minimum; then
|
|
30
|
+
* NotApplicableFailure, including when that policy is why the overall score is null;
|
|
31
|
+
* then Incomplete when the overall score is null for any other reason; then GateFailed;
|
|
32
|
+
* then BelowThreshold or Passed when a threshold applies; otherwise Scored. Passed is true only for
|
|
33
|
+
* Passed. It is null for Scored, and for Incomplete when the version has no threshold
|
|
34
|
+
* and no gate. Otherwise it is false.
|
|
35
|
+
*
|
|
36
|
+
* Stored decimals are rounded to 6 places after the arithmetic. Threshold, gate,
|
|
37
|
+
* band, and completeness comparisons use that same rounding, so a float such as
|
|
38
|
+
* the weighted mean of 0.1, 0.2, and 0.7 is not treated as below the value it
|
|
39
|
+
* rounds to.
|
|
40
|
+
*/
|
|
41
|
+
export class RubricScoring {
|
|
42
|
+
static Compute(input) {
|
|
43
|
+
const version = input.version;
|
|
44
|
+
const answers = new Map(input.answers.map(answer => [NormalizeUUID(answer.criterionId), answer]));
|
|
45
|
+
const scales = new Map(version.scales.map(scale => [NormalizeUUID(scale.id), scale]));
|
|
46
|
+
const byParent = new Map();
|
|
47
|
+
for (const node of version.nodes) {
|
|
48
|
+
const parentId = node.parentId == null || node.parentId === '' ? null : NormalizeUUID(node.parentId);
|
|
49
|
+
const list = byParent.get(parentId) ?? [];
|
|
50
|
+
list.push(node);
|
|
51
|
+
byParent.set(parentId, list);
|
|
52
|
+
}
|
|
53
|
+
const roots = (byParent.get(null) ?? []).map(node => RubricScoring.scoreNode(node, byParent, answers, version, scales));
|
|
54
|
+
RubricScoring.rollupWeights(roots, 'WeightedMean');
|
|
55
|
+
RubricScoring.assignContributions(roots, 1, false);
|
|
56
|
+
RubricScoring.assignPathWeights(roots, 1);
|
|
57
|
+
RubricScoring.assignGroupConfidence(roots);
|
|
58
|
+
const includedRoots = roots.filter(root => root.included && root.score !== null);
|
|
59
|
+
const overall = includedRoots.length === 0 ? null : RubricScoring.combine(includedRoots, 'WeightedMean');
|
|
60
|
+
const leaves = RubricScoring.flatten(roots).filter(calc => calc.node.nodeType === 'Criterion' && !calc.node.isAdvisory);
|
|
61
|
+
const applicable = leaves.filter(leaf => leaf.applicable).length;
|
|
62
|
+
const scored = leaves.filter(leaf => leaf.applicable && leaf.scored).length;
|
|
63
|
+
const completeness = applicable === 0 ? 1 : scored / applicable;
|
|
64
|
+
const naFailure = RubricScoring.flatten(roots).some(calc => calc.naFailure);
|
|
65
|
+
const gateFailed = RubricScoring.flatten(roots).some(calc => calc.gateFailed);
|
|
66
|
+
const hasGate = version.nodes.some(node => node.isGate);
|
|
67
|
+
const threshold = input.passThresholdOverride !== undefined && input.passThresholdOverride !== null
|
|
68
|
+
? input.passThresholdOverride
|
|
69
|
+
: version.passThreshold ?? null;
|
|
70
|
+
const minimum = version.minimumCompleteness ?? null;
|
|
71
|
+
const outcome = RubricScoring.outcome(overall, completeness, minimum, naFailure, gateFailed, threshold);
|
|
72
|
+
const passed = RubricScoring.passed(outcome, threshold, hasGate);
|
|
73
|
+
const bandId = overall === null ? null : RubricScoring.bandId(version, overall);
|
|
74
|
+
const confidence = RubricScoring.confidence(leaves);
|
|
75
|
+
return {
|
|
76
|
+
normalizedScore: overall === null ? null : Round6(overall),
|
|
77
|
+
completeness: Round6(completeness),
|
|
78
|
+
outcome,
|
|
79
|
+
passed,
|
|
80
|
+
gateFailed,
|
|
81
|
+
passThresholdApplied: threshold === null ? null : Round6(threshold),
|
|
82
|
+
bandId,
|
|
83
|
+
confidence,
|
|
84
|
+
scoredCriteriaCount: scored,
|
|
85
|
+
applicableCriteriaCount: applicable,
|
|
86
|
+
totalCriteriaCount: leaves.length,
|
|
87
|
+
nodes: RubricScoring.flatten(roots).map(RubricScoring.toStored),
|
|
88
|
+
scoringEngineVersion: SCORING_ENGINE_VERSION,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
static scoreNode(node, byParent, answers, version, scales) {
|
|
92
|
+
if (node.nodeType === 'Criterion') {
|
|
93
|
+
return RubricScoring.scoreLeaf(node, answers.get(NormalizeUUID(node.id)), version, scales);
|
|
94
|
+
}
|
|
95
|
+
const children = (byParent.get(NormalizeUUID(node.id)) ?? []).map(child => RubricScoring.scoreNode(child, byParent, answers, version, scales));
|
|
96
|
+
const included = children.filter(child => child.included && child.score !== null);
|
|
97
|
+
const score = included.length === 0 ? null : RubricScoring.combine(included, node.rollupMethod ?? 'WeightedMean');
|
|
98
|
+
const unansweredLeaves = RubricScoring.flatten(children).filter(calc => calc.unanswered).length;
|
|
99
|
+
const calc = {
|
|
100
|
+
node,
|
|
101
|
+
children,
|
|
102
|
+
score,
|
|
103
|
+
included: !node.isAdvisory && score !== null,
|
|
104
|
+
applicable: false,
|
|
105
|
+
scored: false,
|
|
106
|
+
unanswered: false,
|
|
107
|
+
naFailure: children.some(child => child.naFailure),
|
|
108
|
+
isNotApplicable: false,
|
|
109
|
+
gateFailed: false,
|
|
110
|
+
effectiveWeight: null,
|
|
111
|
+
overallContribution: null,
|
|
112
|
+
pathWeight: null,
|
|
113
|
+
completeness: RubricScoring.groupCompleteness(children),
|
|
114
|
+
method: node.rollupMethod ?? 'WeightedMean',
|
|
115
|
+
confidence: null,
|
|
116
|
+
};
|
|
117
|
+
if (node.isGate && !node.isAdvisory) {
|
|
118
|
+
const method = node.rollupMethod ?? 'WeightedMean';
|
|
119
|
+
if (score !== null && Round6(score) < Round6(node.gateMinimumScore ?? 0))
|
|
120
|
+
calc.gateFailed = true;
|
|
121
|
+
if (unansweredLeaves > 0 && (score === null || method === 'Minimum'))
|
|
122
|
+
calc.gateFailed = true;
|
|
123
|
+
}
|
|
124
|
+
return calc;
|
|
125
|
+
}
|
|
126
|
+
static scoreLeaf(node, answer, version, scales) {
|
|
127
|
+
const policy = node.notApplicablePolicy ?? version.notApplicablePolicy;
|
|
128
|
+
const base = {
|
|
129
|
+
node,
|
|
130
|
+
children: [],
|
|
131
|
+
score: null,
|
|
132
|
+
included: false,
|
|
133
|
+
applicable: false,
|
|
134
|
+
scored: false,
|
|
135
|
+
unanswered: false,
|
|
136
|
+
naFailure: false,
|
|
137
|
+
isNotApplicable: false,
|
|
138
|
+
gateFailed: false,
|
|
139
|
+
effectiveWeight: null,
|
|
140
|
+
overallContribution: null,
|
|
141
|
+
pathWeight: null,
|
|
142
|
+
completeness: null,
|
|
143
|
+
method: null,
|
|
144
|
+
confidence: answer?.confidence ?? null,
|
|
145
|
+
};
|
|
146
|
+
if (answer?.isNotApplicable) {
|
|
147
|
+
base.isNotApplicable = true;
|
|
148
|
+
if (policy === 'NotAllowed') {
|
|
149
|
+
throw new RubricValidationError(`Not applicable is not allowed for ${node.name}.`);
|
|
150
|
+
}
|
|
151
|
+
if (node.isAdvisory)
|
|
152
|
+
return base;
|
|
153
|
+
if (policy === 'CountAsZero') {
|
|
154
|
+
base.score = 0;
|
|
155
|
+
base.included = true;
|
|
156
|
+
base.applicable = true;
|
|
157
|
+
base.scored = true;
|
|
158
|
+
}
|
|
159
|
+
else if (policy === 'FailEvaluation') {
|
|
160
|
+
base.naFailure = true;
|
|
161
|
+
}
|
|
162
|
+
RubricScoring.applyGate(base);
|
|
163
|
+
return base;
|
|
164
|
+
}
|
|
165
|
+
if (!answer || !RubricScoring.hasValue(answer)) {
|
|
166
|
+
if (!node.isAdvisory) {
|
|
167
|
+
base.applicable = true;
|
|
168
|
+
base.unanswered = true;
|
|
169
|
+
}
|
|
170
|
+
RubricScoring.applyGate(base);
|
|
171
|
+
return base;
|
|
172
|
+
}
|
|
173
|
+
if (node.evidenceRequired && !EvidenceSatisfied(answer.evidence)) {
|
|
174
|
+
throw new RubricValidationError(`${node.name} requires evidence.`);
|
|
175
|
+
}
|
|
176
|
+
base.score = RubricScoring.normalize(node, answer, scales);
|
|
177
|
+
if (!node.isAdvisory) {
|
|
178
|
+
base.included = true;
|
|
179
|
+
base.applicable = true;
|
|
180
|
+
base.scored = true;
|
|
181
|
+
}
|
|
182
|
+
RubricScoring.applyGate(base);
|
|
183
|
+
return base;
|
|
184
|
+
}
|
|
185
|
+
static applyGate(calc) {
|
|
186
|
+
const node = calc.node;
|
|
187
|
+
if (!node.isGate || node.isAdvisory)
|
|
188
|
+
return;
|
|
189
|
+
if (calc.unanswered)
|
|
190
|
+
calc.gateFailed = true;
|
|
191
|
+
if (calc.score !== null && Round6(calc.score) < Round6(node.gateMinimumScore ?? 0))
|
|
192
|
+
calc.gateFailed = true;
|
|
193
|
+
}
|
|
194
|
+
static hasValue(answer) {
|
|
195
|
+
return (answer.scaleLevelId !== undefined && answer.scaleLevelId !== null)
|
|
196
|
+
|| (answer.rawValue !== undefined && answer.rawValue !== null);
|
|
197
|
+
}
|
|
198
|
+
static normalize(node, answer, scales) {
|
|
199
|
+
const scale = node.scaleId ? scales.get(NormalizeUUID(node.scaleId)) : undefined;
|
|
200
|
+
if (!scale) {
|
|
201
|
+
throw new RubricValidationError(`${node.name} has no scale.`);
|
|
202
|
+
}
|
|
203
|
+
if (scale.scaleType === 'Levels') {
|
|
204
|
+
const level = scale.levels.find(item => UUIDsEqual(item.id, answer.scaleLevelId));
|
|
205
|
+
if (!level) {
|
|
206
|
+
throw new RubricValidationError(`${node.name} is not on a level of its scale.`);
|
|
207
|
+
}
|
|
208
|
+
return level.normalizedValue;
|
|
209
|
+
}
|
|
210
|
+
const raw = answer.rawValue;
|
|
211
|
+
const min = scale.minValue ?? null;
|
|
212
|
+
const max = scale.maxValue ?? null;
|
|
213
|
+
if (raw === undefined || raw === null || Number.isNaN(raw) || min === null || max === null || max === min) {
|
|
214
|
+
throw new RubricValidationError(`${node.name} needs a numeric value inside its scale.`);
|
|
215
|
+
}
|
|
216
|
+
if (raw < min || raw > max) {
|
|
217
|
+
throw new RubricValidationError(`${node.name} is outside ${min}..${max}.`);
|
|
218
|
+
}
|
|
219
|
+
if (scale.step !== undefined && scale.step !== null && scale.step > 0) {
|
|
220
|
+
const steps = (raw - min) / scale.step;
|
|
221
|
+
if (Math.abs(steps - Math.round(steps)) > 1e-8) {
|
|
222
|
+
throw new RubricValidationError(`${node.name} is not on a step of ${scale.step}.`);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
const span = (raw - min) / (max - min);
|
|
226
|
+
return scale.higherIsBetter ? span : 1 - span;
|
|
227
|
+
}
|
|
228
|
+
static combine(included, method) {
|
|
229
|
+
if (method === 'Minimum')
|
|
230
|
+
return Math.min(...included.map(calc => calc.score));
|
|
231
|
+
if (method === 'Maximum')
|
|
232
|
+
return Math.max(...included.map(calc => calc.score));
|
|
233
|
+
const sumWeight = included.reduce((sum, calc) => sum + calc.node.weight, 0);
|
|
234
|
+
if (sumWeight === 0) {
|
|
235
|
+
return included.reduce((sum, calc) => sum + calc.score, 0) / included.length;
|
|
236
|
+
}
|
|
237
|
+
return included.reduce((sum, calc) => sum + calc.node.weight * calc.score, 0) / sumWeight;
|
|
238
|
+
}
|
|
239
|
+
/** Sets each included sibling's share of the parent. All-zero weights share equally. */
|
|
240
|
+
static rollupWeights(children, method) {
|
|
241
|
+
const included = children.filter(child => child.included && child.score !== null);
|
|
242
|
+
const sumWeight = included.reduce((sum, child) => sum + child.node.weight, 0);
|
|
243
|
+
for (const child of children) {
|
|
244
|
+
if (!child.included || child.score === null) {
|
|
245
|
+
child.effectiveWeight = null;
|
|
246
|
+
}
|
|
247
|
+
else if (sumWeight === 0) {
|
|
248
|
+
child.effectiveWeight = 1 / included.length;
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
child.effectiveWeight = child.node.weight / sumWeight;
|
|
252
|
+
}
|
|
253
|
+
if (child.children.length > 0) {
|
|
254
|
+
RubricScoring.rollupWeights(child.children, child.method ?? method);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
static assignContributions(children, ancestorProduct, blocked) {
|
|
259
|
+
for (const child of children) {
|
|
260
|
+
if (child.effectiveWeight === null || child.score === null) {
|
|
261
|
+
child.overallContribution = null;
|
|
262
|
+
RubricScoring.assignContributions(child.children, 0, true);
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
const product = ancestorProduct * child.effectiveWeight;
|
|
266
|
+
child.overallContribution = blocked ? null : child.score * product;
|
|
267
|
+
const childBlocked = blocked || child.method === 'Minimum' || child.method === 'Maximum';
|
|
268
|
+
RubricScoring.assignContributions(child.children, blocked ? 0 : product, childBlocked);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
static outcome(score, completeness, minimum, naFailure, gateFailed, threshold) {
|
|
272
|
+
if (minimum !== null && Round6(completeness) < Round6(minimum))
|
|
273
|
+
return 'Incomplete';
|
|
274
|
+
if (naFailure)
|
|
275
|
+
return 'NotApplicableFailure';
|
|
276
|
+
if (score === null)
|
|
277
|
+
return 'Incomplete';
|
|
278
|
+
if (gateFailed)
|
|
279
|
+
return 'GateFailed';
|
|
280
|
+
if (threshold !== null)
|
|
281
|
+
return Round6(score) >= Round6(threshold) ? 'Passed' : 'BelowThreshold';
|
|
282
|
+
return 'Scored';
|
|
283
|
+
}
|
|
284
|
+
static passed(outcome, threshold, hasGate) {
|
|
285
|
+
if (outcome === 'Passed')
|
|
286
|
+
return true;
|
|
287
|
+
if (outcome === 'Scored')
|
|
288
|
+
return null;
|
|
289
|
+
if (outcome === 'Incomplete' && threshold === null && !hasGate)
|
|
290
|
+
return null;
|
|
291
|
+
return false;
|
|
292
|
+
}
|
|
293
|
+
/** Half-open ranges. The band whose max is 1 also contains 1. */
|
|
294
|
+
static bandId(version, score) {
|
|
295
|
+
return BandFor(score, version.bands)?.id ?? null;
|
|
296
|
+
}
|
|
297
|
+
static confidence(leaves) {
|
|
298
|
+
const weighted = leaves.filter(leaf => leaf.node.nodeType === 'Criterion'
|
|
299
|
+
&& leaf.pathWeight !== null
|
|
300
|
+
&& leaf.pathWeight > 0
|
|
301
|
+
&& RubricScoring.leafConfidence(leaf) !== null);
|
|
302
|
+
const sumWeight = weighted.reduce((sum, leaf) => sum + leaf.pathWeight, 0);
|
|
303
|
+
if (sumWeight === 0)
|
|
304
|
+
return null;
|
|
305
|
+
const mean = weighted.reduce((sum, leaf) => sum + RubricScoring.leafConfidence(leaf) * leaf.pathWeight, 0) / sumWeight;
|
|
306
|
+
return Round6(mean);
|
|
307
|
+
}
|
|
308
|
+
/** Path weight keeps going under a Minimum or Maximum group. Contribution does not. */
|
|
309
|
+
static assignPathWeights(children, ancestorProduct) {
|
|
310
|
+
for (const child of children) {
|
|
311
|
+
if (child.effectiveWeight === null) {
|
|
312
|
+
child.pathWeight = null;
|
|
313
|
+
RubricScoring.assignPathWeights(child.children, 0);
|
|
314
|
+
continue;
|
|
315
|
+
}
|
|
316
|
+
const product = ancestorProduct * child.effectiveWeight;
|
|
317
|
+
child.pathWeight = product;
|
|
318
|
+
RubricScoring.assignPathWeights(child.children, product);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
static assignGroupConfidence(children) {
|
|
322
|
+
for (const child of children) {
|
|
323
|
+
RubricScoring.assignGroupConfidence(child.children);
|
|
324
|
+
if (child.node.nodeType !== 'Group')
|
|
325
|
+
continue;
|
|
326
|
+
child.confidence = RubricScoring.confidence(RubricScoring.flatten(child.children));
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
static groupCompleteness(children) {
|
|
330
|
+
const leaves = RubricScoring.flatten(children).filter(calc => calc.node.nodeType === 'Criterion' && !calc.node.isAdvisory);
|
|
331
|
+
const applicable = leaves.filter(leaf => leaf.applicable).length;
|
|
332
|
+
if (applicable === 0)
|
|
333
|
+
return 1;
|
|
334
|
+
return leaves.filter(leaf => leaf.applicable && leaf.scored).length / applicable;
|
|
335
|
+
}
|
|
336
|
+
static leafConfidence(leaf) {
|
|
337
|
+
return leaf.confidence;
|
|
338
|
+
}
|
|
339
|
+
static flatten(calcs) {
|
|
340
|
+
const out = [];
|
|
341
|
+
const walk = (calc) => {
|
|
342
|
+
out.push(calc);
|
|
343
|
+
calc.children.forEach(walk);
|
|
344
|
+
};
|
|
345
|
+
calcs.forEach(walk);
|
|
346
|
+
return out;
|
|
347
|
+
}
|
|
348
|
+
static toStored(calc) {
|
|
349
|
+
return {
|
|
350
|
+
id: calc.node.id,
|
|
351
|
+
key: calc.node.key,
|
|
352
|
+
normalizedScore: calc.score === null ? null : Round6(calc.score),
|
|
353
|
+
effectiveWeight: calc.effectiveWeight === null ? null : Round6(calc.effectiveWeight),
|
|
354
|
+
overallContribution: calc.overallContribution === null ? null : Round6(calc.overallContribution),
|
|
355
|
+
gateFailed: calc.gateFailed,
|
|
356
|
+
isNotApplicable: calc.isNotApplicable,
|
|
357
|
+
isAdvisory: calc.node.isAdvisory,
|
|
358
|
+
completeness: calc.completeness === null ? null : Round6(calc.completeness),
|
|
359
|
+
confidence: calc.confidence === null ? null : Round6(calc.confidence),
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
//# sourceMappingURL=RubricScoring.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RubricScoring.js","sourceRoot":"","sources":["../src/RubricScoring.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAalD,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAc,CAAC;AAErD,qFAAqF;AACrF,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC5C,YAAmB,OAAe;QAC9B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACxC,CAAC;CACJ;AAuBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,OAAO,aAAa;IACf,MAAM,CAAC,OAAO,CAAC,KAAuB;QACzC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC9B,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;QAClG,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;QACtF,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAuC,CAAC;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AAE,IAAI,CAAC,IAAI,CAAC,UAAU;YAChC,YAAY,EAAE,IAAI,CAAC,YAAY,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC;YAC3E,UAAU,EAAE,IAAI,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;SACxE,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { RubricVersionSnapshot, VersionDiffResult } from './types.js';
|
|
2
|
+
/** A version number used to choose the base a new draft or publish is measured against. */
|
|
3
|
+
export interface VersionNumberRow {
|
|
4
|
+
id: string;
|
|
5
|
+
status: string;
|
|
6
|
+
major: number;
|
|
7
|
+
minor: number;
|
|
8
|
+
patch: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The highest Published or Retired version. A Draft is not a base. Equal numbers
|
|
12
|
+
* keep the first row. A rubric with only drafts returns null, and that publish
|
|
13
|
+
* is 1.0.0.
|
|
14
|
+
*/
|
|
15
|
+
export declare function HighestNonDraftVersion(versions: VersionNumberRow[]): VersionNumberRow | null;
|
|
16
|
+
/**
|
|
17
|
+
* Classifies a draft against the version it was cloned from.
|
|
18
|
+
*
|
|
19
|
+
* The bump describes whether scores stay comparable, not which rows moved.
|
|
20
|
+
* Major: a non-advisory node was added or removed, or a non-advisory node's parent,
|
|
21
|
+
* type, weight, scale, gate, gate minimum, not-applicable policy, rollup, or evaluator
|
|
22
|
+
* config changed, or IsAdvisory flipped, or the version's not-applicable policy changed,
|
|
23
|
+
* or a scale a non-advisory node uses changed its type, range, step, direction, or a
|
|
24
|
+
* level's value or normalized value. A node that is advisory on both sides does not
|
|
25
|
+
* produce a major bump from those scoring fields: they do not change ScoringHash.
|
|
26
|
+
* Minor: the pass threshold or minimum completeness changed, a band's range or tone
|
|
27
|
+
* changed, an advisory node was added or removed, or an advisory node's parent, type,
|
|
28
|
+
* weight, scale, gate, rollup, or evaluator config changed, or evidence/rationale
|
|
29
|
+
* requirements changed.
|
|
30
|
+
* Bands match by label first. A clone's new id with the same label is not a bump.
|
|
31
|
+
* A label rename of the same band is Patch. Sequence is Patch, so a sequence-only
|
|
32
|
+
* edit is not identical.
|
|
33
|
+
* Patch: wording, sequence, and display range only.
|
|
34
|
+
*
|
|
35
|
+
* The highest change wins. AppliedBump is the max of that and the author's request;
|
|
36
|
+
* the author may go higher and may not go lower. The first publish, with no base,
|
|
37
|
+
* is 1.0.0 and Initial. A draft identical to its base cannot be published.
|
|
38
|
+
*
|
|
39
|
+
* Parent links are compared by the parent key. A clone assigns new ids, so comparing
|
|
40
|
+
* ParentID strings would mark every node major.
|
|
41
|
+
*/
|
|
42
|
+
export declare class RubricVersionDiff {
|
|
43
|
+
static Diff(base: RubricVersionSnapshot | null, draft: RubricVersionSnapshot, requestedBump?: 'Major' | 'Minor' | 'Patch' | null): VersionDiffResult;
|
|
44
|
+
/** Canonical major-row projection. Hash this for ScoringHash. */
|
|
45
|
+
static ScoringCanonical(version: RubricVersionSnapshot): string;
|
|
46
|
+
/** Canonical full projection. Hash this for ContentHash. */
|
|
47
|
+
static ContentCanonical(version: RubricVersionSnapshot): string;
|
|
48
|
+
private static collect;
|
|
49
|
+
private static diffNode;
|
|
50
|
+
private static diffBands;
|
|
51
|
+
private static diffOneBand;
|
|
52
|
+
private static diffScales;
|
|
53
|
+
private static parentKey;
|
|
54
|
+
private static pushScalar;
|
|
55
|
+
private static highest;
|
|
56
|
+
private static applyRequest;
|
|
57
|
+
private static nextNumber;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=RubricVersionDiff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RubricVersionDiff.d.ts","sourceRoot":"","sources":["../src/RubricVersionDiff.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAsB,qBAAq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