@vue-skuilder/db 0.2.30 → 0.2.31
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/{contentSource-CqJmbOZN.d.ts → contentSource-DMduBjDC.d.ts} +19 -4
- package/dist/{contentSource-B6FrSihy.d.cts → contentSource-Doh1aVBJ.d.cts} +19 -4
- package/dist/core/index.d.cts +3 -3
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.js +88 -76
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +40 -27
- package/dist/core/index.mjs.map +1 -1
- package/dist/{dataLayerProvider-DUxDqMtZ.d.cts → dataLayerProvider-BW1CBAbb.d.cts} +1 -1
- package/dist/{dataLayerProvider-B9_UCvkR.d.ts → dataLayerProvider-Cxfe4nSK.d.ts} +1 -1
- package/dist/diagnostics/index.d.cts +18 -3
- package/dist/diagnostics/index.d.ts +18 -3
- package/dist/diagnostics/index.js +159 -135
- package/dist/diagnostics/index.js.map +1 -1
- package/dist/diagnostics/index.mjs +156 -135
- package/dist/diagnostics/index.mjs.map +1 -1
- package/dist/impl/couch/index.d.cts +2 -2
- package/dist/impl/couch/index.d.ts +2 -2
- package/dist/impl/couch/index.js +92 -80
- package/dist/impl/couch/index.js.map +1 -1
- package/dist/impl/couch/index.mjs +40 -27
- package/dist/impl/couch/index.mjs.map +1 -1
- package/dist/impl/static/index.d.cts +2 -2
- package/dist/impl/static/index.d.ts +2 -2
- package/dist/impl/static/index.js +79 -67
- package/dist/impl/static/index.js.map +1 -1
- package/dist/impl/static/index.mjs +40 -27
- package/dist/impl/static/index.mjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +141 -110
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +65 -33
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/core/navigators/PipelineDebugger.ts +42 -23
- package/src/core/navigators/filters/eloDistance.ts +7 -8
- package/src/core/navigators/generators/elo.ts +8 -2
- package/src/core/navigators/generators/prescribed.ts +7 -5
- package/src/core/types/studySession.ts +12 -1
- package/src/diagnostics/derive.ts +5 -2
- package/src/diagnostics/pipeline.ts +28 -0
- package/src/diagnostics/text.ts +11 -4
- package/src/study/SessionController.ts +3 -1
- package/src/study/services/EloService.ts +33 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { U as UserDBInterface, C as CourseDBInterface, a as CoursesDBInterface } from './contentSource-
|
|
1
|
+
import { U as UserDBInterface, C as CourseDBInterface, a as CoursesDBInterface } from './contentSource-Doh1aVBJ.cjs';
|
|
2
2
|
import { C as ClassroomDBInterface, A as AdminDBInterface } from './classroomDB-DLTtLZct.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { U as UserDBInterface, C as CourseDBInterface, a as CoursesDBInterface } from './contentSource-
|
|
1
|
+
import { U as UserDBInterface, C as CourseDBInterface, a as CoursesDBInterface } from './contentSource-DMduBjDC.js';
|
|
2
2
|
import { C as ClassroomDBInterface, A as AdminDBInterface } from './classroomDB-DLTtLZct.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { C as CardData, a as DisplayableData, T as Tag, b as CardRecord, Q as QuestionRecord, c as CardHistory } from '../types-legacy-BkOYOR6U.cjs';
|
|
2
|
-
import { b as ContentNavigationStrategyData, S as StudySessionDoc, c as ScheduledCard, d as CourseRegistrationDoc, e as SessionStateSnapshot, f as StudySessionRunSummary, R as RegulatorReading, F as FilterKind,
|
|
3
|
-
export {
|
|
2
|
+
import { b as ContentNavigationStrategyData, S as StudySessionDoc, c as ScheduledCard, d as CourseRegistrationDoc, e as SessionStateSnapshot, f as StudySessionRunSummary, R as RegulatorReading, g as StudySessionRunCard, F as FilterKind, h as RegulatorName } from '../contentSource-Doh1aVBJ.cjs';
|
|
3
|
+
export { i as SessionEloEvent, j as StudySessionRunCardTrail } from '../contentSource-Doh1aVBJ.cjs';
|
|
4
4
|
import '@vue-skuilder/common';
|
|
5
5
|
import 'moment';
|
|
6
6
|
|
|
@@ -362,6 +362,8 @@ declare function fmtDelta(d: number | null): string;
|
|
|
362
362
|
/** 45s, 3m20s, 1.5h. */
|
|
363
363
|
declare function fmtDuration(seconds: number): string;
|
|
364
364
|
declare function fmtAnswer(a: unknown, max?: number): string;
|
|
365
|
+
/** Two decimals, or one significant figure when tiny; `∞` for a required card's score (persisted as null). */
|
|
366
|
+
declare function fmtScore(n: number | null): string;
|
|
365
367
|
/** One regulator reading as a line: its urgency, inputs, and multiplier. */
|
|
366
368
|
declare function regulatorText(r: RegulatorReading): string;
|
|
367
369
|
/** One run as a compact text block. */
|
|
@@ -377,6 +379,19 @@ declare function sessionText(username: string, detail: SessionDetail, extras?: {
|
|
|
377
379
|
eloLedger?: EloLedger | null;
|
|
378
380
|
}, interp?: DiagnosticsInterpreters): string;
|
|
379
381
|
|
|
382
|
+
/**
|
|
383
|
+
* What put a run's card in the queue: the hint that required it, else the
|
|
384
|
+
* generator that produced it. Its `origin` says what it is (review or new).
|
|
385
|
+
*/
|
|
386
|
+
declare function runCardSource(card: Pick<StudySessionRunCard, 'generator' | 'required'>): string;
|
|
387
|
+
/**
|
|
388
|
+
* A run's selected cards counted by source, most first. Empty for runs that
|
|
389
|
+
* don't persist their cards (before 0.2.28).
|
|
390
|
+
*/
|
|
391
|
+
declare function selectedBySource(run: Pick<StudySessionRunSummary, 'cards'>): Array<{
|
|
392
|
+
source: string;
|
|
393
|
+
count: number;
|
|
394
|
+
}>;
|
|
380
395
|
/** One generator across persisted runs. */
|
|
381
396
|
interface GeneratorRunStat {
|
|
382
397
|
/** The name runs report it under (its strategy doc's name). */
|
|
@@ -440,4 +455,4 @@ declare function pipelineRunStats(ds: LearnerDataset, opts?: {
|
|
|
440
455
|
since?: string;
|
|
441
456
|
}): PipelineRunStats;
|
|
442
457
|
|
|
443
|
-
export { type CardDossier, type CardSummary, type CouchAuth, type CourseSlice, type DatasetCardHistory, type DatasetRecord, type DiagnosticsInterpreters, type EloLedger, type FetchLearnerDumpOptions, FilterKind, type FilterRunStat, type GeneratorRunStat, type LearnerDataset, type LearnerDump, type PipelineRunStats, RegulatorName, RegulatorReading, type RegulatorRunStat, type ResponseEloDelta, SESSION_FLAGS, SESSION_FLAG_THRESHOLDS, type ServedTagStat, type SessionDetail, type SessionFlag, type SessionStateRow, SessionStateSnapshot, type SessionSummary, StudySessionDoc, StudySessionRunSummary, type TimelineEntry, type TimelineResponse, type TimelineRun, cardDossiers, dumpFileName, eloLedger, fetchLearnerDump, fmtAnswer, fmtDelta, fmtDuration, fromDump, isSkillTag, parseLearnerDump, pipelineRunStats, recordPerformance, regulatorText, runText, scoredTagDeltas, servedTags, sessionDetail, sessionText, shortTag, summarizeSession, summarizeSessions, toIsoTimestamp, userDbName };
|
|
458
|
+
export { type CardDossier, type CardSummary, type CouchAuth, type CourseSlice, type DatasetCardHistory, type DatasetRecord, type DiagnosticsInterpreters, type EloLedger, type FetchLearnerDumpOptions, FilterKind, type FilterRunStat, type GeneratorRunStat, type LearnerDataset, type LearnerDump, type PipelineRunStats, RegulatorName, RegulatorReading, type RegulatorRunStat, type ResponseEloDelta, SESSION_FLAGS, SESSION_FLAG_THRESHOLDS, type ServedTagStat, type SessionDetail, type SessionFlag, type SessionStateRow, SessionStateSnapshot, type SessionSummary, StudySessionDoc, StudySessionRunCard, StudySessionRunSummary, type TimelineEntry, type TimelineResponse, type TimelineRun, cardDossiers, dumpFileName, eloLedger, fetchLearnerDump, fmtAnswer, fmtDelta, fmtDuration, fmtScore, fromDump, isSkillTag, parseLearnerDump, pipelineRunStats, recordPerformance, regulatorText, runCardSource, runText, scoredTagDeltas, selectedBySource, servedTags, sessionDetail, sessionText, shortTag, summarizeSession, summarizeSessions, toIsoTimestamp, userDbName };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { C as CardData, a as DisplayableData, T as Tag, b as CardRecord, Q as QuestionRecord, c as CardHistory } from '../types-legacy-BkOYOR6U.js';
|
|
2
|
-
import { b as ContentNavigationStrategyData, S as StudySessionDoc, c as ScheduledCard, d as CourseRegistrationDoc, e as SessionStateSnapshot, f as StudySessionRunSummary, R as RegulatorReading, F as FilterKind,
|
|
3
|
-
export {
|
|
2
|
+
import { b as ContentNavigationStrategyData, S as StudySessionDoc, c as ScheduledCard, d as CourseRegistrationDoc, e as SessionStateSnapshot, f as StudySessionRunSummary, R as RegulatorReading, g as StudySessionRunCard, F as FilterKind, h as RegulatorName } from '../contentSource-DMduBjDC.js';
|
|
3
|
+
export { i as SessionEloEvent, j as StudySessionRunCardTrail } from '../contentSource-DMduBjDC.js';
|
|
4
4
|
import '@vue-skuilder/common';
|
|
5
5
|
import 'moment';
|
|
6
6
|
|
|
@@ -362,6 +362,8 @@ declare function fmtDelta(d: number | null): string;
|
|
|
362
362
|
/** 45s, 3m20s, 1.5h. */
|
|
363
363
|
declare function fmtDuration(seconds: number): string;
|
|
364
364
|
declare function fmtAnswer(a: unknown, max?: number): string;
|
|
365
|
+
/** Two decimals, or one significant figure when tiny; `∞` for a required card's score (persisted as null). */
|
|
366
|
+
declare function fmtScore(n: number | null): string;
|
|
365
367
|
/** One regulator reading as a line: its urgency, inputs, and multiplier. */
|
|
366
368
|
declare function regulatorText(r: RegulatorReading): string;
|
|
367
369
|
/** One run as a compact text block. */
|
|
@@ -377,6 +379,19 @@ declare function sessionText(username: string, detail: SessionDetail, extras?: {
|
|
|
377
379
|
eloLedger?: EloLedger | null;
|
|
378
380
|
}, interp?: DiagnosticsInterpreters): string;
|
|
379
381
|
|
|
382
|
+
/**
|
|
383
|
+
* What put a run's card in the queue: the hint that required it, else the
|
|
384
|
+
* generator that produced it. Its `origin` says what it is (review or new).
|
|
385
|
+
*/
|
|
386
|
+
declare function runCardSource(card: Pick<StudySessionRunCard, 'generator' | 'required'>): string;
|
|
387
|
+
/**
|
|
388
|
+
* A run's selected cards counted by source, most first. Empty for runs that
|
|
389
|
+
* don't persist their cards (before 0.2.28).
|
|
390
|
+
*/
|
|
391
|
+
declare function selectedBySource(run: Pick<StudySessionRunSummary, 'cards'>): Array<{
|
|
392
|
+
source: string;
|
|
393
|
+
count: number;
|
|
394
|
+
}>;
|
|
380
395
|
/** One generator across persisted runs. */
|
|
381
396
|
interface GeneratorRunStat {
|
|
382
397
|
/** The name runs report it under (its strategy doc's name). */
|
|
@@ -440,4 +455,4 @@ declare function pipelineRunStats(ds: LearnerDataset, opts?: {
|
|
|
440
455
|
since?: string;
|
|
441
456
|
}): PipelineRunStats;
|
|
442
457
|
|
|
443
|
-
export { type CardDossier, type CardSummary, type CouchAuth, type CourseSlice, type DatasetCardHistory, type DatasetRecord, type DiagnosticsInterpreters, type EloLedger, type FetchLearnerDumpOptions, FilterKind, type FilterRunStat, type GeneratorRunStat, type LearnerDataset, type LearnerDump, type PipelineRunStats, RegulatorName, RegulatorReading, type RegulatorRunStat, type ResponseEloDelta, SESSION_FLAGS, SESSION_FLAG_THRESHOLDS, type ServedTagStat, type SessionDetail, type SessionFlag, type SessionStateRow, SessionStateSnapshot, type SessionSummary, StudySessionDoc, StudySessionRunSummary, type TimelineEntry, type TimelineResponse, type TimelineRun, cardDossiers, dumpFileName, eloLedger, fetchLearnerDump, fmtAnswer, fmtDelta, fmtDuration, fromDump, isSkillTag, parseLearnerDump, pipelineRunStats, recordPerformance, regulatorText, runText, scoredTagDeltas, servedTags, sessionDetail, sessionText, shortTag, summarizeSession, summarizeSessions, toIsoTimestamp, userDbName };
|
|
458
|
+
export { type CardDossier, type CardSummary, type CouchAuth, type CourseSlice, type DatasetCardHistory, type DatasetRecord, type DiagnosticsInterpreters, type EloLedger, type FetchLearnerDumpOptions, FilterKind, type FilterRunStat, type GeneratorRunStat, type LearnerDataset, type LearnerDump, type PipelineRunStats, RegulatorName, RegulatorReading, type RegulatorRunStat, type ResponseEloDelta, SESSION_FLAGS, SESSION_FLAG_THRESHOLDS, type ServedTagStat, type SessionDetail, type SessionFlag, type SessionStateRow, SessionStateSnapshot, type SessionSummary, StudySessionDoc, StudySessionRunCard, StudySessionRunSummary, type TimelineEntry, type TimelineResponse, type TimelineRun, cardDossiers, dumpFileName, eloLedger, fetchLearnerDump, fmtAnswer, fmtDelta, fmtDuration, fmtScore, fromDump, isSkillTag, parseLearnerDump, pipelineRunStats, recordPerformance, regulatorText, runCardSource, runText, scoredTagDeltas, selectedBySource, servedTags, sessionDetail, sessionText, shortTag, summarizeSession, summarizeSessions, toIsoTimestamp, userDbName };
|
|
@@ -29,14 +29,17 @@ __export(diagnostics_exports, {
|
|
|
29
29
|
fmtAnswer: () => fmtAnswer,
|
|
30
30
|
fmtDelta: () => fmtDelta,
|
|
31
31
|
fmtDuration: () => fmtDuration,
|
|
32
|
+
fmtScore: () => fmtScore,
|
|
32
33
|
fromDump: () => fromDump,
|
|
33
34
|
isSkillTag: () => isSkillTag,
|
|
34
35
|
parseLearnerDump: () => parseLearnerDump,
|
|
35
36
|
pipelineRunStats: () => pipelineRunStats,
|
|
36
37
|
recordPerformance: () => recordPerformance,
|
|
37
38
|
regulatorText: () => regulatorText,
|
|
39
|
+
runCardSource: () => runCardSource,
|
|
38
40
|
runText: () => runText,
|
|
39
41
|
scoredTagDeltas: () => scoredTagDeltas,
|
|
42
|
+
selectedBySource: () => selectedBySource,
|
|
40
43
|
servedTags: () => servedTags,
|
|
41
44
|
sessionDetail: () => sessionDetail,
|
|
42
45
|
sessionText: () => sessionText,
|
|
@@ -429,7 +432,7 @@ function attachEloEvents(responses, events, interp) {
|
|
|
429
432
|
let bestGap = Infinity;
|
|
430
433
|
responses.forEach((r, i) => {
|
|
431
434
|
if (used.has(i) || r.cardId !== ev.cardId) return;
|
|
432
|
-
const gap = Math.abs(Date.parse(r.at) - evT);
|
|
435
|
+
const gap = Math.abs(Date.parse(r.at) + r.timeSpentMs - evT);
|
|
433
436
|
if (gap < bestGap) {
|
|
434
437
|
bestGap = gap;
|
|
435
438
|
best = i;
|
|
@@ -576,6 +579,150 @@ function recordPerformance(r) {
|
|
|
576
579
|
return null;
|
|
577
580
|
}
|
|
578
581
|
|
|
582
|
+
// src/diagnostics/pipeline.ts
|
|
583
|
+
function runCardSource(card) {
|
|
584
|
+
if (card.required) return `required: ${card.required}`;
|
|
585
|
+
return card.generator ?? "unknown";
|
|
586
|
+
}
|
|
587
|
+
function selectedBySource(run) {
|
|
588
|
+
const counts = /* @__PURE__ */ new Map();
|
|
589
|
+
for (const c of run.cards ?? []) {
|
|
590
|
+
if (!c.selected) continue;
|
|
591
|
+
const source = runCardSource(c);
|
|
592
|
+
counts.set(source, (counts.get(source) ?? 0) + 1);
|
|
593
|
+
}
|
|
594
|
+
return [...counts].map(([source, count]) => ({ source, count })).sort((a, b) => b.count - a.count);
|
|
595
|
+
}
|
|
596
|
+
function pipelineRunStats(ds, opts = {}) {
|
|
597
|
+
const sessions = ds.sessions.filter((s) => !opts.since || s.startTime >= opts.since);
|
|
598
|
+
const recordsBySession = /* @__PURE__ */ new Map();
|
|
599
|
+
for (const h of ds.cardHistories) {
|
|
600
|
+
for (const record of h.records) {
|
|
601
|
+
if (!record.sessionId) continue;
|
|
602
|
+
const list = recordsBySession.get(record.sessionId) ?? [];
|
|
603
|
+
list.push({ cardId: h.cardID, record });
|
|
604
|
+
recordsBySession.set(record.sessionId, list);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
const gens = /* @__PURE__ */ new Map();
|
|
608
|
+
const gen = (name) => {
|
|
609
|
+
let g = gens.get(name);
|
|
610
|
+
if (!g) {
|
|
611
|
+
g = {
|
|
612
|
+
name,
|
|
613
|
+
runs: 0,
|
|
614
|
+
cards: 0,
|
|
615
|
+
newCards: 0,
|
|
616
|
+
reviewCards: 0,
|
|
617
|
+
topScoreMax: 0,
|
|
618
|
+
topScoreLast: 0,
|
|
619
|
+
selected: 0,
|
|
620
|
+
firstAttempts: 0,
|
|
621
|
+
firstAttemptsCorrect: 0
|
|
622
|
+
};
|
|
623
|
+
gens.set(name, g);
|
|
624
|
+
}
|
|
625
|
+
return g;
|
|
626
|
+
};
|
|
627
|
+
const filters = /* @__PURE__ */ new Map();
|
|
628
|
+
const regulators = /* @__PURE__ */ new Map();
|
|
629
|
+
let runs = 0;
|
|
630
|
+
let runsWithSelection = 0;
|
|
631
|
+
let selectedUnattributed = 0;
|
|
632
|
+
let firstRunAt;
|
|
633
|
+
let lastRunAt;
|
|
634
|
+
for (const session of sessions) {
|
|
635
|
+
const originBySelectedCard = /* @__PURE__ */ new Map();
|
|
636
|
+
for (const run of session.runs ?? []) {
|
|
637
|
+
runs++;
|
|
638
|
+
if (!firstRunAt || run.at < firstRunAt) firstRunAt = run.at;
|
|
639
|
+
if (!lastRunAt || run.at > lastRunAt) lastRunAt = run.at;
|
|
640
|
+
for (const s of run.generators ?? []) {
|
|
641
|
+
const g = gen(s.name);
|
|
642
|
+
g.runs++;
|
|
643
|
+
g.cards += s.cardCount;
|
|
644
|
+
g.newCards += s.newCount;
|
|
645
|
+
g.reviewCards += s.reviewCount;
|
|
646
|
+
g.topScoreMax = Math.max(g.topScoreMax, s.topScore);
|
|
647
|
+
g.topScoreLast = s.topScore;
|
|
648
|
+
}
|
|
649
|
+
for (const f of run.filters ?? []) {
|
|
650
|
+
const acc = filters.get(f.name) ?? {
|
|
651
|
+
name: f.name,
|
|
652
|
+
runs: 0,
|
|
653
|
+
boosted: 0,
|
|
654
|
+
penalized: 0,
|
|
655
|
+
passed: 0,
|
|
656
|
+
removed: 0
|
|
657
|
+
};
|
|
658
|
+
acc.runs++;
|
|
659
|
+
if (f.kind) acc.kind = f.kind;
|
|
660
|
+
acc.boosted += f.boosted;
|
|
661
|
+
acc.penalized += f.penalized;
|
|
662
|
+
acc.passed += f.passed;
|
|
663
|
+
acc.removed += f.removed;
|
|
664
|
+
filters.set(f.name, acc);
|
|
665
|
+
}
|
|
666
|
+
for (const r of run.regulators ?? []) {
|
|
667
|
+
const acc = regulators.get(r.name) ?? {
|
|
668
|
+
name: r.name,
|
|
669
|
+
class: r.class,
|
|
670
|
+
runs: 0,
|
|
671
|
+
meanMultiplier: 0,
|
|
672
|
+
maxMultiplier: 0,
|
|
673
|
+
runsActive: 0,
|
|
674
|
+
last: r,
|
|
675
|
+
sumMultiplier: 0
|
|
676
|
+
};
|
|
677
|
+
acc.runs++;
|
|
678
|
+
acc.sumMultiplier += r.multiplier;
|
|
679
|
+
acc.maxMultiplier = Math.max(acc.maxMultiplier, r.multiplier);
|
|
680
|
+
if (r.multiplier > 1) acc.runsActive++;
|
|
681
|
+
acc.last = r;
|
|
682
|
+
regulators.set(r.name, acc);
|
|
683
|
+
}
|
|
684
|
+
if (run.cards) {
|
|
685
|
+
runsWithSelection++;
|
|
686
|
+
for (const c of run.cards) {
|
|
687
|
+
if (!c.selected) continue;
|
|
688
|
+
if (!c.generator) {
|
|
689
|
+
selectedUnattributed++;
|
|
690
|
+
continue;
|
|
691
|
+
}
|
|
692
|
+
gen(c.generator).selected++;
|
|
693
|
+
if (!originBySelectedCard.has(c.cardId)) originBySelectedCard.set(c.cardId, c.generator);
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
for (const { cardId, record } of recordsBySession.get(session.sessionId) ?? []) {
|
|
698
|
+
const origin = originBySelectedCard.get(cardId);
|
|
699
|
+
if (!origin || record.priorAttemps !== 0) continue;
|
|
700
|
+
const g = gen(origin);
|
|
701
|
+
g.firstAttempts++;
|
|
702
|
+
if (record.isCorrect === true) g.firstAttemptsCorrect++;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
return {
|
|
706
|
+
sessions: sessions.length,
|
|
707
|
+
runs,
|
|
708
|
+
runsWithSelection,
|
|
709
|
+
firstRunAt,
|
|
710
|
+
lastRunAt,
|
|
711
|
+
generators: [...gens.values()].map(({ cards, newCards, reviewCards, ...g }) => ({
|
|
712
|
+
...g,
|
|
713
|
+
meanCards: g.runs ? cards / g.runs : 0,
|
|
714
|
+
meanNew: g.runs ? newCards / g.runs : 0,
|
|
715
|
+
meanReview: g.runs ? reviewCards / g.runs : 0
|
|
716
|
+
})).sort((a, b) => b.runs - a.runs || a.name.localeCompare(b.name)),
|
|
717
|
+
filters: [...filters.values()].sort((a, b) => a.name.localeCompare(b.name)),
|
|
718
|
+
regulators: [...regulators.values()].map(({ sumMultiplier, ...r }) => ({
|
|
719
|
+
...r,
|
|
720
|
+
meanMultiplier: r.runs ? sumMultiplier / r.runs : 0
|
|
721
|
+
})),
|
|
722
|
+
selectedUnattributed
|
|
723
|
+
};
|
|
724
|
+
}
|
|
725
|
+
|
|
579
726
|
// src/diagnostics/text.ts
|
|
580
727
|
function fmtDelta(d) {
|
|
581
728
|
if (d === null) return "\u2014";
|
|
@@ -601,11 +748,12 @@ function fmtAnswer(a, max = 40) {
|
|
|
601
748
|
}
|
|
602
749
|
}
|
|
603
750
|
function fmtScore(n) {
|
|
751
|
+
if (n === null || !Number.isFinite(n)) return "\u221E";
|
|
604
752
|
return Math.abs(n) >= 0.01 || n === 0 ? n.toFixed(2) : n.toExponential(1);
|
|
605
753
|
}
|
|
606
754
|
function trailText(label, t) {
|
|
607
755
|
const lines = [
|
|
608
|
-
` ${label}: ${t.cardId} (${t.origin}, ${t
|
|
756
|
+
` ${label}: ${t.cardId} (${t.origin}, ${runCardSource(t)}) final ${fmtScore(t.score)}`
|
|
609
757
|
];
|
|
610
758
|
for (const p of t.trail) {
|
|
611
759
|
lines.push(` ${p.action} ${p.strategyName} \u2192 ${fmtScore(p.score)}: ${p.reason}`);
|
|
@@ -648,10 +796,12 @@ function runText(run) {
|
|
|
648
796
|
}
|
|
649
797
|
if (run.hints) L.push(` hints: ${JSON.stringify(run.hints)}`);
|
|
650
798
|
if (run.cards?.length) {
|
|
799
|
+
const sources = selectedBySource(run).map((s) => `${s.source} ${s.count}`);
|
|
800
|
+
if (sources.length) L.push(` selected by source: ${sources.join(" \xB7 ")}`);
|
|
651
801
|
L.push(" selection (\u2713 selected, \xB7 runner-up):");
|
|
652
802
|
for (const c of run.cards) {
|
|
653
803
|
L.push(
|
|
654
|
-
` ${c.selected ? "\u2713" : "\xB7"} ${c.cardId} (${c.origin}, ${c
|
|
804
|
+
` ${c.selected ? "\u2713" : "\xB7"} ${c.cardId} (${c.origin}, ${runCardSource(c)}) ${fmtScore(c.score)}`
|
|
655
805
|
);
|
|
656
806
|
}
|
|
657
807
|
}
|
|
@@ -701,7 +851,9 @@ function sessionText(username, detail, extras = {}, interp) {
|
|
|
701
851
|
L.push(" hints: the ReplanHints the navigator was told (_label = replan reason).");
|
|
702
852
|
L.push(' selection: the chosen cards and top runners-up. "next new in line" / "top-generated');
|
|
703
853
|
L.push(' new (sunk)": the unselected new cards worth explaining, with each score change.');
|
|
704
|
-
L.push(
|
|
854
|
+
L.push(" Each card reads (origin, source). origin: review = a scheduled review, new = anything");
|
|
855
|
+
L.push(' else. source: the generator that produced it, or "required: <hint>" when a hint forced');
|
|
856
|
+
L.push(' it. Older runs show origin "unknown" for prescribed and hint-required cards.');
|
|
705
857
|
L.push(`- RESP "\u2713/\u2717 type <cardId> [tags] Ts (attempt k) 'answer'": one presentation and`);
|
|
706
858
|
L.push(' its outcome. A trailing "ELO g:before\u2192after (\u0394) | tag:\u0394 \u2026" is the exchange it');
|
|
707
859
|
L.push(" produced. Only first attempts move ELO.");
|
|
@@ -770,137 +922,6 @@ function sessionText(username, detail, extras = {}, interp) {
|
|
|
770
922
|
}
|
|
771
923
|
return L.join("\n");
|
|
772
924
|
}
|
|
773
|
-
|
|
774
|
-
// src/diagnostics/pipeline.ts
|
|
775
|
-
function pipelineRunStats(ds, opts = {}) {
|
|
776
|
-
const sessions = ds.sessions.filter((s) => !opts.since || s.startTime >= opts.since);
|
|
777
|
-
const recordsBySession = /* @__PURE__ */ new Map();
|
|
778
|
-
for (const h of ds.cardHistories) {
|
|
779
|
-
for (const record of h.records) {
|
|
780
|
-
if (!record.sessionId) continue;
|
|
781
|
-
const list = recordsBySession.get(record.sessionId) ?? [];
|
|
782
|
-
list.push({ cardId: h.cardID, record });
|
|
783
|
-
recordsBySession.set(record.sessionId, list);
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
const gens = /* @__PURE__ */ new Map();
|
|
787
|
-
const gen = (name) => {
|
|
788
|
-
let g = gens.get(name);
|
|
789
|
-
if (!g) {
|
|
790
|
-
g = {
|
|
791
|
-
name,
|
|
792
|
-
runs: 0,
|
|
793
|
-
cards: 0,
|
|
794
|
-
newCards: 0,
|
|
795
|
-
reviewCards: 0,
|
|
796
|
-
topScoreMax: 0,
|
|
797
|
-
topScoreLast: 0,
|
|
798
|
-
selected: 0,
|
|
799
|
-
firstAttempts: 0,
|
|
800
|
-
firstAttemptsCorrect: 0
|
|
801
|
-
};
|
|
802
|
-
gens.set(name, g);
|
|
803
|
-
}
|
|
804
|
-
return g;
|
|
805
|
-
};
|
|
806
|
-
const filters = /* @__PURE__ */ new Map();
|
|
807
|
-
const regulators = /* @__PURE__ */ new Map();
|
|
808
|
-
let runs = 0;
|
|
809
|
-
let runsWithSelection = 0;
|
|
810
|
-
let selectedUnattributed = 0;
|
|
811
|
-
let firstRunAt;
|
|
812
|
-
let lastRunAt;
|
|
813
|
-
for (const session of sessions) {
|
|
814
|
-
const originBySelectedCard = /* @__PURE__ */ new Map();
|
|
815
|
-
for (const run of session.runs ?? []) {
|
|
816
|
-
runs++;
|
|
817
|
-
if (!firstRunAt || run.at < firstRunAt) firstRunAt = run.at;
|
|
818
|
-
if (!lastRunAt || run.at > lastRunAt) lastRunAt = run.at;
|
|
819
|
-
for (const s of run.generators ?? []) {
|
|
820
|
-
const g = gen(s.name);
|
|
821
|
-
g.runs++;
|
|
822
|
-
g.cards += s.cardCount;
|
|
823
|
-
g.newCards += s.newCount;
|
|
824
|
-
g.reviewCards += s.reviewCount;
|
|
825
|
-
g.topScoreMax = Math.max(g.topScoreMax, s.topScore);
|
|
826
|
-
g.topScoreLast = s.topScore;
|
|
827
|
-
}
|
|
828
|
-
for (const f of run.filters ?? []) {
|
|
829
|
-
const acc = filters.get(f.name) ?? {
|
|
830
|
-
name: f.name,
|
|
831
|
-
runs: 0,
|
|
832
|
-
boosted: 0,
|
|
833
|
-
penalized: 0,
|
|
834
|
-
passed: 0,
|
|
835
|
-
removed: 0
|
|
836
|
-
};
|
|
837
|
-
acc.runs++;
|
|
838
|
-
if (f.kind) acc.kind = f.kind;
|
|
839
|
-
acc.boosted += f.boosted;
|
|
840
|
-
acc.penalized += f.penalized;
|
|
841
|
-
acc.passed += f.passed;
|
|
842
|
-
acc.removed += f.removed;
|
|
843
|
-
filters.set(f.name, acc);
|
|
844
|
-
}
|
|
845
|
-
for (const r of run.regulators ?? []) {
|
|
846
|
-
const acc = regulators.get(r.name) ?? {
|
|
847
|
-
name: r.name,
|
|
848
|
-
class: r.class,
|
|
849
|
-
runs: 0,
|
|
850
|
-
meanMultiplier: 0,
|
|
851
|
-
maxMultiplier: 0,
|
|
852
|
-
runsActive: 0,
|
|
853
|
-
last: r,
|
|
854
|
-
sumMultiplier: 0
|
|
855
|
-
};
|
|
856
|
-
acc.runs++;
|
|
857
|
-
acc.sumMultiplier += r.multiplier;
|
|
858
|
-
acc.maxMultiplier = Math.max(acc.maxMultiplier, r.multiplier);
|
|
859
|
-
if (r.multiplier > 1) acc.runsActive++;
|
|
860
|
-
acc.last = r;
|
|
861
|
-
regulators.set(r.name, acc);
|
|
862
|
-
}
|
|
863
|
-
if (run.cards) {
|
|
864
|
-
runsWithSelection++;
|
|
865
|
-
for (const c of run.cards) {
|
|
866
|
-
if (!c.selected) continue;
|
|
867
|
-
if (!c.generator) {
|
|
868
|
-
selectedUnattributed++;
|
|
869
|
-
continue;
|
|
870
|
-
}
|
|
871
|
-
gen(c.generator).selected++;
|
|
872
|
-
if (!originBySelectedCard.has(c.cardId)) originBySelectedCard.set(c.cardId, c.generator);
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
for (const { cardId, record } of recordsBySession.get(session.sessionId) ?? []) {
|
|
877
|
-
const origin = originBySelectedCard.get(cardId);
|
|
878
|
-
if (!origin || record.priorAttemps !== 0) continue;
|
|
879
|
-
const g = gen(origin);
|
|
880
|
-
g.firstAttempts++;
|
|
881
|
-
if (record.isCorrect === true) g.firstAttemptsCorrect++;
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
return {
|
|
885
|
-
sessions: sessions.length,
|
|
886
|
-
runs,
|
|
887
|
-
runsWithSelection,
|
|
888
|
-
firstRunAt,
|
|
889
|
-
lastRunAt,
|
|
890
|
-
generators: [...gens.values()].map(({ cards, newCards, reviewCards, ...g }) => ({
|
|
891
|
-
...g,
|
|
892
|
-
meanCards: g.runs ? cards / g.runs : 0,
|
|
893
|
-
meanNew: g.runs ? newCards / g.runs : 0,
|
|
894
|
-
meanReview: g.runs ? reviewCards / g.runs : 0
|
|
895
|
-
})).sort((a, b) => b.runs - a.runs || a.name.localeCompare(b.name)),
|
|
896
|
-
filters: [...filters.values()].sort((a, b) => a.name.localeCompare(b.name)),
|
|
897
|
-
regulators: [...regulators.values()].map(({ sumMultiplier, ...r }) => ({
|
|
898
|
-
...r,
|
|
899
|
-
meanMultiplier: r.runs ? sumMultiplier / r.runs : 0
|
|
900
|
-
})),
|
|
901
|
-
selectedUnattributed
|
|
902
|
-
};
|
|
903
|
-
}
|
|
904
925
|
// Annotate the CommonJS export names for ESM import in node:
|
|
905
926
|
0 && (module.exports = {
|
|
906
927
|
SESSION_FLAGS,
|
|
@@ -912,14 +933,17 @@ function pipelineRunStats(ds, opts = {}) {
|
|
|
912
933
|
fmtAnswer,
|
|
913
934
|
fmtDelta,
|
|
914
935
|
fmtDuration,
|
|
936
|
+
fmtScore,
|
|
915
937
|
fromDump,
|
|
916
938
|
isSkillTag,
|
|
917
939
|
parseLearnerDump,
|
|
918
940
|
pipelineRunStats,
|
|
919
941
|
recordPerformance,
|
|
920
942
|
regulatorText,
|
|
943
|
+
runCardSource,
|
|
921
944
|
runText,
|
|
922
945
|
scoredTagDeltas,
|
|
946
|
+
selectedBySource,
|
|
923
947
|
servedTags,
|
|
924
948
|
sessionDetail,
|
|
925
949
|
sessionText,
|