@telebort/question-banks 2.2.0 → 2.3.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 CHANGED
@@ -2,12 +2,104 @@
2
2
 
3
3
  Question Banks SDK for Telebort educational assessments. Provides Zod schemas, TypeScript types, client-side quiz generation, v2.0 Knowledge Graph access, and CAT (Computerized Adaptive Testing) orchestration.
4
4
 
5
- **v2.1.1** - Full CAT engine with Sympson-Hetter exposure control, IRT 4PL calibration, and 256K question bank access.
5
+ **v2.3.0** - Expanded schema validation for all 27 courses, full CAT engine with Sympson-Hetter exposure control, IRT 4PL calibration, and 1.45M+ question bank access.
6
+
7
+ ---
6
8
 
7
9
  ## Installation
8
10
 
9
11
  ```bash
12
+ # SDK + CLI (recommended)
10
13
  npm install @telebort/question-banks zod
14
+
15
+ # CLI only (no install required)
16
+ npx @telebort/question-banks <command>
17
+ ```
18
+
19
+ ---
20
+
21
+ ## Quick Start (3 Scenarios)
22
+
23
+ ### Scenario A: Validate Course Files (CLI)
24
+
25
+ Quickly validate JSON files against schemas:
26
+
27
+ ```bash
28
+ # Validate all course files in a directory
29
+ npx @telebort/question-banks validate ./data/courses/ --verbose
30
+
31
+ # Show question bank statistics
32
+ npx @telebort/question-banks stats --data-dir ./data/courses/
33
+
34
+ # Run guessability analysis (anti-guessing QA)
35
+ npx @telebort/question-banks score ./data/courses/ai-1.json
36
+ ```
37
+
38
+ ### Scenario B: Build a Quiz App (SDK)
39
+
40
+ Use the factory function to create a fully-featured SDK instance:
41
+
42
+ ```typescript
43
+ import { createQuestionBanksSDK } from '@telebort/question-banks'
44
+
45
+ const sdk = createQuestionBanksSDK({
46
+ dataSource: {
47
+ async loadCourses() {
48
+ const res = await fetch('https://content-warehouse.vercel.app/question-banks/v2.0/courses/CS1.json')
49
+ return [await res.json()]
50
+ }
51
+ }
52
+ })
53
+
54
+ // Generate a quiz
55
+ const quiz = await sdk.quiz.generateQuiz({ questionCount: 5 })
56
+
57
+ // Check an answer with feedback
58
+ const result = await sdk.validate.checkAnswer('cs-1-l1-q1', 'B', 'formative')
59
+ // { isCorrect: true, feedback: {...}, misconceptionId: null }
60
+ ```
61
+
62
+ ### Scenario C: Validate Data Structures (Schemas Only)
63
+
64
+ Import just the Zod schemas for lightweight validation:
65
+
66
+ ```typescript
67
+ import { QuestionSchema, CourseSchema } from '@telebort/question-banks/schemas'
68
+
69
+ const result = QuestionSchema.safeParse(myQuestion)
70
+ if (!result.success) {
71
+ console.error('Validation failed:', result.error.issues)
72
+ }
73
+
74
+ // TypeScript type inference
75
+ import type { Question, Course } from '@telebort/question-banks'
76
+ ```
77
+
78
+ ---
79
+
80
+ ## Entry Points
81
+
82
+ | Import Path | Purpose | Use Case |
83
+ |-------------|---------|----------|
84
+ | `@telebort/question-banks` | Full SDK factory | Quiz apps, data access |
85
+ | `@telebort/question-banks/schemas` | Zod schemas only | Lightweight validation |
86
+ | `@telebort/question-banks/validation` | ValidationClient | Answer checking |
87
+ | `@telebort/question-banks/premium` | PremiumClient (JWT) | Full API access |
88
+ | `@telebort/question-banks/irt-calibration` | IRT calibration tools | Psychometric analysis |
89
+ | `@telebort/question-banks/cat` | CAT engine | Adaptive testing |
90
+
91
+ ---
92
+
93
+ ## ⚠️ Migration Notice
94
+
95
+ If you're using the deprecated CLI package:
96
+
97
+ ```bash
98
+ # Uninstall old CLI package
99
+ npm uninstall @telebort/question-banks-cli
100
+
101
+ # Use the canonical package (CLI included)
102
+ npx @telebort/question-banks validate ./data/
11
103
  ```
