Spaces:
Running
Running
Commit ·
ffbf8a2
1
Parent(s): 70e8d5c
Fix rules endpoint to return categories array
Browse files132 unmodified lines133134135136137138139132 unmodified lines// 5c. Rulesif (url.match(/\/api\/rules$/) && (options.method === 'GET' || !options.method)) {return new Response(JSON.stringify({"rules": [{"id": "SIGNAL", "name": "Traffic Signal Violations", "rules": [{"id": "SIGNAL-001", "title": "Red Light Violation", "description": "Proceeding through a red traffic signal without stopping", "severity": "CRITICAL", "visual_indicators": ["vehicle past stop line at intersection", "traffic signal showing red", "vehicle in middle of intersection", "collision at signalized intersection"], "fault_weight": 0.95, "applicable_parties": ["moving_vehicle"]}, {"id": "SIGNAL-002", "title": "Failure to Stop at Yellow Signal", "description": "Entering intersection on yellow when safe stop was possible", "severity": "HIGH", "visual_indicators": ["vehicle in intersection", "traffic signal showing yellow", "skid marks before intersection", "late braking evidence"], "fault_weight": 0.7, "applicable_parties": ["moving_vehicle"]}, {"id": "SIGNAL-003", "title": "Failure to Obey Stop Sign", "description": "Failing to come to a complete stop at a stop sign", "severity": "CRITICAL", "visual_indicators": ["stop sign visible", "vehicle past stop line", "no evidence of stopping", "collision near stop sign"], "fault_weight": 0.9, "applicable_parties": ["moving_vehicle"]}, {"id": "SIGNAL-004", "title": "Failure to Obey Yield Sign", "description": "Failing to yield right of way at a yield sign", "severity": "HIGH", "visual_indicators": ["yield sign visible", "vehicle entering without yielding", "merging collision"], "fault_weight": 0.8, "applicable_parties": ["moving_vehicle"]}, {"id": "SIGNAL-005", "title": "Disobeying Traffic Control Device", "description": "Ignoring any official traffic control sign or signal", "severity": "HIGH", "visual_indicators": ["no entry sign visible", "one way sign", "vehicle going wrong direction", "do not enter sign"], "fault_weight": 0.85, "applicable_parties": ["moving_vehicle"]}, {"id": "SIGNAL-006", "title": "Ignoring Railroad Crossing Signal", "description": "Proceeding through an active railroad crossing signal", "severity": "CRITICAL", "visual_indicators": ["railroad crossing", "crossing gates", "flashing lights at crossing"], "fault_weight": 0.95, "applicable_parties": ["moving_vehicle"]}]}, {"id": "LANE", "name": "Lane Discipline Violations", "rules": [{"id": "LANE-001", "title": "Wrong-Way Driving", "description": "Driving against the direction of traffic on a one-way road or divided highway", "severity": "CRITICAL", "visual_indicators": ["vehicle facing opposite direction", "head-on collision", "vehicle on wrong side of divided highway", "one way sign with vehicle going wrong direction"], "fault_weight": 0.98, "applicable_parties": ["moving_vehicle"]}, {"id": "LANE-002", "title": "Unsafe Lane Change", "description": "Changing lanes without signaling or when unsafe to do so", "severity": "HIGH", "visual_indicators": ["sideswipe damage", "contact marks on sides of vehicles", "vehicles in adjacent lanes", "paint transfer on vehicle sides"], "fault_weight": 0.75, "applicable_parties": ["moving_vehicle"]}, {"id": "LANE-003", "title": "Crossing Double Yellow Line", "description": "Crossing a double yellow center line to pass or turn", "severity": "HIGH", "visual_indicators": ["double yellow line visible", "vehicle across center line", "head-on or angular collision", "vehicle in opposing lane"], "fault_weight": 0.85, "applicable_parties": ["moving_vehicle"]}, {"id": "LANE-004", "title": "Failure to Maintain Lane", "description": "Drifting out of designated travel lane", "severity": "MEDIUM", "visual_indicators": ["vehicle partly in multiple lanes", "tire marks crossing lane lines", "sideswipe on lane boundary", "erratic tire tracks"], "fault_weight": 0.65, "applicable_parties": ["moving_vehicle"]}, {"id": "LANE-005", "title": "Improper Passing", "description": "Passing another vehicle illegally or unsafely", "severity": "HIGH", "visual_indicators": ["passing zone violation", "solid line crossing", "head-on collision in passing zone", "vehicle in oncoming lane"], "fault_weight": 0.8, "applicable_parties": ["moving_vehicle"]}, {"id": "LANE-006", "title": "Driving on Shoulder", "description": "Operating a vehicle on the road shoulder", "severity": "MEDIUM", "visual_indicators": ["vehicle on shoulder", "tire marks on shoulder", "collision on road shoulder", "gravel spray from shoulder"], "fault_weight": 0.6, "applicable_parties": ["moving_vehicle"]}, {"id": "LANE-007", "title": "Improper U-Turn", "description": "Making a U-turn where prohibited or unsafe", "severity": "HIGH", "visual_indicators": ["vehicle turned perpendicular to traffic", "no u-turn sign", "vehicle blocking lanes during turn"], "fault_weight": 0.8, "applicable_parties": ["moving_vehicle"]}, {"id": "LANE-008", "title": "Failure to Use Turn Signal", "description": "Turning or changing lanes without activating turn signal", "severity": "MEDIUM", "visual_indicators": ["no turn signal visible during maneuver", "sudden lane change", "unexpected turn collision"], "fault_weight": 0.55, "applicable_parties": ["moving_vehicle"]}]}, {"id": "SPEED", "name": "Speed Related Violations", "rules": [{"id": "SPEED-001", "title": "Excessive Speed", "description": "Traveling at a speed greater than posted limit or unsafe for conditions", "severity": "CRITICAL", "visual_indicators": ["long skid marks", "severe impact damage", "extensive debris field", "vehicle displacement after impact", "deployed airbags", "significant vehicle deformation"], "fault_weight": 0.85, "applicable_parties": ["moving_vehicle"]}, {"id": "SPEED-002", "title": "Too Fast for Conditions", "description": "Driving too fast for weather, road, or traffic conditions", "severity": "HIGH", "visual_indicators": ["wet road surface", "skid marks on wet road", "reduced visibility conditions", "loss of control evidence", "single vehicle off-road"], "fault_weight": 0.75, "applicable_parties": ["moving_vehicle"]}, {"id": "SPEED-003", "title": "Speed Too Slow", "description": "Driving unreasonably slow and impeding traffic", "severity": "LOW", "visual_indicators": ["rear-end collision", "slow vehicle on highway", "hazard lights on moving vehicle"], "fault_weight": 0.4, "applicable_parties": ["moving_vehicle"]}, {"id": "SPEED-004", "title": "Racing or Speed Contest", "description": "Engaging in speed competition on public roads", "severity": "CRITICAL", "visual_indicators": ["multiple vehicles with severe damage", "very long skid marks", "extreme vehicle deformation", "vehicle rollover"], "fault_weight": 0.9, "applicable_parties": ["moving_vehicle"]}, {"id": "SPEED-005", "title": "Failure to Reduce Speed in School Zone", "description": "Not reducing speed in a designated school zone", "severity": "CRITICAL", "visual_indicators": ["school zone sign", "school crossing", "pedestrian collision near school", "school zone flashing lights"], "fault_weight": 0.9, "applicable_parties": ["moving_vehicle"]}]}, {"id": "YIELD", "name": "Right of Way Violations", "rules": [{"id": "YIELD-001", "title": "Failure to Yield at Intersection", "description": "Not yielding right of way to cross traffic at an intersection", "severity": "HIGH", "visual_indicators": ["T-bone collision at intersection", "side impact at intersection", "vehicle entering intersection from side street", "angular collision"], "fault_weight": 0.85, "applicable_parties": ["moving_vehicle"]}, {"id": "YIELD-002", "title": "Failure to Yield When Turning Left", "description": "Not yielding to oncoming traffic when making a left turn", "severity": "HIGH", "visual_indicators": ["left-turning vehicle struck", "front-corner impact on turning vehicle", "collision in intersection during left turn"], "fault_weight": 0.85, "applicable_parties": ["moving_vehicle"]}, {"id": "YIELD-003", "title": "Failure to Yield to Pedestrian", "description": "Not yielding right of way to pedestrian in crosswalk", "severity": "CRITICAL", "visual_indicators": ["pedestrian in crosswalk", "pedestrian struck", "crosswalk markings visible", "pedestrian crossing sign"], "fault_weight": 0.95, "applicable_parties": ["moving_vehicle"]}, {"id": "YIELD-004", "title": "Failure to Yield When Merging", "description": "Not yielding when entering a highway or merging into traffic", "severity": "HIGH", "visual_indicators": ["merge lane collision", "on-ramp collision", "merging vehicle sideswipe", "acceleration lane impact"], "fault_weight": 0.8, "applicable_parties": ["moving_vehicle"]}, {"id": "YIELD-005", "title": "Failure to Yield to Emergency Vehicle", "description": "Not pulling over for an emergency vehicle with lights/sirens", "severity": "CRITICAL", "visual_indicators": ["emergency vehicle involved", "police car, ambulance, or fire truck", "emergency lights visible"], "fault_weight": 0.9, "applicable_parties": ["moving_vehicle"]}, {"id": "YIELD-006", "title": "Failure to Yield at Roundabout", "description": "Not yielding to traffic already in a roundabout", "severity": "HIGH", "visual_indicators": ["roundabout collision", "circular intersection", "vehicle entering roundabout", "yield sign at roundabout"], "fault_weight": 0.8, "applicable_parties": ["moving_vehicle"]}, {"id": "YIELD-007", "title": "Right of Way at Uncontrolled Intersection", "description": "Failure to yield to vehicle on the right at an uncontrolled intersection", "severity": "HIGH", "visual_indicators": ["intersection without signals or signs", "side impact collision", "residential intersection collision"], "fault_weight": 0.7, "applicable_parties": ["moving_vehicle"]}]}, {"id": "FOLLOW", "name": "Following Distance Violations", "rules": [{"id": "FOLLOW-001", "title": "Following Too Closely (Tailgating)", "description": "Not maintaining a safe following distance behind another vehicle", "severity": "HIGH", "visual_indicators": ["rear-end collision", "front damage on following vehicle", "rear damage on lead vehicle", "chain reaction collision", "short skid marks before impact"], "fault_weight": 0.9, "applicable_parties": ["following_vehicle"]}, {"id": "FOLLOW-002", "title": "Sudden Stop Causing Rear Collision", "description": "Stopping abruptly without justification causing following vehicle to collide", "severity": "MEDIUM", "visual_indicators": ["rear-end collision", "no apparent hazard ahead", "brake lights"], "fault_weight": 0.4, "applicable_parties": ["lead_vehicle"]}]}, {"id": "MAINT", "name": "Vehicle Maintenance Violations", "rules": [{"id": "MAINT-001", "title": "Defective Brakes", "description": "Operating vehicle with defective or inadequate braking system", "severity": "CRITICAL", "visual_indicators": ["very long skid marks", "no skid marks despite high-speed impact", "brake fluid on road", "brake component debris"], "fault_weight": 0.7, "applicable_parties": ["vehicle_owner"]}, {"id": "MAINT-002", "title": "Defective Tires", "description": "Operating vehicle with bald, damaged, or improper tires", "severity": "HIGH", "visual_indicators": ["tire blowout debris", "bald tires visible", "irregular tire marks", "tire tread separation"], "fault_weight": 0.65, "applicable_parties": ["vehicle_owner"]}, {"id": "MAINT-003", "title": "Defective Lights", "description": "Operating vehicle with non-functional headlights, taillights, or signals", "severity": "MEDIUM", "visual_indicators": ["broken headlight pre-collision", "no tail lights", "nighttime collision with unlit vehicle"], "fault_weight": 0.55, "applicable_parties": ["vehicle_owner"]}, {"id": "MAINT-004", "title": "Obstructed View", "description": "Driving with obstructed windshield or mirrors", "severity": "MEDIUM", "visual_indicators": ["cracked windshield", "obstructed view", "missing mirrors", "tinted windows too dark"], "fault_weight": 0.5, "applicable_parties": ["vehicle_owner"]}, {"id": "MAINT-005", "title": "Unsecured Load", "description": "Carrying unsecured cargo that falls onto roadway", "severity": "HIGH", "visual_indicators": ["cargo on road", "items fallen from vehicle", "truck load spill", "debris from cargo"], "fault_weight": 0.75, "applicable_parties": ["vehicle_owner"]}, {"id": "MAINT-006", "title": "Vehicle Overloaded", "description": "Vehicle loaded beyond safe operating capacity", "severity": "MEDIUM", "visual_indicators": ["visibly overloaded vehicle", "sagging suspension", "items stacked above roof"], "fault_weight": 0.55, "applicable_parties": ["vehicle_owner"]}]}, {"id": "PEDES", "name": "Pedestrian Related Violations", "rules": [{"id": "PEDES-001", "title": "Pedestrian Jaywalking", "description": "Pedestrian crossing road outside of designated crosswalk", "severity": "MEDIUM", "visual_indicators": ["pedestrian outside crosswalk", "pedestrian crossing mid-block", "no crosswalk markings at impact location"], "fault_weight": 0.5, "applicable_parties": ["pedestrian"]}, {"id": "PEDES-002", "title": "Pedestrian Against Signal", "description": "Pedestrian crossing against a don't walk signal", "severity": "HIGH", "visual_indicators": ["pedestrian signal showing do not walk", "pedestrian in crosswalk against signal"], "fault_weight": 0.7, "applicable_parties": ["pedestrian"]}, {"id": "PEDES-003", "title": "Driver Failure to Stop for Pedestrian in Crosswalk", "description": "Driver not stopping for pedestrian in a marked or unmarked crosswalk", "severity": "CRITICAL", "visual_indicators": ["pedestrian struck in crosswalk", "crosswalk markings visible", "pedestrian crossing sign"], "fault_weight": 0.95, "applicable_parties": ["moving_vehicle"]}, {"id": "PEDES-004", "title": "Pedestrian on Highway", "description": "Pedestrian walking on a limited-access highway", "severity": "HIGH", "visual_indicators": ["pedestrian on highway", "limited access road", "no pedestrian facilities"], "fault_weight": 0.6, "applicable_parties": ["pedestrian"]}, {"id": "PEDES-005", "title": "Failure to Stop for School Bus", "description": "Passing a stopped school bus with flashing lights", "severity": "CRITICAL", "visual_indicators": ["school bus with stop sign extended", "school bus with flashing lights", "children near school bus"], "fault_weight": 0.95, "applicable_parties": ["moving_vehicle"]}]}, {"id": "ROAD", "name": "Road Condition Violations", "rules": [{"id": "ROAD-001", "title": "Hazardous Road Condition", "description": "Road surface or design defect contributing to accident", "severity": "MEDIUM", "visual_indicators": ["pothole visible", "road surface damage", "missing road markings", "inadequate signage", "construction zone without proper markings"], "fault_weight": 0.3, "applicable_parties": ["road_authority"]}, {"id": "ROAD-002", "title": "Inadequate Lighting", "description": "Road segment without adequate lighting contributing to collision", "severity": "MEDIUM", "visual_indicators": ["dark road", "no street lights", "nighttime collision in unlit area"], "fault_weight": 0.25, "applicable_parties": ["road_authority"]}, {"id": "ROAD-003", "title": "Missing or Damaged Guard Rail", "description": "Absent or damaged barrier that could have prevented injury", "severity": "MEDIUM", "visual_indicators": ["vehicle off road", "no guard rail on curve", "damaged guard rail", "vehicle in ditch or embankment"], "fault_weight": 0.2, "applicable_parties": ["road_authority"]}, {"id": "ROAD-004", "title": "Work Zone / Construction Hazard", "description": "Improperly marked or protected construction zone", "severity": "HIGH", "visual_indicators": ["construction zone", "work zone signs", "cones, barrels, barriers", "lane closure", "construction equipment on road"], "fault_weight": 0.35, "applicable_parties": ["road_authority", "moving_vehicle"]}]}]}), { status: 200 });}// 6. Run AI Analysis132 unmodified lines133134135136137138139132 unmodified lines// 5c. Rulesif (url.match(/\/api\/rules$/) && (options.method === 'GET' || !options.method)) {return new Response(JSON.stringify({ "categories": [{ "id": "SIGNAL", "name": "Traffic Signal Violations", "rule_count": 6, "rules": [{ "id": "SIGNAL-001", "title": "Red Light Violation", "description": "Proceeding through a red traffic signal without stopping", "severity": "CRITICAL", "visual_indicators": ["vehicle past stop line at intersection", "traffic signal showing red", "vehicle in middle of intersection", "collision at signalized intersection"], "fault_weight": 0.95, "applicable_parties": ["moving_vehicle"] }, { "id": "SIGNAL-002", "title": "Failure to Stop at Yellow Signal", "description": "Entering intersection on yellow when safe stop was possible", "severity": "HIGH", "visual_indicators": ["vehicle in intersection", "traffic signal showing yellow", "skid marks before intersection", "late braking evidence"], "fault_weight": 0.7, "applicable_parties": ["moving_vehicle"] }, { "id": "SIGNAL-003", "title": "Failure to Obey Stop Sign", "description": "Failing to come to a complete stop at a stop sign", "severity": "CRITICAL", "visual_indicators": ["stop sign visible", "vehicle past stop line", "no evidence of stopping", "collision near stop sign"], "fault_weight": 0.9, "applicable_parties": ["moving_vehicle"] }, { "id": "SIGNAL-004", "title": "Failure to Obey Yield Sign", "description": "Failing to yield right of way at a yield sign", "severity": "HIGH", "visual_indicators": ["yield sign visible", "vehicle entering without yielding", "merging collision"], "fault_weight": 0.8, "applicable_parties": ["moving_vehicle"] }, { "id": "SIGNAL-005", "title": "Disobeying Traffic Control Device", "description": "Ignoring any official traffic control sign or signal", "severity": "HIGH", "visual_indicators": ["no entry sign visible", "one way sign", "vehicle going wrong direction", "do not enter sign"], "fault_weight": 0.85, "applicable_parties": ["moving_vehicle"] }, { "id": "SIGNAL-006", "title": "Ignoring Railroad Crossing Signal", "description": "Proceeding through an active railroad crossing signal", "severity": "CRITICAL", "visual_indicators": ["railroad crossing", "crossing gates", "flashing lights at crossing"], "fault_weight": 0.95, "applicable_parties": ["moving_vehicle"] }] }, { "id": "LANE", "name": "Lane Discipline Violations", "rule_count": 8, "rules": [{ "id": "LANE-001", "title": "Wrong-Way Driving", "description": "Driving against the direction of traffic on a one-way road or divided highway", "severity": "CRITICAL", "visual_indicators": ["vehicle facing opposite direction", "head-on collision", "vehicle on wrong side of divided highway", "one way sign with vehicle going wrong direction"], "fault_weight": 0.98, "applicable_parties": ["moving_vehicle"] }, { "id": "LANE-002", "title": "Unsafe Lane Change", "description": "Changing lanes without signaling or when unsafe to do so", "severity": "HIGH", "visual_indicators": ["sideswipe damage", "contact marks on sides of vehicles", "vehicles in adjacent lanes", "paint transfer on vehicle sides"], "fault_weight": 0.75, "applicable_parties": ["moving_vehicle"] }, { "id": "LANE-003", "title": "Crossing Double Yellow Line", "description": "Crossing a double yellow center line to pass or turn", "severity": "HIGH", "visual_indicators": ["double yellow line visible", "vehicle across center line", "head-on or angular collision", "vehicle in opposing lane"], "fault_weight": 0.85, "applicable_parties": ["moving_vehicle"] }, { "id": "LANE-004", "title": "Failure to Maintain Lane", "description": "Drifting out of designated travel lane", "severity": "MEDIUM", "visual_indicators": ["vehicle partly in multiple lanes", "tire marks crossing lane lines", "sideswipe on lane boundary", "erratic tire tracks"], "fault_weight": 0.65, "applicable_parties": ["moving_vehicle"] }, { "id": "LANE-005", "title": "Improper Passing", "description": "Passing another vehicle illegally or unsafely", "severity": "HIGH", "visual_indicators": ["passing zone violation", "solid line crossing", "head-on collision in passing zone", "vehicle in oncoming lane"], "fault_weight": 0.8, "applicable_parties": ["moving_vehicle"] }, { "id": "LANE-006", "title": "Driving on Shoulder", "description": "Operating a vehicle on the road shoulder", "severity": "MEDIUM", "visual_indicators": ["vehicle on shoulder", "tire marks on shoulder", "collision on road shoulder", "gravel spray from shoulder"], "fault_weight": 0.6, "applicable_parties": ["moving_vehicle"] }, { "id": "LANE-007", "title": "Improper U-Turn", "description": "Making a U-turn where prohibited or unsafe", "severity": "HIGH", "visual_indicators": ["vehicle turned perpendicular to traffic", "no u-turn sign", "vehicle blocking lanes during turn"], "fault_weight": 0.8, "applicable_parties": ["moving_vehicle"] }, { "id": "LANE-008", "title": "Failure to Use Turn Signal", "description": "Turning or changing lanes without activating turn signal", "severity": "MEDIUM", "visual_indicators": ["no turn signal visible during maneuver", "sudden lane change", "unexpected turn collision"], "fault_weight": 0.55, "applicable_parties": ["moving_vehicle"] }] }, { "id": "SPEED", "name": "Speed Related Violations", "rule_count": 5, "rules": [{ "id": "SPEED-001", "title": "Excessive Speed", "description": "Traveling at a speed greater than posted limit or unsafe for conditions", "severity": "CRITICAL", "visual_indicators": ["long skid marks", "severe impact damage", "extensive debris field", "vehicle displacement after impact", "deployed airbags", "significant vehicle deformation"], "fault_weight": 0.85, "applicable_parties": ["moving_vehicle"] }, { "id": "SPEED-002", "title": "Too Fast for Conditions", "description": "Driving too fast for weather, road, or traffic conditions", "severity": "HIGH", "visual_indicators": ["wet road surface", "skid marks on wet road", "reduced visibility conditions", "loss of control evidence", "single vehicle off-road"], "fault_weight": 0.75, "applicable_parties": ["moving_vehicle"] }, { "id": "SPEED-003", "title": "Speed Too Slow", "description": "Driving unreasonably slow and impeding traffic", "severity": "LOW", "visual_indicators": ["rear-end collision", "slow vehicle on highway", "hazard lights on moving vehicle"], "fault_weight": 0.4, "applicable_parties": ["moving_vehicle"] }, { "id": "SPEED-004", "title": "Racing or Speed Contest", "description": "Engaging in speed competition on public roads", "severity": "CRITICAL", "visual_indicators": ["multiple vehicles with severe damage", "very long skid marks", "extreme vehicle deformation", "vehicle rollover"], "fault_weight": 0.9, "applicable_parties": ["moving_vehicle"] }, { "id": "SPEED-005", "title": "Failure to Reduce Speed in School Zone", "description": "Not reducing speed in a designated school zone", "severity": "CRITICAL", "visual_indicators": ["school zone sign", "school crossing", "pedestrian collision near school", "school zone flashing lights"], "fault_weight": 0.9, "applicable_parties": ["moving_vehicle"] }] }, { "id": "YIELD", "name": "Right of Way Violations", "rule_count": 7, "rules": [{ "id": "YIELD-001", "title": "Failure to Yield at Intersection", "description": "Not yielding right of way to cross traffic at an intersection", "severity": "HIGH", "visual_indicators": ["T-bone collision at intersection", "side impact at intersection", "vehicle entering intersection from side street", "angular collision"], "fault_weight": 0.85, "applicable_parties": ["moving_vehicle"] }, { "id": "YIELD-002", "title": "Failure to Yield When Turning Left", "description": "Not yielding to oncoming traffic when making a left turn", "severity": "HIGH", "visual_indicators": ["left-turning vehicle struck", "front-corner impact on turning vehicle", "collision in intersection during left turn"], "fault_weight": 0.85, "applicable_parties": ["moving_vehicle"] }, { "id": "YIELD-003", "title": "Failure to Yield to Pedestrian", "description": "Not yielding right of way to pedestrian in crosswalk", "severity": "CRITICAL", "visual_indicators": ["pedestrian in crosswalk", "pedestrian struck", "crosswalk markings visible", "pedestrian crossing sign"], "fault_weight": 0.95, "applicable_parties": ["moving_vehicle"] }, { "id": "YIELD-004", "title": "Failure to Yield When Merging", "description": "Not yielding when entering a highway or merging into traffic", "severity": "HIGH", "visual_indicators": ["merge lane collision", "on-ramp collision", "merging vehicle sideswipe", "acceleration lane impact"], "fault_weight": 0.8, "applicable_parties": ["moving_vehicle"] }, { "id": "YIELD-005", "title": "Failure to Yield to Emergency Vehicle", "description": "Not pulling over for an emergency vehicle with lights/sirens", "severity": "CRITICAL", "visual_indicators": ["emergency vehicle involved", "police car, ambulance, or fire truck", "emergency lights visible"], "fault_weight": 0.9, "applicable_parties": ["moving_vehicle"] }, { "id": "YIELD-006", "title": "Failure to Yield at Roundabout", "description": "Not yielding to traffic already in a roundabout", "severity": "HIGH", "visual_indicators": ["roundabout collision", "circular intersection", "vehicle entering roundabout", "yield sign at roundabout"], "fault_weight": 0.8, "applicable_parties": ["moving_vehicle"] }, { "id": "YIELD-007", "title": "Right of Way at Uncontrolled Intersection", "description": "Failure to yield to vehicle on the right at an uncontrolled intersection", "severity": "HIGH", "visual_indicators": ["intersection without signals or signs", "side impact collision", "residential intersection collision"], "fault_weight": 0.7, "applicable_parties": ["moving_vehicle"] }] }, { "id": "FOLLOW", "name": "Following Distance Violations", "rule_count": 2, "rules": [{ "id": "FOLLOW-001", "title": "Following Too Closely (Tailgating)", "description": "Not maintaining a safe following distance behind another vehicle", "severity": "HIGH", "visual_indicators": ["rear-end collision", "front damage on following vehicle", "rear damage on lead vehicle", "chain reaction collision", "short skid marks before impact"], "fault_weight": 0.9, "applicable_parties": ["following_vehicle"] }, { "id": "FOLLOW-002", "title": "Sudden Stop Causing Rear Collision", "description": "Stopping abruptly without justification causing following vehicle to collide", "severity": "MEDIUM", "visual_indicators": ["rear-end collision", "no apparent hazard ahead", "brake lights"], "fault_weight": 0.4, "applicable_parties": ["lead_vehicle"] }] }, { "id": "MAINT", "name": "Vehicle Maintenance Violations", "rule_count": 6, "rules": [{ "id": "MAINT-001", "title": "Defective Brakes", "description": "Operating vehicle with defective or inadequate braking system", "severity": "CRITICAL", "visual_indicators": ["very long skid marks", "no skid marks despite high-speed impact", "brake fluid on road", "brake component debris"], "fault_weight": 0.7, "applicable_parties": ["vehicle_owner"] }, { "id": "MAINT-002", "title": "Defective Tires", "description": "Operating vehicle with bald, damaged, or improper tires", "severity": "HIGH", "visual_indicators": ["tire blowout debris", "bald tires visible", "irregular tire marks", "tire tread separation"], "fault_weight": 0.65, "applicable_parties": ["vehicle_owner"] }, { "id": "MAINT-003", "title": "Defective Lights", "description": "Operating vehicle with non-functional headlights, taillights, or signals", "severity": "MEDIUM", "visual_indicators": ["broken headlight pre-collision", "no tail lights", "nighttime collision with unlit vehicle"], "fault_weight": 0.55, "applicable_parties": ["vehicle_owner"] }, { "id": "MAINT-004", "title": "Obstructed View", "description": "Driving with obstructed windshield or mirrors", "severity": "MEDIUM", "visual_indicators": ["cracked windshield", "obstructed view", "missing mirrors", "tinted windows too dark"], "fault_weight": 0.5, "applicable_parties": ["vehicle_owner"] }, { "id": "MAINT-005", "title": "Unsecured Load", "description": "Carrying unsecured cargo that falls onto roadway", "severity": "HIGH", "visual_indicators": ["cargo on road", "items fallen from vehicle", "truck load spill", "debris from cargo"], "fault_weight": 0.75, "applicable_parties": ["vehicle_owner"] }, { "id": "MAINT-006", "title": "Vehicle Overloaded", "description": "Vehicle loaded beyond safe operating capacity", "severity": "MEDIUM", "visual_indicators": ["visibly overloaded vehicle", "sagging suspension", "items stacked above roof"], "fault_weight": 0.55, "applicable_parties": ["vehicle_owner"] }] }, { "id": "PEDES", "name": "Pedestrian Related Violations", "rule_count": 5, "rules": [{ "id": "PEDES-001", "title": "Pedestrian Jaywalking", "description": "Pedestrian crossing road outside of designated crosswalk", "severity": "MEDIUM", "visual_indicators": ["pedestrian outside crosswalk", "pedestrian crossing mid-block", "no crosswalk markings at impact location"], "fault_weight": 0.5, "applicable_parties": ["pedestrian"] }, { "id": "PEDES-002", "title": "Pedestrian Against Signal", "description": "Pedestrian crossing against a don't walk signal", "severity": "HIGH", "visual_indicators": ["pedestrian signal showing do not walk", "pedestrian in crosswalk against signal"], "fault_weight": 0.7, "applicable_parties": ["pedestrian"] }, { "id": "PEDES-003", "title": "Driver Failure to Stop for Pedestrian in Crosswalk", "description": "Driver not stopping for pedestrian in a marked or unmarked crosswalk", "severity": "CRITICAL", "visual_indicators": ["pedestrian struck in crosswalk", "crosswalk markings visible", "pedestrian crossing sign"], "fault_weight": 0.95, "applicable_parties": ["moving_vehicle"] }, { "id": "PEDES-004", "title": "Pedestrian on Highway", "description": "Pedestrian walking on a limited-access highway", "severity": "HIGH", "visual_indicators": ["pedestrian on highway", "limited access road", "no pedestrian facilities"], "fault_weight": 0.6, "applicable_parties": ["pedestrian"] }, { "id": "PEDES-005", "title": "Failure to Stop for School Bus", "description": "Passing a stopped school bus with flashing lights", "severity": "CRITICAL", "visual_indicators": ["school bus with stop sign extended", "school bus with flashing lights", "children near school bus"], "fault_weight": 0.95, "applicable_parties": ["moving_vehicle"] }] }, { "id": "ROAD", "name": "Road Condition Violations", "rule_count": 4, "rules": [{ "id": "ROAD-001", "title": "Hazardous Road Condition", "description": "Road surface or design defect contributing to accident", "severity": "MEDIUM", "visual_indicators": ["pothole visible", "road surface damage", "missing road markings", "inadequate signage", "construction zone without proper markings"], "fault_weight": 0.3, "applicable_parties": ["road_authority"] }, { "id": "ROAD-002", "title": "Inadequate Lighting", "description": "Road segment without adequate lighting contributing to collision", "severity": "MEDIUM", "visual_indicators": ["dark road", "no street lights", "nighttime collision in unlit area"], "fault_weight": 0.25, "applicable_parties": ["road_authority"] }, { "id": "ROAD-003", "title": "Missing or Damaged Guard Rail", "description": "Absent or damaged barrier that could have prevented injury", "severity": "MEDIUM", "visual_indicators": ["vehicle off road", "no guard rail on curve", "damaged guard rail", "vehicle in ditch or embankment"], "fault_weight": 0.2, "applicable_parties": ["road_authority"] }, { "id": "ROAD-004", "title": "Work Zone / Construction Hazard", "description": "Improperly marked or protected construction zone", "severity": "HIGH", "visual_indicators": ["construction zone", "work zone signs", "cones, barrels, barriers", "lane closure", "construction equipment on road"], "fault_weight": 0.35, "applicable_parties": ["road_authority", "moving_vehicle"] }] }] }), { status: 200 });}// 6. Run AI Analysis
js/alt_app.js+1-1