File size: 13,804 Bytes
47b08cd
36a5576
4088a7c
 
 
36a5576
 
4088a7c
 
 
 
 
47b08cd
 
 
 
 
 
4088a7c
47b08cd
4088a7c
47b08cd
 
 
 
4088a7c
47b08cd
4088a7c
47b08cd
 
 
 
4088a7c
47b08cd
4088a7c
 
 
 
36a5576
4088a7c
 
36a5576
 
4088a7c
36a5576
 
4088a7c
36a5576
4088a7c
 
36a5576
 
 
 
 
 
 
 
 
 
4088a7c
 
36a5576
4088a7c
 
 
 
 
36a5576
4088a7c
36a5576
 
 
 
 
4088a7c
36a5576
4088a7c
36a5576
4088a7c
36a5576
4088a7c
 
 
 
36a5576
4088a7c
36a5576
 
 
 
 
 
 
 
 
 
 
 
4088a7c
 
36a5576
4088a7c
36a5576
4088a7c
 
 
 
36a5576
4088a7c
36a5576
4088a7c
36a5576
4088a7c
36a5576
4088a7c
 
 
 
36a5576
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4088a7c
 
 
 
36a5576
4088a7c
 
36a5576
 
4088a7c
36a5576
4088a7c
 
 
36a5576
4088a7c
36a5576
4088a7c
 
 
 
36a5576
4088a7c
36a5576
 
 
 
 
 
 
 
4088a7c
36a5576
4088a7c
 
 
 
36a5576
4088a7c
 
36a5576
 
4088a7c
36a5576
4088a7c
 
 
36a5576
4088a7c
36a5576
4088a7c
 
 
 
36a5576
4088a7c
36a5576
 
 
 
 
 
 
 
4088a7c
36a5576
4088a7c
 
 
 
36a5576
4088a7c
 
36a5576
 
4088a7c
36a5576
4088a7c
36a5576
4088a7c
36a5576
4088a7c
36a5576
4088a7c
 
 
 
36a5576
4088a7c
 
 
36a5576
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4088a7c
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
{% extends "base.html" %}
{% block page_title %}Volume & Revenue Drivers{% endblock %}

{% block content %}
<div class="page-header">
    <h2>Volume &amp; Revenue Drivers</h2>
    <p>Investment performance scorecard, revenue decomposition, driver contributions, and seasonality — the full story of what fuels growth</p>
</div>

<!-- KPI Cards -->
<div class="kpi-grid" id="diagKpiGrid"></div>

<!-- NOVA Insights -->
<div class="nova-insights">
    <div class="nova-insight-card" onclick="sendNOVA('What are the top drivers of revenue growth in this period?')">
        <div class="nova-insight-header">
            <div class="nova-insight-icon insight">&#x1F4CA;</div>
            <span class="nova-insight-label">NOVA Insight</span>
        </div>
        <div class="nova-insight-text"><strong>Revenue Drivers</strong> — Analyzing which media, promo, and seasonal factors contributed most to revenue this period vs the last.</div>
    </div>
    <div class="nova-insight-card" onclick="sendNOVA('How much of revenue is driven by marketing vs base demand?')">
        <div class="nova-insight-header">
            <div class="nova-insight-icon win">&#x1F3C6;</div>
            <span class="nova-insight-label">Base vs Incremental</span>
        </div>
        <div class="nova-insight-text"><strong>Organic vs Paid</strong> — Base demand accounts for ~40% of revenue. Marketing-driven channels collectively lift the remainder through incremental contribution.</div>
    </div>
    <div class="nova-insight-card" onclick="sendNOVA('Which marketing investment is showing the best efficiency trend?')">
        <div class="nova-insight-header">
            <div class="nova-insight-icon insight">&#x26A1;</div>
            <span class="nova-insight-label">Efficiency Trend</span>
        </div>
        <div class="nova-insight-text"><strong>ROI Trajectory</strong> — Track whether each marketing bucket (Media, Consumer Promo, Trade Promo) is becoming more or less efficient over time.</div>
    </div>
</div>

<!-- =============================================================== -->
<!-- SECTION 0: Marketing Investment & Performance Scorecard          -->
<!-- =============================================================== -->
<div class="section-header">
    <h3>&#x1F3AF; Marketing Investment &amp; Performance Scorecard</h3>
    <span class="section-subtitle">Side-by-side comparison of Media, Consumer Promo, and Trade Promo — investment, volume uplift, efficiency, and ROI vs prior period</span>
</div>

