File size: 24,689 Bytes
5309153
 
 
 
941f5e0
5309153
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
import pandas as pd
import numpy as np
from datetime import datetime
from data import extract_model_data
from utils import COLORS
import gradio as gr
import plotly.express as px
import plotly.graph_objects as go

def get_time_series_summary_dfs(historical_df: pd.DataFrame) -> dict:
    daily_stats = []
    dates = sorted(historical_df['date'].unique())
    for date in dates:
        date_data = historical_df[historical_df['date'] == date]
        amd_passed = date_data['success_amd'].sum() if 'success_amd' in date_data.columns else 0
        amd_failed = (date_data['failed_multi_no_amd'].sum() + date_data['failed_single_no_amd'].sum()) if 'failed_multi_no_amd' in date_data.columns else 0
        amd_skipped = date_data['skipped_amd'].sum() if 'skipped_amd' in date_data.columns else 0
        amd_total = amd_passed + amd_failed + amd_skipped
        amd_failure_rate = (amd_failed / amd_total * 100) if amd_total > 0 else 0

        nvidia_passed = date_data['success_nvidia'].sum() if 'success_nvidia' in date_data.columns else 0
        nvidia_failed = (date_data['failed_multi_no_nvidia'].sum() + date_data['failed_single_no_nvidia'].sum()) if 'failed_multi_no_nvidia' in date_data.columns else 0
        nvidia_skipped = date_data['skipped_nvidia'].sum() if 'skipped_nvidia' in date_data.columns else 0
        nvidia_total = nvidia_passed + nvidia_failed + nvidia_skipped
        nvidia_failure_rate = (nvidia_failed / nvidia_total * 100) if nvidia_total > 0 else 0

        daily_stats.append({
            'date': date,
            'amd_failure_rate': amd_failure_rate,
            'nvidia_failure_rate': nvidia_failure_rate,
            'amd_passed': amd_passed,
            'amd_failed': amd_failed,
            'amd_skipped': amd_skipped,
            'nvidia_passed': nvidia_passed,
            'nvidia_failed': nvidia_failed,
            'nvidia_skipped': nvidia_skipped
        })

    failure_rate_data = []
    for i, stat in enumerate(daily_stats):
        amd_change = stat['amd_failure_rate'] - daily_stats[i-1]['amd_failure_rate'] if i > 0 else 0
        nvidia_change = stat['nvidia_failure_rate'] - daily_stats[i-1]['nvidia_failure_rate'] if i > 0 else 0
        failure_rate_data.extend([
            {'date': stat['date'], 'failure_rate': stat['amd_failure_rate'], 'platform': 'AMD', 'change': amd_change},
            {'date': stat['date'], 'failure_rate': stat['nvidia_failure_rate'], 'platform': 'NVIDIA', 'change': nvidia_change}
        ])
    failure_rate_df = pd.DataFrame(failure_rate_data)

    amd_data = []
    for i, stat in enumerate(daily_stats):
        passed_change = stat['amd_passed'] - daily_stats[i-1]['amd_passed'] if i > 0 else 0
        failed_change = stat['amd_failed'] - daily_stats[i-1]['amd_failed'] if i > 0 else 0
        skipped_change = stat['amd_skipped'] - daily_stats[i-1]['amd_skipped'] if i > 0 else 0
        amd_data.extend([
            {'date': stat['date'], 'count': stat['amd_passed'], 'test_type': 'Passed', 'change': passed_change},
            {'date': stat['date'], 'count': stat['amd_failed'], 'test_type': 'Failed', 'change': failed_change},
            {'date': stat['date'], 'count': stat['amd_skipped'], 'test_type': 'Skipped', 'change': skipped_change}
        ])
    amd_df = pd.DataFrame(amd_data)

    nvidia_data = []
    for i, stat in enumerate(daily_stats):
        passed_change = stat['nvidia_passed'] - daily_stats[i-1]['nvidia_passed'] if i > 0 else 0
        failed_change = stat['nvidia_failed'] - daily_stats[i-1]['nvidia_failed'] if i > 0 else 0
        skipped_change = stat['nvidia_skipped'] - daily_stats[i-1]['nvidia_skipped'] if i > 0 else 0
        nvidia_data.extend([
            {'date': stat['date'], 'count': stat['nvidia_passed'], 'test_type': 'Passed', 'change': passed_change},
            {'date': stat['date'], 'count': stat['nvidia_failed'], 'test_type': 'Failed', 'change': failed_change},
            {'date': stat['date'], 'count': stat['nvidia_skipped'], 'test_type': 'Skipped', 'change': skipped_change}
        ])
    nvidia_df = pd.DataFrame(nvidia_data)

    return {
        'failure_rates_df': failure_rate_df,
        'amd_tests_df': amd_df,
        'nvidia_tests_df': nvidia_df,
    }

