SIMCEL’s core value is running multiple “what-if” simulations simultaneously. The Insights API lets you extract and compare those scenarios in your own code. Here are the most useful patterns.
Generate a variance table between a baseline (Committed) and one or more alternatives.
def delta_table(base_name: str, scenarios: list[dict]) -> None: base = next(s for s in scenarios if s["scenarioName"] == base_name) others = [s for s in scenarios if s["scenarioName"] != base_name] metrics = ["netFIESales", "grossProfit", "ebit", "dpm"] print(f"{'Metric':<22} {'Base':>14}", end="") for s in others: print(f" {s['scenarioName']:>16} {'Δ vs Base':>12}", end="") print() print("─" * 80) for m in metrics: base_val = base["pnl"][m] print(f"{m:<22} {base_val:>14,.0f}", end="") for s in others: val = s["pnl"][m] delta = val - base_val print(f" {val:>16,.0f} {delta:>+12,.0f}", end="") print()
Find the month where two scenarios start to diverge significantly.
def find_divergence_month( scenario_a: dict, scenario_b: dict, metric: str = "demandValue", threshold_pct: float = 0.05,) -> str | None: """Return the first month where scenarios diverge by more than threshold_pct.""" series_a = {row["period"]: row[metric] for row in scenario_a["series"]} series_b = {row["period"]: row[metric] for row in scenario_b["series"]} for period in sorted(series_a.keys()): a, b = series_a[period], series_b.get(period, 0) if a == 0: continue if abs(a - b) / a > threshold_pct: return period return Nonemonth = find_divergence_month( data["scenarios"][0], # Committed data["scenarios"][1], # Optimistic metric="demandValue", threshold_pct=0.05,)print(f"Scenarios diverge from: {month}")