12
104
 
13
105
  ## What's New in v2.1.x
@@ -19,7 +111,8 @@ npm install @telebort/question-banks zod
19
111
  - **IRT 4PL**: Full 4-parameter logistic model with `estimateAbilityEAP()` Bayesian estimation
20
112
 
21
113
  ### Scale
22
- - **256K Questions**: 26 CDN shards (~20MB each) for global delivery
114
+ - **1.45M+ Questions**: 120 JSON files (2.7GB) with 26 CDN shards for global delivery
115
+ - **CS Algorithms**: 1.35M procedurally generated questions (arrays, DP, graphs, recursion, sorting, strings)
23
116
  - **Malaysian Math**: 94K bilingual questions (KSSR 30K + KSSM 22K + SPM 34K + STPM 8K)
24
117
  - **Knowledge Graph v2.0**: 4-level taxonomy with topic-based queries
25
118
 
@@ -157,7 +250,7 @@ const knowledge = createKnowledgeModule({
157
250
  })
158
251
  ```
159
252
 
160
- ### v2.0 CDN Structure (256K Questions)
253
+ ### v2.0 CDN Structure
161
254
 
162
255
  ```
163
256
  /question-banks/v2.0/
@@ -169,7 +262,7 @@ const knowledge = createKnowledgeModule({
169
262
  └── shards/shard-{00001-00026}.json # 10K questions each (~20MB)
170
263
  ```
171
264
 
172
- **Total:** 256,037 questions in 26 CDN shards for global delivery.
265
+ **Total:** 1,449,830+ questions in 26 CDN shards for global delivery.
173
266
 
174
267
  ---
175
268
 
@@ -262,7 +355,52 @@ client.clearCache()
262
355
 
263
356
  ---
264
357
 
265
- ## SDK Interface
358
+ ## SDK API Reference
359
+
360
+ The SDK is organized into focused modules. Each module handles a specific domain:
361
+
362
+ | Module | Purpose | Key Methods |
363
+ |--------|---------|-------------|
364
+ | `sdk.data` | Data access | `getCourses()`, `getCourse()`, `getQuestion()` |
365
+ | `sdk.quiz` | Quiz generation | `generateQuiz()`, `getLessonQuiz()` |
366
+ | `sdk.validate` | Answer checking | `checkAnswer()` |
367
+ | `sdk.query` | Filtering | `filterQuestions()`, `getRandomQuestions()` |
368
+ | `sdk.search` | Full-text search | `search()`, `searchByTags()` |
369
+ | `sdk.analytics` | Statistics | `getStatistics()`, `getCourseStatistics()` |
370
+ | `sdk.knowledge` | v2.0 Knowledge Graph | `getByTopic()`, `getByDomain()`, `search()` |
371
+ | `sdk.taxonomy` | Topic taxonomy | `getDomains()`, `getTopics()` |
372
+
373
+ ### Common Workflows
374
+
375
+ **Build a quiz from a specific course:**
376
+ ```typescript
377
+ const quiz = await sdk.quiz.generateQuiz({
378
+ courseId: 'cs-1',
379
+ questionCount: 10,
380
+ difficulty: 'medium'
381
+ })
382
+ ```
383
+
384
+ **Check an answer with feedback:**
385
+ ```typescript
386
+ const result = await sdk.validate.checkAnswer('cs-1-l1-q1', 'B', 'formative')
387
+ // Returns: { isCorrect, feedback, misconceptionId }
388
+ ```
389
+
390
+ **Search by topic (v2.0 Knowledge Graph):**
391
+ ```typescript
392
+ const questions = await sdk.knowledge.getByTopic('computer-science/algorithms/sorting')
393
+ ```
394
+
395
+ **Get course statistics:**
396
+ ```typescript
397
+ const stats = await sdk.analytics.getCourseStatistics('ai-1')
398
+ // Returns: { totalQuestions, byDifficulty, byType, ... }
399
+ ```
400
+
401
+ ---
402
+
403
+ ## SDK Interface (TypeScript)
266
404
 
267
405
  ```typescript
268
406
  interface QuestionBanksSDK {
@@ -352,56 +490,77 @@ GradedAssessmentSchema // Graded result with misconception analysis
352
490
 
353
491
  ---
354
492
 
355
- ## CLI Tools
493
+ ## CLI Reference
356
494
 
357
- The SDK includes command-line tools for working with question bank data:
495
+ The CLI provides validation, statistics, and QA tools. Use via npx (no install) or globally:
358
496
 
359
497
  ```bash
360
- # Install globally
361
- npm install -g @telebort/question-banks
362
-
363
- # Or use via npx
364
- npx @telebort/question-banks <command>
498
+ npx @telebort/question-banks <command> [options]
365
499
  ```
366
500
 
367
501
  ### Commands
368
502
 
369
- #### `validate` - Validate Course JSON Files
503
+ | Command | Description |
504
+ |---------|-------------|
505
+ | `validate <path>` | Validate JSON files against schemas |
506
+ | `stats` | Show question bank statistics |
507
+ | `quiz` | Generate sample quizzes |
508
+ | `score` | Guessability analysis (anti-guessing QA) |
509
+
510
+ ### `validate` - Schema Validation
370
511
 
371
512
  ```bash
372
513
  # Validate a single file
373
- question-banks validate ./data/courses/ai-1.json
514
+ npx @telebort/question-banks validate ./data/courses/ai-1.json
374
515
 
375
516
  # Validate all files in a directory
376
- question-banks validate ./data/courses/
517
+ npx @telebort/question-banks validate ./data/courses/
377
518
 
378
- # Show all validation errors
379
- question-banks validate ./data/courses/ --verbose
519
+ # Verbose output with all errors
520
+ npx @telebort/question-banks validate ./data/courses/ --verbose
380
521
  ```
381
522
 
382
- #### `stats` - Show Statistics
523
+ ### `stats` - Question Bank Statistics
383
524
 
384
525
  ```bash
385
- # Show aggregate statistics
386
- question-banks stats --data-dir ./data/courses/
526
+ # Show aggregate statistics across all courses
527
+ npx @telebort/question-banks stats --data-dir ./data/courses/
387
528
 
388
- # Show statistics for a specific course
389
- question-banks stats --course ai-1 --data-dir ./data/courses/
529
+ # Statistics for a specific course
530
+ npx @telebort/question-banks stats --course ai-1 --data-dir ./data/courses/
390
531
  ```
391
532
 
392
- #### `quiz` - Generate Sample Quizzes
533
+ ### `quiz` - Sample Quiz Generation
393
534
 
394
535
  ```bash
395
536
  # Generate 5 random questions
396
- question-banks quiz --data-dir ./data/courses/
537
+ npx @telebort/question-banks quiz --data-dir ./data/courses/
397
538
 
398
539
  # Generate 10 questions from a specific course
399
- question-banks quiz --course ai-1 --count 10 --data-dir ./data/courses/
540
+ npx @telebort/question-banks quiz --course ai-1 --count 10 --data-dir ./data/courses/
400
541
 
401
- # Filter by difficulty and show answers
402
- question-banks quiz --difficulty hard --show-answers --data-dir ./data/courses/
542
+ # Filter by difficulty and show correct answers
543
+ npx @telebort/question-banks quiz --difficulty hard --show-answers --data-dir ./data/courses/
403
544
  ```
404
545
 
546
+ ### `score` - Guessability Analysis
547
+
548
+ Run psychometric QA analysis to detect testwiseness vulnerabilities:
549
+
550
+ ```bash
551
+ # Analyze a single course file
552
+ npx @telebort/question-banks score ./data/courses/ai-1.json
553
+
554
+ # Analyze with detailed output
555
+ npx @telebort/question-banks score ./data/courses/ --verbose
556
+ ```
557
+
558
+ **Output includes:**
559
+ - Guessability score (0-100, lower is better)
560
+ - Distractor quality metrics
561
+ - Option length bias detection
562
+ - Grammatical cue warnings
563
+
405
564
  ---
406
565
 
407
566
  ## Question Schema (v1.1)
@@ -471,6 +630,14 @@ MIT
471
630
 
472
631
  ---
473
632
 
633
+ ## Related Documentation
634
+
635
+ - [ARCHITECTURE.md](./ARCHITECTURE.md) - Technical deep-dive (CAT, IRT, CDN)
636
+ - [KNOWLEDGE-GRAPH.md](./KNOWLEDGE-GRAPH.md) - Topic-based query guide
637
+ - [../ECOSYSTEM-OVERVIEW.md](../ECOSYSTEM-OVERVIEW.md) - High-level ecosystem overview
638
+
639
+ ---
640
+
474
641
  ## Support
475
642
 
476
643
  - Issues: [GitHub Issues](https://github.com/telebort/question-banks/issues)
@@ -19,22 +19,52 @@ var OptionSchema = zod.z.object({
19
19
  text: zod.z.string().min(1),
20
20
  isCorrect: zod.z.boolean(),
21
21
  // v1.1 fields - optional for backward compatibility
22
- misconceptionId: zod.z.string().optional(),
22
+ misconceptionId: zod.z.string().nullish(),
23
23
  feedback: FeedbackSchema.optional()
24
24
  });
25
25
  var QuestionTypeSchema = zod.z.enum([
26
+ // Core assessment types (original v1.0)
26
27
  "vocabulary",
27
28
  "code_understanding",
28
29
  "problem_solving",
29
30
  "application",
30
- "reflection"
31
+ "reflection",
32
+ // Code-focused types
33
+ "debugging",
34
+ "trace",
35
+ "predict",
36
+ // Higher-order thinking
37
+ "analyze",
38
+ "evaluation",
39
+ "synthesis",
40
+ "design",
41
+ "conceptual",
42
+ "explain",
43
+ // Domain-specific
44
+ "bebras",
45
+ "blockmodel",
46
+ "ethical_reasoning"
31
47
  ]);
32
48
  var QuestionArchetypeSchema = zod.z.enum([
49
+ // Original archetypes (v1.1)
33
50
  "vocabulary",
34
51
  "trace",
35
52
  "bebras",
36
53
  "blockmodel",
37
- "parsons"
54
+ "parsons",
55
+ // Assessment patterns
56
+ "application",
57
+ "problem_solving",
58
+ "debugging",
59
+ "predict",
60
+ "explain",
61
+ "evaluation",
62
+ "reflection",
63
+ "conceptual",
64
+ "analysis",
65
+ "design",
66
+ "synthesis",
67
+ "code"
38
68
  ]);
39
69
  var DifficultySchema = zod.z.enum(["easy", "medium", "hard", "challenge"]);
40
70
  var BloomsTaxonomySchema = zod.z.enum([
@@ -58,8 +88,8 @@ var QuestionMetadataSchema = zod.z.object({
58
88
  });
59
89
  var QuestionSchema = zod.z.object({
60
90
  // Identifiers
61
- questionId: zod.z.string().regex(/^[a-z0-9-]+-l\d+-q\d+$/),
62
- globalId: zod.z.string().regex(/^exit-ticket-\d{4}$/),
91
+ questionId: zod.z.string().regex(/^[a-z0-9][-a-z0-9]*-(?:l\d+-)?q\d+$/),
92
+ globalId: zod.z.string().regex(/^exit-ticket-[a-z0-9][-a-z0-9]*$/),
63
93
  questionNumber: zod.z.number().int().positive().max(5),
64
94
  // Classification
65
95
  questionType: QuestionTypeSchema,
@@ -99,6 +129,8 @@ var CourseDomainSchema = zod.z.enum([
99
129
  "ai_ml_cv",
100
130
  "ai_generative",
101
131
  "ai_advanced",
132
+ "ai",
133
+ // Prompt Engineering (general AI)
102
134
  // Web Development
103
135
  "web_development",
104
136
  // Mobile Development
@@ -108,11 +140,21 @@ var CourseDomainSchema = zod.z.enum([
108
140
  "block_based",
109
141
  "python_programming",
110
142
  "design",
143
+ "artificial_intelligence",
144
+ // Block-based AI courses (BBAI)
145
+ // Computer Science
146
+ "cs_foundations",
147
+ // CS1-CS4 courses
111
148
  // Foundation
112
149
  "foundation",
113
- "creative_computing"
150
+ "creative_computing",
151
+ // Utility / Tools
152
+ "tools"
153
+ // IDE Setup, Git, Vibe Coding
114
154
  ]);
115
155
  var CourseTierSchema = zod.z.enum([
156
+ "beginner",
157
+ // Block-based courses (BBW, BBP, BBD, BBAI)
116
158
  "foundation",
117
159
  "intermediate",
118
160
  "advanced"