@php /** * The arithmetic behind R1, R3 and R4 — the rows the score was actually * computed from, not a retelling of how the model felt about the charity. * * $key metric key (r1_revenue | r3_recipient | r4_results) * $ledger the `calculation` block written by Services\Ai\LedgerCalculator * $claimed the total the model stated for itself, for comparison * $sources the run's sources, keyed by ID */ $money = fn ($value, $currency = '') => $value === null ? '—' : trim(($currency ?: '') . ' ' . number_format((float) $value)); $pct = fn ($value, $decimals = 1) => $value === null ? '—' : number_format((float) $value, $decimals) . '%'; $cite = function (array $row) use ($sources) { $id = $row['source_id'] ?? ''; $url = $row['url'] ?? ''; if ($id !== '' && $sources->has($id)) { return ['label' => $id . ' · ' . ($sources[$id]['title'] ?: $sources[$id]['url']), 'url' => $sources[$id]['url']]; } return $url !== '' ? ['label' => parse_url($url, PHP_URL_HOST) ?: $url, 'url' => $url] : null; }; $th = 'text-align:left;padding:5px 8px;font-size:0.68rem;font-weight:700;text-transform:uppercase;' . 'letter-spacing:0.04em;color:#6b7280;border-bottom:1px solid #e5e7eb;white-space:nowrap;'; $td = 'padding:5px 8px;border-bottom:1px solid #f3f4f6;vertical-align:top;'; @endphp
| Input | Amount | Transparent | Adjustment | Counted | Rule applied |
|---|---|---|---|---|---|
| {{ $input['label'] }} | {{ $money($input['amount'], $input['currency']) }} | {{ $input['transparent'] ? 'yes' : 'no' }} | ×{{ number_format((float) $input['factor'], 2) }} | {{ $money($input['adjusted'], $input['currency']) }} | {{ $input['clause'] }} @if ($source) {{ $source['label'] }} @endif |
| Link | Keeps | Deducts | Basis | Methodology clause |
|---|---|---|---|---|
| {{ $step['code'] }} {{ $step['label'] }} | {{ number_format((float) $step['retention'], 4) }} | −{{ number_format((float) $step['deduction'], 2) }}% | @if ($step['basis'] === 'observed') OBSERVED @else DEFAULT @endif |
{{ $step['clause'] }}
@if (filled($step['quote'] ?? null))
“{{ $step['quote'] }}”
@endif
@if ($source)
{{ $source['label'] }}
@endif
@if ($step['drift'])
Rate differs from the one on file: {{ $step['drift'] }}
@endif
|
| Country | Recipients | Median income (PPP) | By formula | By bands table | Source |
|---|---|---|---|---|---|
| {{ $country['country'] }} | {{ $pct($country['share'] * 100, 0) }} | ${{ number_format((float) $country['income']) }} @if ($country['capped_income'] != $country['income']) (capped to ${{ number_format((float) $country['capped_income']) }}) @endif | {{ $pct($country['formula_score']) }} | {{ $pct($country['cliff_score']) }} |
@if ($source)
{{ $source['label'] }}
@endif
@if (filled($country['quote'] ?? null))
“{{ $country['quote'] }}”
@endif
|
aaa-compassion.md and re-run, or set R3 by hand.
| Component | Points | Why |
|---|---|---|
| {{ $component['label'] }} | @if ($component['points'] === null) not scored → 0 @else {{ number_format((float) $component['points'], 1) }} / {{ (int) $component['max'] }} @endif | {{ $component['reasoning'] }} @if ($source) {{ $source['label'] }} @endif |