{# routing/_narrative.html — "why did it pick that model?", answered before any table. Expects `narrative` (domain.routing.narrative.Narrative) and `explanation` (the payload). #} {% from "mirrorwall/components.html" import badge, table %}

Why this model

{{ narrative.headline }}

{% if narrative.arithmetic %}

{{ narrative.arithmetic }}

{% endif %} {% if narrative.decisive %}

{{ narrative.decisive }}

{% endif %} {% if narrative.reliability %}

Production reliability: {{ narrative.reliability }}

{% endif %} {% if narrative.evidence %}

Evidence: {{ narrative.evidence }}

{% endif %} {% if narrative.flags %} {% endif %} {% if narrative.drivers %}

What carried the score

{% set columns = [ {"label": "Capability"}, {"label": "Weight", "numeric": true}, {"label": "Score", "numeric": true}, {"label": "Confidence", "numeric": true}, {"label": "Contribution", "numeric": true}, {"label": "Source"}, {"label": "vs runner-up", "numeric": true} ] %} {% set rows = [] %} {% for driver in narrative.drivers %} {% set _ = rows.append([ driver.capability, "%.2f"|format(driver.weight), "%.3f"|format(driver.score), "%.3f"|format(driver.confidence), "%.4f"|format(driver.contribution), driver.source ~ (" · " ~ driver.sample_count ~ " samples" if driver.sample_count is not none else "") ~ (" · " ~ driver.evidence_age_days ~ " d old" if driver.evidence_age_days is not none else "") ~ (" · stale" if driver.stale else ""), ("%+.4f"|format(driver.advantage)) if driver.advantage is not none else "—" ]) %} {% endfor %} {{ table(columns, rows, caption="Contribution is weight × score × confidence — the numerator of task fit. Largest first.", table_id="drivers", complete=true, row_count=narrative.drivers | length) }} {% endif %} {% if narrative.absences %}

What could not be scored

{% set columns = [{"label": "Capability"}, {"label": "Weight", "numeric": true}, {"label": "Why"}, {"label": "What would fix it"}] %} {% set rows = [] %} {% for absence in narrative.absences %} {% set _ = rows.append([ absence.capability, "%.2f"|format(absence.weight), badge(absence.source, tone="neutral") ~ " " ~ absence.note, ('' ~ (absence.remedy | e) ~ '') | safe if absence.remedy else "—" ]) %} {% endfor %} {{ table(columns, rows, caption="Absent is not zero: these capabilities were left out of both numerator and denominator.", table_id="absences", complete=true, row_count=narrative.absences | length) }} {% endif %} {% if narrative.rejections %}

Why the others were set aside

{% set columns = [{"label": "Model"}, {"label": "Reason"}, {"label": "In words"}, {"label": "Numbers"}] %} {% set rows = [] %} {% for rejection in narrative.rejections %} {% set _ = rows.append([ rejection.canonical_id, badge(rejection.reason, tone="danger"), rejection.meaning, (rejection.numbers | json_pretty) if rejection.numbers else "—" ]) %} {% endfor %} {{ table(columns, rows, table_id="rejections", complete=true, row_count=narrative.rejections | length) }} {% endif %}