{{-- The Smart Assistant panel. Everything here is a proposal. Nothing on this card reaches a patient's record without a clinician pressing something, and the disclaimer stays visible rather than sitting behind a tooltip — a prescriber who has to hover to discover that software is not accountable for the advice has been told nothing. --}} @if ($suggestions !== [] || ($assistantContext?->egfr !== null)) {{-- Kidney function, when it can honestly be estimated. Shown whether or not a rule fired, because it changes the dose of a great many things a prescriber is about to consider. --}} @if ($assistantContext?->egfr !== null)
{{ __('cdss::messages.panel.egfr') }} {{ number_format($assistantContext->egfr, 1) }} {{ \App\Modules\Cdss\Support\EgfrCalculator::stage($assistantContext->egfr) }}

{{ __('cdss::messages.panel.egfr_note', [ 'date' => $assistantContext->creatinine?->measuredAt->format('d M Y') ?? '—', ]) }}

@endif @forelse ($suggestions as $suggestion)
{{ $suggestion->title }} {{ $suggestion->severity->label() }}
@if ($suggestion->rationale)

{{ $suggestion->rationale }}

@endif {{-- Why it fired, in the patient's own numbers. A prompt whose trigger is invisible is one a clinician can only obey or ignore; seeing "BMI 34.2" is what makes it reviewable. --}} @if ($suggestion->matchedOn !== [])

{{ __('cdss::messages.panel.because') }} {{ implode(' · ', $suggestion->matchedOn) }}

@endif @if ($suggestion->message)

{{ $suggestion->message }}

@endif @if ($suggestion->items !== []) @endif {{-- Treatment suggestions, each with whatever the formulary knows against giving it to this patient. --}} @foreach ($suggestion->drugs as $drug)
{{ $drug->label() }} @if ($drug->manufacturer) {{ $drug->manufacturer }} @endif
{{ collect([$drug->defaultDose, $drug->defaultFrequency, $drug->foodRelation]) ->filter()->implode(' · ') ?: __('cdss::messages.panel.no_default_dose') }}
@if ($suggestion->allowsOneClick($drug) && $encounterIsOpen) @can('cdss.view')
@csrf
@endcan @endif
@foreach ($suggestion->flagsFor($drug) as $flag)
{{ $flag->message }}
{{ $flag->basedOn }}@if ($flag->source) · {{ $flag->source }} @endif
@endforeach
@endforeach {{-- Said out loud, because "no warning" and "nobody has entered any guidance for this drug" look identical otherwise, and a prescriber reading the first when it is the second has been misled by silence. --}} @if ($suggestion->unreviewedDrugs() !== [])

{{ __('cdss::messages.panel.no_guidance', [ 'drugs' => collect($suggestion->unreviewedDrugs())->pluck('name')->implode(', '), ]) }}

@endif @if ($suggestion->kind->value === 'workup' && $suggestion->items !== [] && $encounterIsOpen) @can('cdss.view')
@csrf
@endcan @endif @if (! $suggestion->isActionable())

{{ __('cdss::messages.actions.'.$suggestion->priorAction) }} {{ $suggestion->priorReason }}

@elseif ($encounterIsOpen) @can('cdss.view')
{{ __('cdss::messages.panel.dismiss') }}
@csrf
@endcan @endif
@empty

{{ __('cdss::messages.panel.nothing') }}

@endforelse {{-- Required by the specification, and correct independently of it. It is the last thing in the card because it applies to everything above it, and it is not dismissible. --}}

{{ __('cdss::messages.panel.disclaimer') }}

@endif