Overview
The RAADS-R application uses strongly-typed TypeScript interfaces defined insrc/data/dataset.schema.ts. These types ensure type safety across the scoring engine, UI components, and state management.
Core Data Types
Item
Represents a single question in the assessment.dataset.schema.ts:9
Unique identifier (1-80). Item IDs are sequential with no gaps.
The question text displayed to the user.
Determines scoring direction:
true: Normative item (reversed scoring)false: Symptom item (standard scoring)
Domain key this item belongs to:
"social", "interests", "language", or "sensory"Domain
Defines a scoring domain with its items and thresholds.dataset.schema.ts:1
Domain identifier:
social, interests, language, sensoryHuman-readable domain name for display.
Array of item IDs belonging to this domain. No item appears in multiple domains.
Maximum possible score for this domain (number of items × 3).
Clinical threshold for this domain. Scores strictly greater than this value indicate above-cutoff.
DatasetMeta
Container for assessment metadata and configuration.dataset.schema.ts:16
Total number of items in the assessment (80).
Array of exactly 4 response option labels:
- “True now and when I was young”
- “True only now”
- “True only when I was younger than 16”
- “Never true”
Array of all domain configurations.
Overall clinical threshold (65). Total scores > 65 indicate above-cutoff.
Dataset
Root data structure containing all assessment data.dataset.schema.ts:23
Response Types
Response
A single user response to a question.dataset.schema.ts:28
Response values are literal types (0-3) corresponding to the four response options. This provides compile-time safety against invalid response values.
Responses
Collection of all user responses, keyed by item ID.dataset.schema.ts:29
Results Types
DomainResult
Scoring results for a single domain.dataset.schema.ts:31
Domain identifier (matches
Domain.key)Human-readable domain name
Computed score for this domain (sum of all item scores)
Maximum possible score (copied from domain definition)
Clinical threshold (copied from domain definition)
true if score > cutoff (strict comparison)Results
Complete scoring results including total and per-domain scores.dataset.schema.ts:40
Sum of all domain scores (0-240)
Maximum possible total score (always 240)
Overall clinical threshold (65)
true if total > totalCutoffArray of per-domain scoring results
Data Validation
The dataset structure is validated through comprehensive tests insrc/__tests__/dataset.test.ts:
- Structural Validation
- Domain Integrity
- Normative Items
- Score Constraints
- Exactly 80 items with IDs 1-80 (no gaps)
- All required fields present and correctly typed
- 4 response options in correct order
- Domain item counts: Social (39), Interests (14), Language (7), Sensory (20)
Type Safety Examples
Implementation Files
- Schema Definition:
src/data/dataset.schema.ts - Dataset JSON:
src/data/dataset.json - Validation Tests:
src/__tests__/dataset.test.ts