@if($error)
{{ $error }}
@endif
@if($running)
Synapse is analysing case data…
@elseif($ran && $result)
@php
$isNewFormat = isset($result['care_setting_reports']);
// Support both old and new format for overall confidence
$overallConf = $result['overall_confidence'] ?? $result['confidence'] ?? 'Low';
$overallConfClass = match($overallConf) {
'High' => 'bg-success',
'Medium' => 'bg-warning text-dark',
default => 'bg-danger',
};
$vStatusBadge = fn($s) => match($s) {
'verified' => ['Verified', 'bg-success'],
'likely' => ['Likely', 'bg-primary'],
'uncertain' => ['Uncertain', 'bg-warning text-dark'],
'unverifiable' => ['Unverifiable', 'bg-danger'],
'test_data' => ['Test Data', 'bg-secondary'],
default => [ucfirst($s ?? '?'), 'bg-secondary'],
};
@endphp
{{-- Overall confidence banner --}}
{{ $overallConf }} Confidence
{{ $result['overall_confidence_explanation'] ?? $result['confidence_explanation'] ?? '' }}
@if($isNewFormat)
{{-- Per care setting summary cards --}}
@php $totalTargets = collect($result['care_setting_reports'])->sum(fn($cs) => count($cs['dsar_targets'] ?? [])); @endphp
Care Settings
{{ count($result['care_setting_reports']) }}
{{ $totalTargets }} DSAR target{{ $totalTargets !== 1 ? 's' : '' }} identified
@foreach($result['care_setting_reports'] as $i => $cs)
@php
$inst = $cs['institution_identification'];
$vStatus = $inst['verification_status'] ?? 'uncertain';
[$vLabel, $vClass] = $vStatusBadge($vStatus);
$csConf = $cs['confidence'] ?? 'Low';
$csConfClass = match($csConf) {
'High' => 'bg-success',
'Medium' => 'bg-warning text-dark',
default => 'bg-danger',
};
$targetCount = count($cs['dsar_targets'] ?? []);
$isTestData = $vStatus === 'test_data';
$isUnverifiable = $vStatus === 'unverifiable';
@endphp
{{ $i + 1 }}
{{ $cs['care_setting_name'] }}
{{ $vLabel }}
{{ $csConf }}
@if($isTestData)
Test / placeholder institution — no DSAR targets generated.
@elseif($isUnverifiable)
Institution could not be identified — no DSAR targets generated.
@else
@if($inst['likely_official_name'] !== $inst['recorded_name'])
Identified as: {{ $inst['likely_official_name'] }} ·
@endif
{{ $targetCount }} DSAR target{{ $targetCount !== 1 ? 's' : '' }}
@if($targetCount > 0)
@foreach(array_slice($cs['dsar_targets'], 0, 4) as $t)
{{ $t['priority'] }}
{{ \Illuminate\Support\Str::limit($t['organisation'], 35) }}
@if(!empty($t['institution_id']))
↗ In DB
@else
+ Add
@endif
@endforeach
@if($targetCount > 4)
+{{ $targetCount - 4 }} more — see full report
@endif
@endif
@endif
@endforeach
{{-- Overall strategic notes preview --}}
@if(!empty($result['overall_strategic_notes']))
Overall Strategy
{{ \Illuminate\Support\Str::limit($result['overall_strategic_notes'], 400) }}
@endif
@else
{{-- Legacy format fallback (old runs before restructure) --}}
This analysis was generated with an older version of Synapse. Re-run to see the per-care-setting breakdown.
@php
$sourceLabels = [
'primary_controller' => ['label' => 'Primary', 'class' => 'bg-danger'],
'secondary_source' => ['label' => 'Secondary', 'class' => 'bg-warning text-dark'],
'supporting_evidence' => ['label' => 'Supporting', 'class' => 'bg-secondary'],
];
$likelihoodClass = fn($v) => match($v) {
'High' => 'text-success fw-semibold',
'Medium' => 'text-warning fw-semibold',
default => 'text-danger fw-semibold',
};
@endphp
DSAR Targets {{ count($result['dsar_targets'] ?? []) }}
@foreach($result['dsar_targets'] ?? [] as $target)
@php $src = $sourceLabels[$target['source_type']] ?? ['label' => $target['source_type'], 'class' => 'bg-secondary']; @endphp
{{ $target['priority'] }}
{{ $target['organisation'] }}
{{ $src['label'] }}
R:{{ $target['record_likelihood'][0] }}
U:{{ $target['usefulness'][0] }}
S:{{ $target['strategic_importance'][0] }}
{{ $target['rationale'] }}
@endforeach
@endif
@else
Synapse will analyse all care settings, institutions, existing DSARs, and call
transcripts recorded against this claim and produce a prioritised DSAR target list
with contact details, evidence probability assessments, and strategic recommendations
— one complete sub-report per care setting.
@endif
@can('synapse.use')
$ran, 'text-white' => !$ran])
@style(['background-color:#7c3aed;border-color:#7c3aed;' => !$ran])>
{{ $ran ? 'Re-run Analysis' : 'Run Synapse DSAR Analysis' }}
Analysing…
@else
Synapse access not permitted
@endcan
@if($ran)
View Report
Review before acting. Output is not legal advice.
@endif