{% extends "base.html" %} {% set active_page = "cost_attribution" %} {% block title %}FaultRay - Cost Attribution{% endblock %} {% block page_title %}Failure Cost Attribution{% endblock %} {% block page_subtitle %}Risk ownership by team, service, and component{% endblock %} {% block content %}

Total Annual Risk

{% if report %} {% set risk = report.total_annual_risk %} {% set risk_color = 'var(--green)' if risk < 100000 else ('var(--yellow)' if risk < 1000000 else 'var(--red)') %}
${{ "{:,.0f}".format(risk) }}
Estimated Annual Risk
Across {{ report.components|length }} components, {{ report.teams|length }} teams
{% else %}
--
No data available
{% endif %}

Team Risk Allocation

{% if report and report.teams %} {% set colors = ['#e94560', '#0984e3', '#f0a500', '#00b894', '#6c5ce7', '#fd79a8'] %}
{{ report.teams|length }} TEAMS
{% for team in report.teams %}
{{ team.name }} ({{ team.percentage_of_total_risk|round(1) }}%)
{% endfor %}
{% else %}
No team data
{% endif %}

Component Risk Treemap

{% if report and report.components %}
{% set colors_map = {'backend': '#e94560', 'data': '#0984e3', 'infra': '#f0a500', 'platform': '#00b894', 'messaging': '#6c5ce7'} %} {% for comp in report.components %} {% if comp.percentage_of_total_risk > 0.5 %} {% set size = [comp.percentage_of_total_risk * 3, 30]|max %} {% set bg = colors_map.get(comp.team, '#6c5ce7') %}
{{ comp.id }}
${{ "{:,.0f}".format(comp.total_annual_risk) }}
{{ comp.team }} · {{ comp.percentage_of_total_risk|round(1) }}%
{% endif %} {% endfor %}
{% else %}
No component data available
{% endif %}

Improvement ROI Ranking

{% if report and report.components %} {% for comp in report.components[:10] %} {% endfor %}
Rank Component Team Annual Risk Direct Cost Cascade Cost ROI Priority
{{ loop.index }} {{ comp.id }} {{ comp.team }} ${{ "{:,.0f}".format(comp.total_annual_risk) }} ${{ "{:,.0f}".format(comp.direct_cost) }} ${{ "{:,.0f}".format(comp.cascade_cost) }} {{ comp.improvement_roi|round(2) }}x {% if comp.improvement_roi > 5 %} CRITICAL {% elif comp.improvement_roi > 1 %} HIGH {% else %} NORMAL {% endif %}
{% else %}
No data available
{% endif %}

Budget Allocation

{% if report and report.teams %} {% set colors = ['#e94560', '#0984e3', '#f0a500', '#00b894', '#6c5ce7', '#fd79a8'] %} {% for team in report.teams %}
{{ team.name }} ${{ "{:,.0f}".format(team.recommended_budget) }}
{% set max_budget = report.teams[0].recommended_budget if report.teams[0].recommended_budget > 0 else 1 %}
{% endfor %}
Total Recommended ${{ "{:,.0f}".format(report.teams|map(attribute='recommended_budget')|sum) }}
{% else %}
No budget data
{% endif %}

Reduction Opportunities

{% if report and report.opportunities %} {% for opp in report.opportunities %}
{{ opp.component }}
{{ opp.action }}
-${{ "{:,.0f}".format(opp.savings) }}
{% endfor %} {% else %}
No opportunities found
{% endif %}
{% endblock %}