Validation Rules
What it does
DOSE validates every record before it reaches RxClaim. Validation catches bad data early — at DOSE — rather than letting it fail inside RxClaim with a harder-to-diagnose error.
When a record fails validation, DOSE rejects it immediately, records the specific violations, and notifies the upstream client (CLIC) so it can correct and resubmit.
Validation layers
DOSE has two validation layers. Only the first is currently built:
| Layer | Status | What it checks |
|---|---|---|
| Schema validation | ✅ Live | Required fields present, correct format (6 standard GPI fields) |
| Business validation | 🔲 Planned | Cross-field consistency, pre-RxClaim business rules (~40 rules) |
Schema validation — what is checked today
Every DOSE record must pass these 6 field checks before it can proceed:
| Field | Rule |
|---|---|
gpi | Must be present, must be exactly 14 characters |
msc | Must be present |
rxOtc | Must be present, valid indicator value |
fromDate | Must be present, valid date format |
thruDate | Must be present, valid date format |
drugStatus | Must be present, valid status code |
What happens on failure
The upstream client receives a notification containing the record ID and the specific field violations — enough to identify and fix the problem record without re-submitting the whole file.
Business validation — what is planned
The business validation layer (~40 rules) will enforce cross-field consistency that cannot be expressed in a JSON Schema. Examples of the kinds of rules planned:
fromDatemust be beforethruDate- ADD action records must not already exist as active in RxClaim
- GPI format must match category-specific patterns
- Specific field combinations required for certain drug categories
This layer has a placeholder in the processing pipeline and will be implemented in RxDose-BusinessValidator-lib.
Technical reference
| Detail | Value |
|---|---|
| Schema library | RxDose-Validator-lib |
| Schema standard | JSON Schema Draft 2020-12 |
| Upstream notification | CloudEvents 1.0 via RxDose-KafkaUtil-lib (mTLS) |
| Business validation | RxDose-BusinessValidator-lib (not yet built) |