<div class="table-container">
    <div class="table-wrapper">
        <table class="data-table" id="roiScorecardTable">
            <thead>
                <tr>
                    <th>Channel / Bucket</th>
                    <th class="num">Investment (Current)</th>
                    <th class="num">Investment (Prior)</th>
                    <th class="num">Inv. Change %</th>
                    <th class="num">Volume Uplift %</th>
                    <th class="num">Efficiency Cur (Rev/$)</th>
                    <th class="num">Efficiency Prior</th>
                    <th class="num">ROI (Current)</th>
                    <th class="num">ROI (Prior)</th>
                    <th class="num">ROI Change %</th>
                </tr>
            </thead>
            <tbody id="roiScorecardBody"></tbody>
        </table>
    </div>
</div>

<!-- =============================================================== -->
<!-- SECTION 1: Revenue Decomposition (full-width)                    -->
<!-- =============================================================== -->
<div class="section-header">
    <h3>&#x1F4C8; Revenue Decomposition by Driver</h3>
    <span class="section-subtitle">How much revenue comes from Base Sales, each Media Channel, Promos, and Seasonality over time</span>
</div>

<div class="charts-grid">
    <div class="chart-container full-width">
        <div class="chart-header">
            <span class="chart-title">Revenue Decomposition Over Time</span>
            <div class="chart-actions">
                <button class="chart-action-btn" onclick="expandChart('chart_decomposition')" title="Fullscreen">
                    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" y1="3" x2="14" y2="10"/><line x1="3" y1="21" x2="10" y2="14"/></svg>
                </button>
            </div>
        </div>
        <div class="chart-area" id="chart_decomposition"><div class="loading-overlay"><div class="spinner"></div></div></div>
    </div>
</div>

<!-- =============================================================== -->
<!-- SECTION 2: Volume Contribution by Period + Donut                 -->
<!-- Two-column: stacked bar (periods) LEFT | Base vs Incremental RIGHT + support table below -->
<!-- =============================================================== -->
<div class="section-header">
    <h3>&#x1F4E6; Volume Contribution by Period &amp; Driver Mix</h3>
    <span class="section-subtitle">How each driver's revenue contribution has shifted across years/quarters, and the overall base vs incremental split</span>
</div>

<div class="charts-grid">
    <div class="chart-container">
        <div class="chart-header">
            <span class="chart-title">Revenue Contribution by Driver — Period Comparison</span>
            <div class="chart-actions">
                <button class="chart-action-btn" onclick="expandChart('chart_vol_contribution')" title="Fullscreen">
                    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" y1="3" x2="14" y2="10"/><line x1="3" y1="21" x2="10" y2="14"/></svg>
                </button>
            </div>
        </div>
        <div class="chart-area" id="chart_vol_contribution"><div class="loading-overlay"><div class="spinner"></div></div></div>
    </div>
    <div class="chart-container">
        <div class="chart-header">
            <span class="chart-title">Base (Organic) vs Marketing-Driven Split</span>
            <div class="chart-actions">
                <button class="chart-action-btn" onclick="expandChart('chart_base_incremental')" title="Fullscreen">
                    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" y1="3" x2="14" y2="10"/><line x1="3" y1="21" x2="10" y2="14"/></svg>
                </button>
            </div>
        </div>
        <div class="chart-area" id="chart_base_incremental"><div class="loading-overlay"><div class="spinner"></div></div></div>
    </div>
</div>

<!-- Support vs Contribution Table (justifies the charts above) -->
<div class="table-container">
    <div class="table-header">
        <h3>Driver Support &amp; Contribution Detail</h3>
        <span style="font-size:12px;color:#6b7280;">Investment (support) per driver, attributed revenue, volume contribution, efficiency, and share of total revenue</span>
    </div>
    <div class="table-wrapper">
        <table class="data-table" id="supportContribTable">
            <thead>
                <tr>
                    <th>Driver</th>
                    <th>Category</th>
                    <th class="num">Support / Investment</th>
                    <th class="num">Revenue Contribution</th>
                    <th class="num">Volume Contribution</th>
                    <th class="num">Efficiency (Rev / $)</th>
                    <th class="num">% of Total Revenue</th>
                </tr>
            </thead>
            <tbody id="supportContribBody"></tbody>
        </table>
    </div>
</div>

<!-- =============================================================== -->
<!-- SECTION 3: Investment Mix + Efficiency Trend                     -->
<!-- =============================================================== -->
<div class="section-header">
    <h3>&#x1F4B0; Investment Mix &amp; Marketing Efficiency</h3>
    <span class="section-subtitle">How the investment mix (Media vs Promo vs Trade) has evolved, and whether returns per dollar are improving</span>
