@extends('layouts.app') @section('title', 'Element 8: Incident Reporting & Analysis') @section('content')

Element 8: Incident Reporting, Investigation and Analysis

Report incidents and near-misses, conduct root cause analysis, track corrective actions with trend analysis

Incident Reporting Dashboard

{{ $incidents->where('incident_type', 'incident')->count() }}

Total incidents reported

{{ $incidents->where('incident_type', 'near_miss')->count() }}

Near-miss reports

@php $rootCauseCompleted = $incidents->filter(fn($inc) => $inc->investigation && $inc->investigation->root_cause_identified)->count(); $investigatedIncidents = $incidents->whereIn('status', ['investigation_complete', 'closed'])->count(); $rootCauseRate = $investigatedIncidents > 0 ? round(($rootCauseCompleted / $investigatedIncidents) * 100) : 0; @endphp

{{ $rootCauseRate }}%

Root cause identified

@php $correctiveActionsData = $correctiveActions ?? collect(); $totalActions = $correctiveActionsData->count(); $completedActions = $correctiveActionsData->where('status', 'completed')->count(); $actionCompletionRate = $totalActions > 0 ? round(($completedActions / $totalActions) * 100) : 0; @endphp

{{ $actionCompletionRate }}%

Actions completed

Incident Frequency Trend (6 Months)

@php $monthlyData = []; for ($i = 5; $i >= 0; $i--) { $month = now()->subMonths($i); $count = $incidents->filter(fn($inc) => $inc->incident_datetime && $inc->incident_datetime->isSameMonth($month))->count(); $monthlyData[] = ['month' => $month->format('M Y'), 'count' => $count]; } $maxCount = max(array_merge(array_column($monthlyData, 'count'), [1])); @endphp
@foreach($monthlyData as $data)
{{ $data['month'] }} {{ $data['count'] }} incidents
@endforeach

Major Problem Detection

@php // Detect recurring incident categories (major problems) $categoryFrequency = $incidents->groupBy('incident_category')->map->count()->sortDesc()->take(5); $highSeverityIncidents = $incidents->where('severity', 'critical')->count() + $incidents->where('severity', 'major')->count(); @endphp

High Severity Incidents

{{ $highSeverityIncidents }}

Top Recurring Categories:

@foreach($categoryFrequency as $category => $count)
{{ $category }} {{ $count }}x
@endforeach

Incident & Near-Miss Reports

@forelse($incidents as $incident) @empty @endforelse
Incident # Type Category Description Severity Date & Time Reported By Status
{{ $incident->incident_number }} {{ $incident->incident_type === 'incident' ? 'Incident' : 'Near Miss' }} {{ $incident->incident_category }} {{ Str::limit($incident->incident_description, 40) }} {{ ucfirst($incident->severity) }} {{ $incident->incident_datetime ? $incident->incident_datetime->format('d M Y H:i') : 'N/A' }} {{ $incident->reported_by }} {{ str_replace('_', ' ', ucfirst($incident->status)) }}
No incidents or near-misses reported

Root Cause Analysis & Investigation

@forelse($incidents->whereNotNull('investigation') as $incident) @empty @endforelse
Incident # Investigation Date Investigator Root Cause Analysis Method Contributing Factors Status
{{ $incident->incident_number }} {{ $incident->investigation->investigation_date ? $incident->investigation->investigation_date->format('d M Y') : 'N/A' }} {{ $incident->investigation->lead_investigator }} {{ Str::limit($incident->investigation->root_cause ?? 'Not identified', 40) }} {{ $incident->investigation->analysis_method ?? 'N/A' }} {{ Str::limit($incident->investigation->contributing_factors ?? 'None', 30) }}
@if($incident->investigation->root_cause_identified) @endif {{ $incident->investigation->root_cause_identified ? 'Identified' : 'In Progress' }}
No investigations found

Corrective Actions (Track & Monitor)

@forelse($correctiveActions ?? [] as $action) @empty @endforelse
Action # Incident # Action Description Action Type Responsible Person Target Date Status Effectiveness
{{ $action->action_number }} {{ $action->incident->incident_number }} {{ Str::limit($action->action_description, 40) }} {{ str_replace('_', ' ', ucfirst($action->action_type)) }} {{ $action->responsible_person }} {{ $action->target_completion_date ? $action->target_completion_date->format('d M Y') : 'N/A' }} {{ ucfirst($action->status) }} @if($action->effectiveness_verified) {{ str_replace('_', ' ', ucfirst($action->effectiveness_rating)) }} @else Not verified @endif
No corrective actions tracked
@endsection