def get_model_time_series_dfs(historical_df: pd.DataFrame, model_name: str) -> dict:
    model_data = historical_df[historical_df.index.str.lower() == model_name.lower()]
    
    if model_data.empty:
        empty_df = pd.DataFrame({'date': [], 'count': [], 'test_type': [], 'change': []})
        return {'amd_df': empty_df.copy(), 'nvidia_df': empty_df.copy()}

    dates = sorted(model_data['date'].unique())
    amd_data = []
    nvidia_data = []
    for i, date in enumerate(dates):
        date_data = model_data[model_data['date'] == date]
        row = date_data.iloc[0]

        amd_passed = row.get('success_amd', 0)
        amd_failed = row.get('failed_multi_no_amd', 0) + row.get('failed_single_no_amd', 0)
        amd_skipped = row.get('skipped_amd', 0)
        prev_row = model_data[model_data['date'] == dates[i-1]].iloc[0] if i > 0 and not model_data[model_data['date'] == dates[i-1]].empty else None
        amd_passed_change = amd_passed - (prev_row.get('success_amd', 0) if prev_row is not None else 0)
        amd_failed_change = amd_failed - (prev_row.get('failed_multi_no_amd', 0) + prev_row.get('failed_single_no_amd', 0) if prev_row is not None else 0)
        amd_skipped_change = amd_skipped - (prev_row.get('skipped_amd', 0) if prev_row is not None else 0)
        amd_data.extend([
            {'date': date, 'count': amd_passed, 'test_type': 'Passed', 'change': amd_passed_change},
            {'date': date, 'count': amd_failed, 'test_type': 'Failed', 'change': amd_failed_change},
            {'date': date, 'count': amd_skipped, 'test_type': 'Skipped', 'change': amd_skipped_change}
        ])

        nvidia_passed = row.get('success_nvidia', 0)
        nvidia_failed = row.get('failed_multi_no_nvidia', 0) + row.get('failed_single_no_nvidia', 0)
        nvidia_skipped = row.get('skipped_nvidia', 0)
        if prev_row is not None:
            prev_nvidia_passed = prev_row.get('success_nvidia', 0)
            prev_nvidia_failed = prev_row.get('failed_multi_no_nvidia', 0) + prev_row.get('failed_single_no_nvidia', 0)
            prev_nvidia_skipped = prev_row.get('skipped_nvidia', 0)
        else:
            prev_nvidia_passed = prev_nvidia_failed = prev_nvidia_skipped = 0
        nvidia_data.extend([
            {'date': date, 'count': nvidia_passed, 'test_type': 'Passed', 'change': nvidia_passed - prev_nvidia_passed},
            {'date': date, 'count': nvidia_failed, 'test_type': 'Failed', 'change': nvidia_failed - prev_nvidia_failed},
            {'date': date, 'count': nvidia_skipped, 'test_type': 'Skipped', 'change': nvidia_skipped - prev_nvidia_skipped}
        ])

    return {'amd_df': pd.DataFrame(amd_data), 'nvidia_df': pd.DataFrame(nvidia_data)}

