[!IMPORTANT] Every fixture, rulebook, and calculator output in this lab is synthetic and non-binding. Nothing here represents an actual Desjardins product, rate, or policy, and no regulator or insurer has reviewed or endorsed this material.
Overview
| Item | Value |
|---|---|
| Duration | 20 minutes |
| Level | Beginner |
| Prerequisites | Lab 00 |
Learning Objectives
By the end of this lab, you will be able to:
- Describe the five synthetic fixtures in
data/synthetic/fixtures/and the calculation status each one produces - Explain how
data/synthetic/quote-contract.schema.jsonusesif/then/elseto tie a calculation’s status to itsamountCentsandissuesfields - Explain how the schema ties a case’s workflow state to its
approvedRevisionfield - Validate every fixture against the schema yourself
Exercises
Exercise 1.1: Read the Fixture Set
Open each file in data/synthetic/fixtures/ and note its fixtureId, input, and expectedCalculation.status:
| Fixture | Vehicle class | Plan | Expected status |
|---|---|---|---|
| case-syn-001.json | COMPACT | TRAINING_EXTENDED | READY (100000 cents) |
| case-syn-002-sedan.json | SEDAN | TRAINING_BASIC | READY |
| case-syn-003-unsupported.json | UNKNOWN | TRAINING_BASIC | UNSUPPORTED |
| case-syn-004-revision.json | SEDAN | TRAINING_EXTENDED | READY (draftRevision 2) |
| case-syn-005-missing-plan.json | COMPACT | null | INCOMPLETE |
Every fixture carries "dataClass": "SYNTHETIC_ONLY" and the same RULEBOOK-SYN-ON rulebook, pinned at "authority": "WORKSHOP_AUTHORS_ONLY".
Exercise 1.2: Read the Schema’s Conditional Logic
Open data/synthetic/quote-contract.schema.json and find the calculation definition’s if/then/else block. When status is READY, the schema requires a populated amountCents, exactly three ruleIds, and zero issues. For any other status, it requires a null amountCents and at least one issue code. Find the equivalent rule for workflow: an APPROVED state requires a non-null approvedRevision, while every other state requires it to be null.
Exercise 1.3: Validate the Fixtures Against the Schema
python -c "
import json, pathlib
from jsonschema import validate
schema = json.loads(pathlib.Path('data/synthetic/quote-contract.schema.json').read_text())
for path in sorted(pathlib.Path('data/synthetic/fixtures').glob('*.json')):
fixture = json.loads(path.read_text())
validate(instance=fixture, schema=schema)
print(f'{path.name}: OK')
"
Expected result: every fixture prints OK, with no ValidationError raised.
Exercise 1.4 (Hands-on): Explain the Unsupported and Revision Cases
Answer, in your own words, using only the fixture content and the schema:
- Why does
case-syn-003-unsupported.jsonproduceUNSUPPORTEDinstead ofINCOMPLETE, even though every input field is present? case-syn-004-revision.jsonhasdraftRevision: 2. What does that tell you about this case’s history, and why would the schema rejectdraftRevision: 2paired withapprovedRevision: nullif the workflow state wereAPPROVED?
Validation Checklist
- You can name all five fixtures and the calculation status each is expected to produce
- The Exercise 1.3 script prints
OKfor every fixture with no validation error - You can explain why an unknown vehicle class produces
UNSUPPORTEDrather than a missing-field issue - You can explain the schema’s
APPROVEDrequiresapprovedRevisionrule from Exercise 1.2
Knowledge Check
- Which fixture is designed to exercise revision invalidation, and which field number changed to signal it?
- What value does
rulebook.authoritycarry on every fixture, and why does that matter for a learner reading this data?
Next Steps
Continue to Lab 02: The Deterministic Calculator.