Files
yara724-api/docs/fanavaran-stage-field-review.md
T

4.1 KiB
Raw Blame History

Expert editing of Fanavaran stage fields

The expert panel's existing Fanavaran review tab now includes accident and assessment fields, alongside the four vehicle classification fields. All supported expert-panel roles use the existing claim-detail authorization and tenant/assignment/branch checks.

Supported fields and lookups

Field Case type Sending stage Input / lookup
AccidentLocationAddress Both Base claim Non-empty address, up to 1,000 characters
AccidentCityId Both Base claim cities
AccidentReportTypeId Both Base claim accident-report-type
DmgHistoryStatus Third-party Damage case dmg-history-status (dmg-case-history-status upstream)
InspectionPlaceId Third-party Expertise inspection-place
AccidentTypeId Car-body Base claim vehicle-hull-accident-types
CulpritTypeId Car-body Base claim vehicle-hull-accident-culprit-type; never the third-party culprit codebook
AuthorityCulpritId Car-body Base claim detection-accident-culprits
CustomerFaultPercent Car-body Base claim Integer 0–100, including zero
RepairDuration Car-body Expertise Positive integer days
VehicleCurrentValue Car-body Expertise Positive integer rials, forwarded unchanged

All seven lookup definitions already existed. Options use the deployment's active Fanavaran client and its existing live/cache lookup service. Only active canonical Id values are accepted; captions are resolved server-side. Array and nested data lookup envelopes are supported. Missing/empty lookups are shown as unavailable and cannot be replaced with guessed IDs.

VehicleCurrentValue can remain unset when no expert override exists, preserving the existing case-value/policy-value fallback. A stored override cannot be cleared with null or an empty string. This review does not change the application's other valuation fields or calculate price drop.

Sending and editing

  • The initial vehicle approval accepts the applicable stage fields in the same database update. Only after that update does the existing automatic base/damage submission resume. The new panel requires valid fields and explicit consent before initial approval.
  • For already approved cases, experts save changes independently, before the relevant stage is sent. Saving fields does not itself perform a remote write.
  • Base fields lock when the base claim exists; DmgHistoryStatus locks when the damage case exists; assessment fields lock when expertise exists. Stage IDs and successful sync states are checked in both validation and the conditional database update.
  • Car-body still skips damage-case creation, sends only its base/expertise whitelist, and retains required null values. Third-party payloads retain their existing explicit null keys.
  • No attempt is made to edit already sent base fields through the unreliable hull PUT route.

Endpoints and persistence

  • GET /v2/expert-claim/request/:id/fanavaran-stage-fields: applicable field definitions, current/default/submitted values, captions, compact lookup rows and per-field editability. This read does not submit a claim or persist a preview.
  • PATCH /v2/expert-claim/request/:id/fanavaran-stage-fields: { values: { ...changedFields }, expectedVersion: 0, confirmed: true }. Values must apply to the product and belong to an unsent stage. Stale versions or stages sent during validation return 409.
  • Existing PUT .../fanavaran-vehicle-review additionally accepts optional stageFields and stageFieldsVersion for the initial combined approval. Older clients retain their existing behavior.

Validated overrides and captions are stored in optional claimCases.fanavaranFieldReview, with version, reviewer and review timestamp. History events record before/after values and verified captions. Existing claims keep their existing defaults/fallbacks until reviewed; no migration or bulk data rewrite is required.

The review covers the eleven requested fields and the existing vehicle classification. It does not expose derived totals, provider identifiers, staff-role identifiers or every remaining field in the stage documents for arbitrary editing.