def create_time_series_summary_gradio(historical_df: pd.DataFrame) -> dict:
    if historical_df.empty or 'date' not in historical_df.columns:
        # Create empty Plotly figure
        empty_fig = go.Figure()
        empty_fig.update_layout(
            title="No historical data available",
            height=500,
            font=dict(size=16, color='#CCCCCC'),
            paper_bgcolor='#000000',
            plot_bgcolor='#1a1a1a',
            margin=dict(b=130)
        )
        return {
            'failure_rates': empty_fig,
            'amd_tests': empty_fig,
            'nvidia_tests': empty_fig
        }
    
    daily_stats = []
    dates = sorted(historical_df['date'].unique())
    
    for date in dates:
        date_data = historical_df[historical_df['date'] == date]
        
        # Calculate failure rates using the same logic as summary_page.py
        # This includes ERROR tests in failures and excludes SKIPPED from total
        total_amd_tests = 0
        total_amd_failures = 0
        total_nvidia_tests = 0
        total_nvidia_failures = 0
        amd_passed = 0
        amd_failed = 0
        amd_skipped = 0
        nvidia_passed = 0
        nvidia_failed = 0
        nvidia_skipped = 0
        
        for _, row in date_data.iterrows():
            amd_stats, nvidia_stats = extract_model_data(row)[:2]
            
            # AMD (matching summary_page.py logic: failed + error, excluding skipped)
            amd_total = amd_stats['passed'] + amd_stats['failed'] + amd_stats['error']
            if amd_total > 0:
                total_amd_tests += amd_total
                total_amd_failures += amd_stats['failed'] + amd_stats['error']
            
            # For test counts graphs (these still use the old logic with skipped)
            amd_passed += amd_stats['passed']
            amd_failed += amd_stats['failed'] + amd_stats['error']
            amd_skipped += amd_stats['skipped']
            
            # NVIDIA (matching summary_page.py logic: failed + error, excluding skipped)
            nvidia_total = nvidia_stats['passed'] + nvidia_stats['failed'] + nvidia_stats['error']
            if nvidia_total > 0:
                total_nvidia_tests += nvidia_total
                total_nvidia_failures += nvidia_stats['failed'] + nvidia_stats['error']
            
            # For test counts graphs (these still use the old logic with skipped)
            nvidia_passed += nvidia_stats['passed']
            nvidia_failed += nvidia_stats['failed'] + nvidia_stats['error']
            nvidia_skipped += nvidia_stats['skipped']
        
        amd_failure_rate = (total_amd_failures / total_amd_tests * 100) if total_amd_tests > 0 else 0
        nvidia_failure_rate = (total_nvidia_failures / total_nvidia_tests * 100) if total_nvidia_tests > 0 else 0
        
        daily_stats.append({
            'date': date,
            'amd_failure_rate': amd_failure_rate,
            'nvidia_failure_rate': nvidia_failure_rate,
            'amd_passed': amd_passed,
            'amd_failed': amd_failed,
            'amd_skipped': amd_skipped,
            'nvidia_passed': nvidia_passed,
            'nvidia_failed': nvidia_failed,
            'nvidia_skipped': nvidia_skipped
        })
    
    failure_rate_data = []
    for i, stat in enumerate(daily_stats):
        amd_change = nvidia_change = 0
        if i > 0:
            amd_change = stat['amd_failure_rate'] - daily_stats[i-1]['amd_failure_rate']
            nvidia_change = stat['nvidia_failure_rate'] - daily_stats[i-1]['nvidia_failure_rate']
        
        failure_rate_data.extend([
            {'date': stat['date'], 'failure_rate': stat['amd_failure_rate'], 'platform': 'AMD', 'change': amd_change},
            {'date': stat['date'], 'failure_rate': stat['nvidia_failure_rate'], 'platform': 'NVIDIA', 'change': nvidia_change}
        ])
    
    failure_rate_df = pd.DataFrame(failure_rate_data)
    
    amd_data = []
    for i, stat in enumerate(daily_stats):
        passed_change = failed_change = skipped_change = 0
        if i > 0:
            passed_change = stat['amd_passed'] - daily_stats[i-1]['amd_passed']
            failed_change = stat['amd_failed'] - daily_stats[i-1]['amd_failed']
            skipped_change = stat['amd_skipped'] - daily_stats[i-1]['amd_skipped']
        
        amd_data.extend([
            {'date': stat['date'], 'count': stat['amd_passed'], 'test_type': 'Passed', 'change': passed_change},
            {'date': stat['date'], 'count': stat['amd_failed'], 'test_type': 'Failed', 'change': failed_change},
            {'date': stat['date'], 'count': stat['amd_skipped'], 'test_type': 'Skipped', 'change': skipped_change}
        ])
    
    amd_df = pd.DataFrame(amd_data)
    
    nvidia_data = []
    for i, stat in enumerate(daily_stats):
        passed_change = failed_change = skipped_change = 0
        if i > 0:
            passed_change = stat['nvidia_passed'] - daily_stats[i-1]['nvidia_passed']
            failed_change = stat['nvidia_failed'] - daily_stats[i-1]['nvidia_failed']
            skipped_change = stat['nvidia_skipped'] - daily_stats[i-1]['nvidia_skipped']
        
        nvidia_data.extend([
            {'date': stat['date'], 'count': stat['nvidia_passed'], 'test_type': 'Passed', 'change': passed_change},
            {'date': stat['date'], 'count': stat['nvidia_failed'], 'test_type': 'Failed', 'change': failed_change},
            {'date': stat['date'], 'count': stat['nvidia_skipped'], 'test_type': 'Skipped', 'change': skipped_change}
        ])
    
    nvidia_df = pd.DataFrame(nvidia_data)
    
    # Create Plotly figure for failure rates with alternating colors
    fig_failure_rates = go.Figure()
    
    # Add NVIDIA line (green line with white markers - Barcelona style)
    nvidia_data = failure_rate_df[failure_rate_df['platform'] == 'NVIDIA']
    if not nvidia_data.empty:
        fig_failure_rates.add_trace(go.Scatter(
            x=nvidia_data['date'],
            y=nvidia_data['failure_rate'],
            mode='lines+markers',
            name='NVIDIA',
            line=dict(color='#76B900', width=3),  # Green line
            marker=dict(size=12, color='#FFFFFF', line=dict(color='#76B900', width=2)),  # White markers with green border
            hovertemplate='<b>NVIDIA</b><br>Date: %{x}<br>Failure Rate: %{y:.2f}%<extra></extra>'
        ))
    
    # Add AMD line (red line with dark gray markers - Barcelona style)
    amd_data = failure_rate_df[failure_rate_df['platform'] == 'AMD']
    if not amd_data.empty:
        fig_failure_rates.add_trace(go.Scatter(
            x=amd_data['date'],
            y=amd_data['failure_rate'],
            mode='lines+markers',
            name='AMD',
            line=dict(color='#ED1C24', width=3),  # Red line
            marker=dict(size=12, color='#404040', line=dict(color='#ED1C24', width=2)),  # Dark gray markers with red border
            hovertemplate='<b>AMD</b><br>Date: %{x}<br>Failure Rate: %{y:.2f}%<extra></extra>'
        ))
    
    fig_failure_rates.update_layout(
        title="Overall Failure Rates Over Time",
        height=500,
        font=dict(size=16, color='#CCCCCC'),
        paper_bgcolor='#000000',
        plot_bgcolor='#1a1a1a',
        title_font_size=20,
        legend=dict(
            font=dict(size=16), 
            bgcolor='rgba(0,0,0,0.5)', 
            orientation="h",
            yanchor="bottom", 
            y=-0.4, 
            xanchor="center", 
            x=0.5
        ),
        xaxis=dict(title='Date', title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
        yaxis=dict(title='Failure Rate (%)', title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
        hovermode='x unified',
        margin=dict(b=130)
    )
    
    # Create Plotly figure for AMD tests
    fig_amd = px.line(
        amd_df,
        x='date',
        y='count',
        color='test_type',
        color_discrete_map={"Passed": COLORS['passed'], "Failed": COLORS['failed'], "Skipped": COLORS['skipped']},
        title="AMD Test Results Over Time",
        labels={'count': 'Number of Tests', 'date': 'Date', 'test_type': 'Test Type'}
    )
    fig_amd.update_traces(mode='lines+markers', marker=dict(size=8), line=dict(width=3))
    fig_amd.update_layout(
        height=500,
        font=dict(size=16, color='#CCCCCC'),
        paper_bgcolor='#000000',
        plot_bgcolor='#1a1a1a',
        title_font_size=20,
        legend=dict(
            font=dict(size=16), 
            bgcolor='rgba(0,0,0,0.5)', 
            orientation="h",
            yanchor="bottom", 
            y=-0.4, 
            xanchor="center", 
            x=0.5
        ),
        xaxis=dict(title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
        yaxis=dict(title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
        hovermode='x unified',
        margin=dict(b=130)
    )
    
    # Create Plotly figure for NVIDIA tests
    fig_nvidia = px.line(
        nvidia_df,
        x='date',
        y='count',
        color='test_type',
        color_discrete_map={"Passed": COLORS['passed'], "Failed": COLORS['failed'], "Skipped": COLORS['skipped']},
        title="NVIDIA Test Results Over Time",
        labels={'count': 'Number of Tests', 'date': 'Date', 'test_type': 'Test Type'}
    )
    fig_nvidia.update_traces(mode='lines+markers', marker=dict(size=8), line=dict(width=3))
    fig_nvidia.update_layout(
        height=500,
        font=dict(size=16, color='#CCCCCC'),
        paper_bgcolor='#000000',
        plot_bgcolor='#1a1a1a',
        title_font_size=20,
        legend=dict(
            font=dict(size=16), 
            bgcolor='rgba(0,0,0,0.5)', 
            orientation="h",
            yanchor="bottom", 
            y=-0.4, 
            xanchor="center", 
            x=0.5
        ),
        xaxis=dict(title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
        yaxis=dict(title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
        hovermode='x unified',
        margin=dict(b=130)
    )
    
    return {
        'failure_rates': fig_failure_rates,
        'amd_tests': fig_amd,
        'nvidia_tests': fig_nvidia
    }


def create_model_time_series_gradio(historical_df: pd.DataFrame, model_name: str) -> dict:
    if historical_df.empty or 'date' not in historical_df.columns:
        # Create empty Plotly figures
        empty_fig_amd = go.Figure()
        empty_fig_amd.update_layout(
            title=f"{model_name.upper()} - AMD Results Over Time",
            height=500,
            font=dict(size=16, color='#CCCCCC'),
            paper_bgcolor='#000000',
            plot_bgcolor='#1a1a1a',
            margin=dict(b=130)
        )
        empty_fig_nvidia = go.Figure()
        empty_fig_nvidia.update_layout(
            title=f"{model_name.upper()} - NVIDIA Results Over Time",
            height=500,
            font=dict(size=16, color='#CCCCCC'),
            paper_bgcolor='#000000',
            plot_bgcolor='#1a1a1a',
            margin=dict(b=130)
        )
        return {
            'amd_plot': empty_fig_amd,
            'nvidia_plot': empty_fig_nvidia
        }
    
    model_data = historical_df[historical_df.index.str.lower() == model_name.lower()]
    
    if model_data.empty:
        # Create empty Plotly figures
        empty_fig_amd = go.Figure()
        empty_fig_amd.update_layout(
            title=f"{model_name.upper()} - AMD Results Over Time",
            height=500,
            font=dict(size=16, color='#CCCCCC'),
            paper_bgcolor='#000000',
            plot_bgcolor='#1a1a1a',
            margin=dict(b=130)
        )
        empty_fig_nvidia = go.Figure()
        empty_fig_nvidia.update_layout(
            title=f"{model_name.upper()} - NVIDIA Results Over Time",
            height=500,
            font=dict(size=16, color='#CCCCCC'),
            paper_bgcolor='#000000',
            plot_bgcolor='#1a1a1a',
            margin=dict(b=130)
        )
        return {
            'amd_plot': empty_fig_amd,
            'nvidia_plot': empty_fig_nvidia
        }
    
    dates = sorted(model_data['date'].unique())
    
    amd_data = []
    nvidia_data = []
    
    for i, date in enumerate(dates):
        date_data = model_data[model_data['date'] == date]
        
        if not date_data.empty:
            row = date_data.iloc[0]
            
            amd_passed = row.get('success_amd', 0)
            amd_failed = row.get('failed_multi_no_amd', 0) + row.get('failed_single_no_amd', 0)
            amd_skipped = row.get('skipped_amd', 0)
            
            passed_change = failed_change = skipped_change = 0
            if i > 0:
                prev_date_data = model_data[model_data['date'] == dates[i-1]]
                if not prev_date_data.empty:
                    prev_row = prev_date_data.iloc[0]
                    prev_amd_passed = prev_row.get('success_amd', 0)
                    prev_amd_failed = prev_row.get('failed_multi_no_amd', 0) + prev_row.get('failed_single_no_amd', 0)
                    prev_amd_skipped = prev_row.get('skipped_amd', 0)
                    
                    passed_change = amd_passed - prev_amd_passed
                    failed_change = amd_failed - prev_amd_failed
                    skipped_change = amd_skipped - prev_amd_skipped
            
            amd_data.extend([
                {'date': date, 'count': amd_passed, 'test_type': 'Passed', 'change': passed_change},
                {'date': date, 'count': amd_failed, 'test_type': 'Failed', 'change': failed_change},
                {'date': date, 'count': amd_skipped, 'test_type': 'Skipped', 'change': skipped_change}
            ])
            
            nvidia_passed = row.get('success_nvidia', 0)
            nvidia_failed = row.get('failed_multi_no_nvidia', 0) + row.get('failed_single_no_nvidia', 0)
            nvidia_skipped = row.get('skipped_nvidia', 0)
            
            nvidia_passed_change = nvidia_failed_change = nvidia_skipped_change = 0
            if i > 0:
                prev_date_data = model_data[model_data['date'] == dates[i-1]]
                if not prev_date_data.empty:
                    prev_row = prev_date_data.iloc[0]
                    prev_nvidia_passed = prev_row.get('success_nvidia', 0)
                    prev_nvidia_failed = prev_row.get('failed_multi_no_nvidia', 0) + prev_row.get('failed_single_no_nvidia', 0)
                    prev_nvidia_skipped = prev_row.get('skipped_nvidia', 0)
                    
                    nvidia_passed_change = nvidia_passed - prev_nvidia_passed
                    nvidia_failed_change = nvidia_failed - prev_nvidia_failed
                    nvidia_skipped_change = nvidia_skipped - prev_nvidia_skipped
            
            nvidia_data.extend([
                {'date': date, 'count': nvidia_passed, 'test_type': 'Passed', 'change': nvidia_passed_change},
                {'date': date, 'count': nvidia_failed, 'test_type': 'Failed', 'change': nvidia_failed_change},
                {'date': date, 'count': nvidia_skipped, 'test_type': 'Skipped', 'change': nvidia_skipped_change}
            ])
    
    amd_df = pd.DataFrame(amd_data)
    nvidia_df = pd.DataFrame(nvidia_data)
    
    # Create Plotly figure for AMD
    fig_amd = px.line(
        amd_df,
        x='date',
        y='count',
        color='test_type',
        color_discrete_map={"Passed": COLORS['passed'], "Failed": COLORS['failed'], "Skipped": COLORS['skipped']},
        title=f"{model_name.upper()} - AMD Results Over Time",
        labels={'count': 'Number of Tests', 'date': 'Date', 'test_type': 'Test Type'}
    )
    fig_amd.update_traces(mode='lines+markers', marker=dict(size=8), line=dict(width=3))
    fig_amd.update_layout(
        height=500,
        font=dict(size=16, color='#CCCCCC'),
        paper_bgcolor='#000000',
        plot_bgcolor='#1a1a1a',
        title_font_size=20,
        legend=dict(
            font=dict(size=16), 
            bgcolor='rgba(0,0,0,0.5)', 
            orientation="h",
            yanchor="bottom", 
            y=-0.4, 
            xanchor="center", 
            x=0.5
        ),
        xaxis=dict(title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
        yaxis=dict(title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
        hovermode='x unified',
        margin=dict(b=130)
    )
    
    # Create Plotly figure for NVIDIA
    fig_nvidia = px.line(
        nvidia_df,
        x='date',
        y='count',
        color='test_type',
        color_discrete_map={"Passed": COLORS['passed'], "Failed": COLORS['failed'], "Skipped": COLORS['skipped']},
        title=f"{model_name.upper()} - NVIDIA Results Over Time",
        labels={'count': 'Number of Tests', 'date': 'Date', 'test_type': 'Test Type'}
    )
    fig_nvidia.update_traces(mode='lines+markers', marker=dict(size=8), line=dict(width=3))
    fig_nvidia.update_layout(
        height=500,
        font=dict(size=16, color='#CCCCCC'),
        paper_bgcolor='#000000',
        plot_bgcolor='#1a1a1a',
        title_font_size=20,
        legend=dict(
            font=dict(size=16), 
            bgcolor='rgba(0,0,0,0.5)', 
            orientation="h",
            yanchor="bottom", 
            y=-0.4, 
            xanchor="center", 
            x=0.5
        ),
        xaxis=dict(title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
        yaxis=dict(title_font_size=16, tickfont_size=14, gridcolor='#333333', showgrid=True),
        hovermode='x unified',
        margin=dict(b=130)
    )
    
    return {
        'amd_plot': fig_amd,
        'nvidia_plot': fig_nvidia
    }