File size: 4,402 Bytes
12e3813
 
 
 
 
 
945485b
9b7eb7b
 
 
12e3813
 
 
 
 
 
 
 
 
 
 
 
 
 
 
945485b
12e3813
945485b
 
 
12e3813
 
 
 
 
 
 
 
9b7eb7b
 
 
12e3813
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
945485b
 
 
 
12e3813
 
9b7eb7b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12e3813
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>RetiCheck | Patient Database</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    
    <style>
        * { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; }
        body { background: #0f172a; color: white; padding: 30px; text-align: center; }
        
        .container { max-width: 900px; margin: 0 auto; background: rgba(255, 255, 255, 0.03); padding: 30px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.1); }
        h2 { color: #00f2fe; margin-bottom: 20px; }
        
        table { width: 100%; border-collapse: collapse; margin-top: 20px; }
        th, td { padding: 15px; border-bottom: 1px solid #334155; text-align: left; }
        th { background: #1e293b; color: #94a3b8; }
        tr:hover { background: rgba(255,255,255,0.05); }
        
        .safe { color: #10b981; font-weight: bold; }
        .urgent { color: #ef4444; font-weight: bold; }
        
        .btn-back { display: inline-block; padding: 12px 20px; background: #334155; color: white; text-decoration: none; border-radius: 10px; transition: 0.3s; font-weight: bold; }
        .btn-back:hover { background: #475569; }
        
        .btn-export { display: inline-block; padding: 12px 20px; background: #10b981; color: white; text-decoration: none; border-radius: 10px; font-weight: bold; margin-right: 15px; transition: 0.3s; box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3); }
        .btn-export:hover { background: #059669; transform: translateY(-2px); }
    </style>
</head>
<body>

    <div class="container">
        <h2>🏥 Patient Prediction Database</h2>
        <p style="color: #94a3b8; margin-bottom: 20px;">History of all retinal scans analyzed by AI.</p>
        
        <div style="width: 100%; max-width: 320px; margin: 0 auto 30px auto; background: rgba(0,0,0,0.2); padding: 20px; border-radius: 20px; border: 1px solid #334155;">
            <canvas id="diseaseChart"></canvas>
        </div>
        <table>
            <thead>
                <tr>
                    <th>Date & Time</th>
                    <th>Predicted Disease</th>
                    <th>AI Confidence</th>
                    <th>Triage Status</th>
                </tr>
            </thead>
            <tbody>
                {% for row in records %}
                <tr>
                    <td>{{ row[1] }}</td>
                    <td>{{ row[2] }}</td>
                    <td>{{ row[3] }}</td>
                    <td class="{% if row[4] == 'SAFE' %}safe{% else %}urgent{% endif %}">{{ row[4] }}</td>
                </tr>
                {% else %}
                <tr>
                    <td colspan="4" style="text-align: center; color: #94a3b8;">No patient records found yet. Scan an image first!</td>
                </tr>
                {% endfor %}
            </tbody>
        </table>

        <div style="margin-top: 30px;">
            <a href="/export_csv" class="btn-export"><i class="fa-solid fa-file-excel"></i> Download Excel Report</a>
            <a href="/upload" class="btn-back">🔙 Back to Scanner</a>
        </div>
    </div>

    <script>
        const ctx = document.getElementById('diseaseChart').getContext('2d');
        const diseaseChart = new Chart(ctx, {
            type: 'doughnut',
            data: {
                labels: ['Normal (Safe)', 'Diabetic (Urgent)', 'Glaucoma (Referral)'],
                datasets: [{
                    // பைதான் எண்ணி கொடுத்த நம்பர்களை இங்கே போடுகிறோம்
                    data: [{{ n_count }}, {{ d_count }}, {{ g_count }}],
                    backgroundColor: ['#10b981', '#ef4444', '#f59e0b'],
                    borderWidth: 2,
                    borderColor: '#0f172a',
                    hoverOffset: 10
                }]
            },
            options: {
                responsive: true,
                plugins: {
                    legend: { position: 'bottom', labels: { color: '#cbd5e1', font: { family: 'Poppins' } } }
                }
            }
        });
    </script>
    </body>
</html>