@php $d = $breakdown['irs_data']; $components = $breakdown['components']; $identitySuggested = $breakdown['identity_suggested']; $suggested = $breakdown['suggested']; $confidence = $breakdown['confidence'] ?? null; $matched = $d['matched_keywords'] ?? []; $categories = (array) ($d['categories'] ?? []); $categoryHits = (array) ($d['category_hits'] ?? []); // Backend returns 5 components: [name, mission/desc, classification, church, integrity]. $identityComps = array_slice($components, 0, 4); $integrityComp = $components[4] ?? null; $sources = array_filter([ 'Name' => $d['name'], 'Mission' => $d['mission'], 'Program 1' => $d['program_desc1'] ?? null, 'Program 2' => $d['program_desc2'] ?? null, 'Program 3' => $d['program_desc3'] ?? null, ]); $matchedKws = array_unique(array_column($matched, 'keyword')); $highlight = function (?string $text) use ($matchedKws) { if (!$text) return '—'; $escaped = e($text); foreach ($matchedKws as $kw) { $escaped = preg_replace( '/\b(' . preg_quote(e($kw), '/') . ')\b/i', '$1', $escaped ); } return $escaped; }; @endphp
Methodology @if($confidence) {{ strtoupper($confidence) }} confidence @endif

Identity (0–50) is auto-detected from religious keywords in the org's name (×8, cap 20), mission and program descriptions (×4, cap 15), a regulator-classification boost (+10 when CRA Sub Category or CCEW classification explicitly names Christianity), and a small bonus for church-like 501(c)(3)s with no Schedule A (+3, or +5 with keyword match). Integrity (0–50) is not auto-scored — it requires manual review (truthfulness of claims, fundraising methods, investment policy). While integrity is unset, R2 is NULL and the composite renormalizes across R1/R3/R4.

{{-- ── Matched keyword chips ───────────────────────────────────────── --}} @if(count($matched) > 0)
Matched Keywords {{ count($matched) }} hit{{ count($matched) === 1 ? '' : 's' }}
@foreach($matched as $hit) {{ $hit['keyword'] }} ×{{ $hit['weight'] }} {{ $hit['source'] }} @endforeach
Strong (×2) — explicitly religious institutions Moderate (×1) — religious affiliation / practice
@else
Matched Keywords

No religious keywords detected in the org's name, mission, or program descriptions.

@endif {{-- ── Regulator classification ────────────────────────────────────── --}} @if(!empty($categories))
Regulator Classification {{ count($categoryHits) > 0 ? 'Christian classification confirmed' : 'No Christian match' }}
@foreach($categories as $cat) @php $isHit = in_array($cat, $categoryHits, true); @endphp {{ $cat }} @if($isHit)+10@endif @endforeach
@endif {{-- ── Identity sub-score ─────────────────────────────────────────── --}}
Identity Breakdown {{ $identitySuggested }} / 50
@foreach($identityComps as $c) @endforeach
Component Max Earned Calculation
{{ $c['label'] }} {{ $c['max'] }} {{ $c['earned'] === null ? 'N/A' : $c['earned'] }} {{ $c['explanation'] }}
{{-- ── Integrity sub-score ────────────────────────────────────────── --}} @if($integrityComp)
Integrity (Manual Assessment) {{ $integrityComp['earned'] }} / 50 default
{{ $integrityComp['explanation'] }}
@endif {{-- ── Source text with highlighted matches ───────────────────────── --}}
Source Text
@foreach($sources as $label => $text)
{{ $label }}
{!! $highlight($text) !!}
@endforeach
{{ $d['is_501c3'] ? '✓' : '✗' }} 501(c)(3) {{ $d['schedule_a_filed'] ? '✓' : '✗' }} Schedule A filed {{ $d['is_church_like'] ? '✓' : '✗' }} Church-like (501c3, no Schedule A)
Algorithm-suggested score {{ $suggested === null ? 'Identity only — integrity not set' : $suggested }}