Skip to content

Commit 15582de

Browse files
committed
refactor: remove parseGradeFromStandard — grade is always explicit
1 parent 2572a29 commit 15582de

4 files changed

Lines changed: 0 additions & 43 deletions

File tree

sdks/typescript/src/knowledge-graph/client.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ export class KnowledgeGraphClient {
9090
}
9191

9292
async getStandardsByGrade(grade: string): Promise<AcademicStandard[]> {
93-
// Mathematical Practice standards excluded by normalizedStatementType=Standard —
94-
// matching the original Python notebook behaviour.
9593
const url =
9694
`${KG_BASE_URL}/academic-standards?limit=500` +
9795
`&standardsFrameworkCaseIdentifierUUID=${CCSS_FRAMEWORK_UUID}` +
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
export type { AcademicStandard, LearningComponent, StandardInfo } from './types.js';
2-
export { parseGradeFromStandard } from './types.js';
32
export { KnowledgeGraphClient } from './client.js';

sdks/typescript/src/knowledge-graph/types.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { ValidationError } from '../errors.js';
2-
31
// Generated spec types are in kg-api.d.ts — see npm run generate:kg-types.
42
// We use string for normalizedStatementType and gradeLevel rather than the
53
// spec's strict enum types so the interfaces remain compatible if the API
@@ -31,15 +29,3 @@ export interface StandardInfo {
3129
uuid: string;
3230
description?: string;
3331
}
34-
35-
// ---------------------------------------------------------------------------
36-
37-
const VALID_GRADES = new Set(['K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12']);
38-
39-
export function parseGradeFromStandard(code: string): string {
40-
const match = code.match(/^(K|\d+)\./);
41-
if (!match || !VALID_GRADES.has(match[1])) {
42-
throw new ValidationError(`Cannot parse grade from standard code: "${code}"`);
43-
}
44-
return match[1];
45-
}

sdks/typescript/tests/unit/evaluators/math/standards-alignment.test.ts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
MathStandardsAlignmentEvaluator,
44
type MathStandardsAlignmentEvaluatorConfig,
55
} from '../../../../src/evaluators/math/standards-alignment.js';
6-
import { parseGradeFromStandard } from '../../../../src/knowledge-graph/types.js';
76
import { ConfigurationError, ValidationError, APIError } from '../../../../src/errors.js';
87
import type { LLMProvider } from '../../../../src/providers/base.js';
98
import type { KnowledgeGraphClient } from '../../../../src/knowledge-graph/client.js';
@@ -491,28 +490,3 @@ describe('MathStandardsAlignmentEvaluator - evaluateByGrade', () => {
491490
});
492491
});
493492

494-
// ---------------------------------------------------------------------------
495-
// parseGradeFromStandard
496-
// ---------------------------------------------------------------------------
497-
498-
describe('parseGradeFromStandard', () => {
499-
it.each([
500-
['K.CC.A.1', 'K'],
501-
['1.OA.A.1', '1'],
502-
['3.MD.C.7.d', '3'],
503-
['10.NBT.A.1', '10'],
504-
['12.F.BF.1', '12'],
505-
])('%s → %s', (code, expected) => {
506-
expect(parseGradeFromStandard(code)).toBe(expected);
507-
});
508-
509-
it.each([
510-
['X.MD.C.7'],
511-
['ZZ.OA.A.1'],
512-
['no-dots'],
513-
['13.MD.C.7'],
514-
['HSA-APR.A.1'], // HS codes not supported — use grade 9/10/11/12 directly
515-
])('throws ValidationError for "%s"', (code) => {
516-
expect(() => parseGradeFromStandard(code)).toThrow(ValidationError);
517-
});
518-
});

0 commit comments

Comments
 (0)