feat: add setup notebook and update env example for Athena
This commit is contained in:
@@ -27,9 +27,14 @@ def render(client: TEIClient, tool: dict) -> None:
|
||||
st.error(f"Athena API error: {e.detail}")
|
||||
return
|
||||
|
||||
npv = float(summary.get("npv") or 0)
|
||||
roi = float(summary.get("roi") or summary.get("roi_pct") or 0)
|
||||
payback = summary.get("payback_months")
|
||||
npv = float(summary.get("net_present_value") or summary.get("npv") or 0)
|
||||
roi = float(
|
||||
summary.get("roi_percentage")
|
||||
or summary.get("roi")
|
||||
or summary.get("roi_pct")
|
||||
or 0
|
||||
)
|
||||
payback = summary.get("payback_period_months", summary.get("payback_months"))
|
||||
bpv = float(summary.get("total_benefits_pv") or 0)
|
||||
cpv = float(summary.get("total_costs_pv") or 0)
|
||||
|
||||
@@ -45,7 +50,16 @@ def render(client: TEIClient, tool: dict) -> None:
|
||||
|
||||
st.divider()
|
||||
|
||||
# Build the yearly breakdown from the documented per-year summary keys
|
||||
# (benefits_year_N / costs_year_N) when no pre-built breakdown exists.
|
||||
yb = summary.get("yearly_breakdown") or []
|
||||
if not yb:
|
||||
n = 1
|
||||
while f"benefits_year_{n}" in summary or f"costs_year_{n}" in summary:
|
||||
b = float(summary.get(f"benefits_year_{n}") or 0)
|
||||
c = float(summary.get(f"costs_year_{n}") or 0)
|
||||
yb.append({"year": n, "benefits": b, "costs": c, "net": b - c})
|
||||
n += 1
|
||||
initial = float(summary.get("initial_costs") or 0)
|
||||
if yb:
|
||||
charts.cashflow(yb, initial_cost=initial)
|
||||
|
||||
Reference in New Issue
Block a user