</div>

<div class="charts-grid">
    <div class="chart-container">
        <div class="chart-header">
            <span class="chart-title">Investment Mix Over Time</span>
            <div class="chart-actions">
                <button class="chart-action-btn" onclick="expandChart('chart_inv_mix')" title="Fullscreen">
                    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" y1="3" x2="14" y2="10"/><line x1="3" y1="21" x2="10" y2="14"/></svg>
                </button>
            </div>
        </div>
        <div class="chart-area" id="chart_inv_mix"><div class="loading-overlay"><div class="spinner"></div></div></div>
    </div>
    <div class="chart-container">
        <div class="chart-header">
            <span class="chart-title">Marketing Efficiency Trend (Revenue per $ Invested)</span>
            <div class="chart-actions">
                <button class="chart-action-btn" onclick="expandChart('chart_efficiency_trend')" title="Fullscreen">
                    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" y1="3" x2="14" y2="10"/><line x1="3" y1="21" x2="10" y2="14"/></svg>
                </button>
            </div>
        </div>
        <div class="chart-area" id="chart_efficiency_trend"><div class="loading-overlay"><div class="spinner"></div></div></div>
    </div>
</div>

<!-- =============================================================== -->
<!-- SECTION 4: Contribution Share + Period Waterfall                 -->
<!-- =============================================================== -->
<div class="section-header">
    <h3>&#x1F4B5; Contribution Share &amp; Period Comparison</h3>
    <span class="section-subtitle">Which driver contributes the most, and how did performance change period-over-period</span>
</div>

<div class="charts-grid">
    <div class="chart-container">
        <div class="chart-header">
            <span class="chart-title">Contribution Share by Driver (Waterfall)</span>
            <div class="chart-actions">
                <button class="chart-action-btn" onclick="expandChart('chart_contribution')" title="Fullscreen">
                    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" y1="3" x2="14" y2="10"/><line x1="3" y1="21" x2="10" y2="14"/></svg>
                </button>
            </div>
        </div>
        <div class="chart-area" id="chart_contribution"><div class="loading-overlay"><div class="spinner"></div></div></div>
    </div>
    <div class="chart-container">
        <div class="chart-header">
            <span class="chart-title">Revenue Change Breakdown (Period vs Period)</span>
            <div class="chart-actions">
                <button class="chart-action-btn" onclick="expandChart('chart_waterfall')" title="Fullscreen">
                    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" y1="3" x2="14" y2="10"/><line x1="3" y1="21" x2="10" y2="14"/></svg>
                </button>
            </div>
        </div>
        <div class="chart-area" id="chart_waterfall"><div class="loading-overlay"><div class="spinner"></div></div></div>
    </div>
</div>

<!-- =============================================================== -->
<!-- SECTION 5: Seasonality + Overall Summary Table                   -->
<!-- =============================================================== -->
<div class="section-header">
    <h3>&#x1F504; Seasonality &amp; Period Performance Summary</h3>
    <span class="section-subtitle">Recurring seasonal patterns and full period-over-period KPI comparison</span>
</div>

<div class="charts-grid">
    <div class="chart-container full-width">
        <div class="chart-header">
            <span class="chart-title">Revenue Seasonality Index</span>
            <div class="chart-actions">
                <button class="chart-action-btn" onclick="expandChart('chart_seasonality')" title="Fullscreen">
                    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" y1="3" x2="14" y2="10"/><line x1="3" y1="21" x2="10" y2="14"/></svg>
                </button>
            </div>
        </div>
        <div class="chart-area" id="chart_seasonality"><div class="loading-overlay"><div class="spinner"></div></div></div>
    </div>
</div>

<!-- Overall KPI Summary Table -->
<div class="table-container">
    <div class="table-header">
        <h3>Period-over-Period KPI Summary</h3>
    </div>
    <div class="table-wrapper">
        <table class="data-table summary-table" id="overallSummaryTable">
            <thead>
                <tr>
                    <th>Metric</th>
                    <th class="num">Current Period</th>
                    <th class="num">Previous Period</th>
                    <th class="num">Change</th>
                    <th class="num">% Change</th>
                </tr>
            </thead>
            <tbody id="overallSummaryBody"></tbody>
        </table>
    </div>
</div>
{% endblock %}

{% block scripts %}
<script src="{{ url_for('static', filename='js/diagnostics.js') }}"></script>
{% endblock %}