@php $client = $claim->client; $isNewFormat = isset($result['care_setting_reports']); $overallConfidence = $result['overall_confidence'] ?? $result['confidence'] ?? 'Low'; $overallConfidenceClass = match($overallConfidence) { 'High' => 'conf-high', 'Medium' => 'conf-medium', default => 'conf-low', }; $sourceLabels = [ 'primary_controller' => ['label' => 'Primary Controller', 'class' => 'badge-primary'], 'secondary_source' => ['label' => 'Secondary Source', 'class' => 'badge-secondary'], 'supporting_evidence' => ['label' => 'Supporting Evidence', 'class' => 'badge-supporting'], ]; $statusClasses = [ 'exists' => 'badge-exists', 'dissolved' => 'badge-dissolved', 'merged' => 'badge-merged', 'unknown' => 'badge-unknown', ]; $scoreClass = fn($v) => match($v) { 'High' => 's-high', 'Medium' => 's-medium', default => 's-low', }; $verificationBadge = fn($status) => match($status) { 'verified' => ['label' => 'Verified', 'class' => 'vbadge-verified'], 'likely' => ['label' => 'Likely', 'class' => 'vbadge-likely'], 'uncertain' => ['label' => 'Uncertain', 'class' => 'vbadge-uncertain'], 'unverifiable' => ['label' => 'Unverifiable', 'class' => 'vbadge-unverifiable'], 'test_data' => ['label' => 'Test Data', 'class' => 'vbadge-test_data'], default => ['label' => ucfirst($status ?? 'Unknown'), 'class' => 'vbadge-uncertain'], }; @endphp
{{-- ===== HEADER ===== --}}
SYNAPSE AI-Assisted Intelligence Report
DSAR Intelligence Report
Subject Access Request Strategy & Target Identification
Client: {{ $client->full_name ?? '—' }} Date of Birth: {{ optional($client->date_of_birth)->format('d M Y') ?? '—' }} Claim Ref: {{ $claim->reference ?? $claim->id }} Report Generated: {{ $run->created_at->format('d M Y, H:i') }} Overall Confidence: {{ $overallConfidence }}
@if(!$isNewFormat) {{-- ===== STALE FORMAT NOTICE ===== --}}
Report format outdated This report was generated with an older version of Synapse and cannot be displayed in the updated per-care-setting format. Please re-run the analysis to generate a new report.
@else {{-- ===== OVERALL CONFIDENCE BANNER ===== --}}
Overview Overall Assessment
{{ $overallConfidence }} Confidence {{ $result['overall_confidence_explanation'] ?? '' }}
{{-- ===== GLOBAL TIMELINE ===== --}} @if(!empty($result['timeline']))
Timeline Chronological Timeline of Care Settings
@foreach($result['timeline'] as $entry) @endforeach
Period Care Setting Notes
{{ $entry['period'] }} {{ $entry['care_setting'] }} {{ $entry['notes'] ?? '' }}
@if(!empty($result['timeline_gaps']))

Gaps / Missing Periods

    @foreach($result['timeline_gaps'] as $gap)
  • {{ $gap }}
  • @endforeach
@endif
@endif {{-- ===== PER CARE SETTING ===== --}} @foreach($result['care_setting_reports'] as $i => $cs) @php $inst = $cs['institution_identification']; $vStatus = $inst['verification_status'] ?? 'uncertain'; $vBadge = $verificationBadge($vStatus); $isTestData = $vStatus === 'test_data'; $isUnverifiable = $vStatus === 'unverifiable'; $skipTargets = $isTestData || $isUnverifiable; $csConfClass = match($cs['confidence'] ?? 'Low') { 'High' => 'conf-high', 'Medium' => 'conf-medium', default => 'conf-low', }; @endphp
{{-- Care Setting Divider --}}
Care Setting {{ $i + 1 }} {{ $cs['care_setting_name'] }}
{{-- ===== A: INSTITUTION IDENTIFICATION ===== --}}
A Institution Identification
@if($isTestData)
Test / Placeholder Institution — No DSAR targets generated {{ $inst['verification_notes'] }}
@elseif($isUnverifiable)
Institution Could Not Be Identified {{ $inst['verification_notes'] }}
@endif
{{ $inst['likely_official_name'] }}
@if(($inst['recorded_name'] ?? '') !== ($inst['likely_official_name'] ?? ''))
Recorded as: "{{ $inst['recorded_name'] }}"
@endif
{{ $inst['type'] }} {{ $vBadge['label'] }}
@if(!empty($inst['description']))

{{ $inst['description'] }}

@endif @if(!empty($inst['verification_notes']) && !$isTestData && !$isUnverifiable)

Identification notes: {{ $inst['verification_notes'] }}

@endif
@if(!$skipTargets) {{-- ===== C: CURRENT STATUS & SUCCESSORS ===== --}}
C Current Status & Successors
@if(!empty($cs['current_status']['description']))

{{ $cs['current_status']['description'] }}

