@iqbspecs/coding-scheme
v3.4.1
Published
Data interface: coding-scheme
Downloads
487
Keywords
Readme
This package contains the data specification for coding assessment output.
It provides:
- JSON Schema:
coding-scheme.schema.json - Schema documentation: generated into
public/(based on AsyncAPI Generator) - TypeScript types for the schema (
CodingSchemeData,VariableCodingData,CodeData, ...) - A small helper class
CodingSchemefor reading/writing versioned scheme JSON
Installation
npm i @iqbspecs/coding-schemeUsage (TypeScript)
Import from the package root:
import {
CodingScheme,
type CodingSchemeData,
type VariableCodingData,
CodingSchemeVersionMajor,
CodingSchemeVersionMinor,
} from "@iqbspecs/coding-scheme";Parse a scheme and re-serialize it
CodingScheme accepts either a JSON string or a parsed object.
const raw = '{"version":"3.4","variableCodings":[]}';
const scheme = new CodingScheme(raw);
// normalized, versioned JSON string
const normalized = scheme.toString();Check compatibility of a scheme version
const status = CodingScheme.checkVersion({
version: "3.4",
variableCodings: [],
} satisfies CodingSchemeData);
// 'OK' | 'MAJOR_LESS' | 'MAJOR_GREATER' | 'MINOR_GREATER'The current library version constants are:
CodingSchemeVersionMajor:3CodingSchemeVersionMinor:4
Types
The package exports the schema types from coding-scheme.interface.ts, including:
CodingSchemeData: top-level object withversionandvariableCodingsVariableCodingData: per-variable coding configurationCodeData,RuleSet,CodingRule: rule-driven coding definitions
Public API exports
In addition to the TypeScript types, the package exports constants and helpers from coding-scheme.ts:
CodingScheme- State constants:
validStatesForDerivingValuevalidStatesForDerivingCodevalidStatesToStartDerivingstatesToReplaceByDeriveError
- Rule constants:
RuleMethodParameterCountnumericRulesbooleanRules
- Derive constants:
deriveMethodsFromValueDeriveConcatDelimiter
Schema validation and documentation generation (repo)
This repository includes scripts to validate and generate documentation.
- Validate schema against test cases:
npm run test_schema- Generate HTML docs into
public/:
npm run generate_docsRead more
- All specifications of IQB (German only)
- Learn about TBA (German only)
- Releases with change notes
