{# Spec 156 - "Spend by origin" tile. Table rows sorted by cost desc. Each row click-throughs to /opportunities?origin= for drill-down. ``cost_by_origin`` is a list of dicts: {origin_tool, cost_usd, job_count, cost_share_pct} built in routes/findings.py via a single SQL aggregate over the indexed ``bigquery_jobs.origin_tool`` column. #} {% if cost_by_origin %}

Spend by origin

{{ cost_by_origin | length }} tool{{ "s" if cost_by_origin | length != 1 else "" }}

Which BI / orchestrator / CDC tool submitted each job. Click a row to filter the opportunities table to that origin.

{% for row in cost_by_origin %} {% endfor %}
Origin Spend Share Jobs
{{ row.origin_tool }} {{ row.cost_usd | format_usd }} {{ "{:.1f}".format(row.cost_share_pct) }}% {{ "{:,}".format(row.job_count) }}
{% endif %}