@endif @if(!empty($cs['current_status']['record_holders'])) @foreach($cs['current_status']['record_holders'] as $rh) @endforeach
Likely Record Holder Role
{{ $rh['organisation'] }} {{ $rh['role'] }}
@endif
{{-- ===== D: CROSS-INSTITUTION LINKS ===== --}} @if(!empty($cs['cross_institution_links']))
D Cross-Institution Record Links
@foreach($cs['cross_institution_links'] as $link) @endforeach
@endif {{-- ===== E & F: DSAR TARGETS WITH CONTACT DETAILS ===== --}} @if(!empty($cs['dsar_targets']))
E & F Prioritised DSAR Targets & Contact Details {{ count($cs['dsar_targets']) }} organisations identified
@foreach($cs['dsar_targets'] as $target) @php $src = $sourceLabels[$target['source_type']] ?? ['label' => ucfirst($target['source_type'] ?? ''), 'class' => 'badge-supporting']; $stCls = $statusClasses[$target['current_status'] ?? 'unknown'] ?? 'badge-unknown'; @endphp
{{ $target['priority'] }}
{{ $target['organisation'] }}
{{ $src['label'] }} {{ ucfirst($target['current_status'] ?? 'Unknown') }}
Records {{ ($target['record_likelihood'] ?? '—')[0] ?? '—' }}
Useful {{ ($target['usefulness'] ?? '—')[0] ?? '—' }}
Retrieval {{ ($target['retrieval_difficulty'] ?? '—')[0] ?? '—' }}
Strategic {{ ($target['strategic_importance'] ?? '—')[0] ?? '—' }}

{{ $target['rationale'] }}

@if(!empty($target['successor']))

→ Successor / record holder: {{ $target['successor'] }}

@endif @php $targetContacts = $target['contacts'] ?? []; $instId = $target['institution_id'] ?? null; $contactInDb = $target['contact_in_db'] ?? false; @endphp @if(count($targetContacts) > 0)
@foreach($targetContacts as $contact) @php $cType = $contact['type'] ?? 'address'; $cValue = $contact['value'] ?? null; $cDept = $contact['department'] ?? null; $canAdd = $instId && in_array($cType, ['email', 'phone']); $typeLabel = match($cType) { 'email' => 'Email', 'phone' => 'Telephone', 'address' => 'Postal / SAR Route', default => ucfirst($cType), }; @endphp @if($cValue)
@if($cDept)
Department {{ $cDept }}
@endif
!$cDept])> {{ $typeLabel }} {{ $cValue }}
@if($canAdd)
@endif
@endif @endforeach
@else
⚠ Contact details not found — manual search required for this organisation's SAR/DSAR route.
@endif {{-- Institution DB link --}}
@endforeach
@endif {{-- ===== G: STRATEGIC NOTES ===== --}} @if(!empty($cs['strategic_notes']))
G Strategic Notes

{{ $cs['strategic_notes'] }}

@endif {{-- ===== H: EVIDENCE PROBABILITY ASSESSMENT ===== --}} @if(!empty($cs['dsar_targets']))
H Evidence Probability Assessment
@foreach($cs['dsar_targets'] as $target) @endforeach
# DSAR Target Records Exist Usefulness Retrieval Difficulty Strategic Importance
{{ $target['priority'] }} {{ $target['organisation'] }} {{ $target['record_likelihood'] ?? '—' }} {{ $target['usefulness'] ?? '—' }} {{ $target['retrieval_difficulty'] ?? '—' }} {{ $target['strategic_importance'] ?? '—' }}
@endif {{-- ===== I: FALLBACK ROUTES ===== --}} @if(!empty($cs['fallback_routes']))
I Fallback / Advanced Evidence Routes
@foreach($cs['fallback_routes'] as $fb)
{{ $fb['route'] }}
{{ $fb['rationale'] }}
@endforeach
@endif @else {{-- Strategic notes still shown even for test/unverifiable --}} @if(!empty($cs['strategic_notes']))
Note Analysis Notes

{{ $cs['strategic_notes'] }}

@endif @endif {{-- ===== J: CONFIDENCE ===== --}}
J Confidence Level
{{ $cs['confidence'] ?? '—' }} Confidence {{ $cs['confidence_explanation'] ?? '' }}
{{-- end care-setting-block --}} @endforeach {{-- ===== OVERALL STRATEGIC NOTES ===== --}} @if(!empty($result['overall_strategic_notes']))
Overall Strategic Recommendations

{{ $result['overall_strategic_notes'] }}

@endif @endif {{-- ===== DISCLAIMER ===== --}}
Important Notice: This report was generated by Synapse, an AI-assisted legal intelligence system. It is intended to assist solicitors and caseworkers in planning DSAR strategy and should be reviewed critically before acting. Contact details, institution names, and record survival assessments are based on the case data provided and general knowledge; they must be independently verified. This report does not constitute legal advice. Confidence ratings reflect the quality of information available at the time of analysis and not a guarantee of outcome.
{{-- Print / Back buttons --}} {{-- Toast notification --}}