Spaces:
Running
Running
File size: 4,586 Bytes
be54038 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | // ββ Geometry ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
export interface Location {
page: number
/** [x0%, y0%, x1%, y1%] β top-left origin, 0β100 range, percent of page */
bbox: [number, number, number, number]
}
export interface FieldProvenance {
field_path: string
extracted_value: string
matched_text: string
/** 0.0β1.0 */
match_score: number
source_filename: string
location: Location
}
// ββ Golden Record sub-types βββββββββββββββββββββββββββββββββββββββββββββββ
export interface PeriodOfCover {
start_date?: string
expiry_date?: string
issue_date?: string
}
export interface PolicyHeader {
policy_number?: string
insurer?: string
product_name?: string
period_of_cover?: PeriodOfCover
}
export interface SecurityDetails {
has_security_device?: boolean
tracker_fitted?: boolean
modifications?: string
}
export interface VehicleDetails {
vrm?: string
make?: string
model?: string
fuel_type?: string
transmission?: string
estimated_value?: string
annual_mileage?: number
overnight_postcode?: string
kept_location?: string
security?: SecurityDetails
}
export interface Driver {
name: string
dob?: string
relationship?: string
occupation?: string
license_type?: string
is_main_driver: boolean
specific_excess?: number
}
export interface NoClaimsDiscount {
years?: number
protected?: boolean
}
export interface ExcessBreakdown {
standard_compulsory?: number
voluntary?: number
total_accidental_damage?: number
fire?: number
theft?: number
windscreen_repair?: number
windscreen_replacement?: number
own_repairer_additional_excess?: number
}
export interface CoverAndExcesses {
cover_type?: string
class_of_use?: string
driving_other_cars?: boolean
no_claims_discount?: NoClaimsDiscount
excess_breakdown?: ExcessBreakdown
}
export interface OptionalExtras {
motor_legal_protection?: number | string
breakdown_roadside_assistance?: number | string
enhanced_personal_accident?: number | string
hire_car?: number | string
key_cover?: number | string
}
export interface FinancialSummary {
total_annual_premium?: number
optional_extras?: OptionalExtras
}
export interface AdditionalRiskData {
home_ownership?: string
children_under_16?: boolean
number_of_cars_in_household?: number
non_motoring_convictions?: boolean
endorsements?: string
}
export interface Citations {
vehicle_model?: string
excess_details?: string
class_of_use?: string
driver_ages?: string
premium_breakdown?: string
}
export interface GoldenRecord {
policy_header?: PolicyHeader
vehicle_details?: VehicleDetails
driver_details: Driver[]
cover_and_excesses?: CoverAndExcesses
financial_summary?: FinancialSummary
additional_risk_data?: AdditionalRiskData
citations?: Citations
}
export interface ConflictEntry {
field: string
schedule_value?: string
certificate_value?: string
winner: 'schedule' | 'certificate' | 'fallback' | string
}
// ββ Session βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
export interface SessionData {
record: GoldenRecord
provenance: FieldProvenance[]
conflicts?: ConflictEntry[]
session_id: string
}
// ββ Review state ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
export type ReviewAction = 'verify' | 'reject' | 'override'
export interface FieldReview {
action: ReviewAction
overridden_value?: string
reviewer?: string
}
export type ReviewState = Record<string, FieldReview>
// ββ Flat field entry (used by the form panel) βββββββββββββββββββββββββββββ
export interface FieldEntry {
fieldPath: string
label: string
value: string | null
section: string
provenance?: FieldProvenance
}
// ββ API response types ββββββββββββββββββββββββββββββββββββββββββββββββββββ
export interface ProcessResponse {
session_id: string
fields_extracted: number
provenance_coverage: number
}
|