# Mapping exercise — vehicle registry to claim record From part 2 of API Integration for Analysts — cybernotes.it/trainings/api-integration/2-requirements-and-design/ About 30 minutes. You map the fields an external vehicle registry returns onto the vehicle details a claims system stores, and find what the mapping cannot answer. Everything here is synthetic. You need this page and the registry's specification: cybernotes.it/resources/api-specs/vehicle-registry-api.yaml The data mapping template among the same materials gives you the table to fill in. ## The situation A repair shop reports a claim. The claims system looks the vehicle up in the national vehicle registry and stores the vehicle's details with the claim. The registry is an external system with its own conventions: snake_case names, lowercase code lists, dates written DD.MM.YYYY. ## The source `GET /vehicles/{reg_number}` of the registry returns a `vehicle_record`. Read its schema in the specification before you go on: the field names, which are required, the formats, the allowed values and the descriptions. ## The target The claims system stores these vehicle details with a claim. This record is internal to the claims system; it is defined here for the exercise and is not part of a published specification. | Field | Type and format | Required | Notes | |-------|-----------------|----------|-------| | `registrationNumber` | string | yes | uppercase, no spaces | | `vin` | string, 17 characters | no | | | `make` | string | yes | | | `model` | string | yes | | | `firstRegistrationDate` | date, YYYY-MM-DD | no | | | `fuelType` | one of PETROL, DIESEL, ELECTRIC, HYBRID, OTHER | no | | | `engineCapacityCcm` | whole number | no | | | `ownerType` | one of PRIVATE, COMPANY | no | | ## Your tasks 1. **Map target-first.** For each of the eight target fields, find the source field and write the rule that turns one into the other. 2. **Map the code lists value by value.** Write one line per source value for `fuel_type` and for `owner_type`. 3. **Decide the empty cases.** For each target field: what is stored when the source field is missing, and what when it is present but cannot be converted? 4. **Look at what is left over.** List the source fields that have no target. For each, ask "do we care?" and write down who could answer. 5. **Write the gap log.** Each gap as a question to a named role, not as a complaint. Stop here and do the exercise before reading on. --- ## One worked answer Yours may differ in wording. What matters is whether you found the gaps. ### Field mapping | Target | Source | Rule | Source missing → | Source invalid → | |--------|--------|------|------------------|------------------| | `registrationNumber` | `reg_number` | uppercase, remove spaces | cannot happen: required | reject the lookup | | `vin` | `vin_code` | copy | store as unknown | store as unknown, log a warning | | `make` | `make` | copy | cannot happen: required | — | | `model` | `model` | copy | cannot happen: required | — | | `firstRegistrationDate` | `first_reg_date` | DD.MM.YYYY → YYYY-MM-DD | cannot happen: required | store as unknown, log a warning | | `fuelType` | `fuel_type` | code list E1 | store as unknown | see GAP-1 | | `engineCapacityCcm` | `engine_capacity_ccm` | copy | store as unknown | store as unknown | | `ownerType` | `owner_type` | code list E2 | store as unknown | store as unknown, log a warning | Two details in that table are easy to miss. - The registry says `vin_code` "may be absent for vehicles registered before 1995", and `engine_capacity_ccm` is "absent for electric". Absent is not zero and not an empty string. If the claims system stores 0 cubic centimetres for an electric car, a later report will treat it as a measurement. - `first_reg_date` is a string. "31.02.2019" is a well-formed string and not a date. The rule has to say what happens then. ### Code lists **E1: `fuel_type` → `fuelType`** | Source | Target | Note | |--------|--------|------| | petrol | PETROL | | | diesel | DIESEL | | | electric | ELECTRIC | | | hybrid | HYBRID | | | gas | ? | the target has no such value — GAP-1 | | other | OTHER | | A rule that says "convert to uppercase" would have produced GAS, a value the claims system does not have. Whether that is rejected, stored wrongly or silently dropped depends on code nobody has reviewed. Walking the values one by one is what shows it. **E2: `owner_type` → `ownerType`** | Source | Target | |--------|--------| | private | PRIVATE | | company | COMPANY | This one is complete. It still needs the rule for a value that appears later: reject, or store as unknown and warn. ### Source fields with no target | Source field | Do we care? | Who could answer | |--------------|-------------|------------------| | `status` | Yes, at least for one value. The registry marks a vehicle as `stolen`, and its own description says that matters for theft claims. Dropping the field drops that fact. `deregistered` raises a second question: should a claim for a deregistered vehicle be registered at all? | claims handling; product owner | | `inspection_valid_to` | Unknown. Whether an expired technical inspection matters for a claim is a business question. | claims handling | | `color` | Probably not. Say so, so that dropping it is a decision. | product owner | ### Gap log | ID | Gap | The question | To | |----|-----|--------------|----| | GAP-1 | No target value for fuel type `gas` | Which value should a gas-fuelled vehicle get — a new value in our list, or OTHER? And what should happen to a value we have never seen? | product owner | | GAP-2 | `status` has no target field | Should claims handlers see that a vehicle is flagged stolen or deregistered, and should such a claim be routed differently? | claims handling | | GAP-3 | `inspection_valid_to` has no target field | Does an expired technical inspection matter when a claim is assessed? | claims handling | | GAP-4 | No rule for unknown code-list values | If the registry adds a value tomorrow, do we reject the record or store it as unknown and warn someone? | product owner, with the tech lead | ### What the exercise is for GAP-2 is a new requirement: it was nowhere in the brief, and it surfaced only because a field with no home was questioned instead of dropped. GAP-1 would have become a production defect that no test written from the happy path would catch. Neither needed technical depth to find. Both needed the mapping to be done field by field and value by value. CyberNotes · cybernotes.it · CC BY-SA 4.0