arshenoy commited on
Commit
1e87695
·
verified ·
1 Parent(s): 9c1d653

Update components/ReportView.tsx

Browse files
Files changed (1) hide show
  1. components/ReportView.tsx +174 -100
components/ReportView.tsx CHANGED
@@ -1,111 +1,185 @@
1
  import React from 'react';
2
  import { PatientProfile, ClinicalVitals, RiskAnalysisResult, ChatMessage, Medication } from '../types';
3
- import { FileText, User, Activity, Pill, MessageSquare, ShieldCheck, Zap, Server } from 'lucide-react';
4
 
5
  interface ReportViewProps {
6
- profile: PatientProfile;
7
- vitals: ClinicalVitals;
8
- riskResult: RiskAnalysisResult | null;
9
- chatHistory: ChatMessage[];
10
- chatSummary: string;
11
- medications: Medication[];
12
  }
13
 
14
  const ReportView: React.FC<ReportViewProps> = ({
15
- profile,
16
- vitals,
17
- riskResult,
18
- chatHistory,
19
- chatSummary,
20
- medications
21
  }) => {
22
- return (
23
- <div className="space-y-6 mt-12 pt-8 border-t border-white/10">
24
- <h2 className="text-2xl font-bold text-white flex items-center gap-2">
25
- <FileText className="text-neon-green" /> Full Clinical Report
26
- </h2>
27
- <div className="glass-panel p-6 rounded-2xl space-y-8">
28
- <section>
29
- <h3 className="text-sm font-mono font-bold text-gray-400 uppercase mb-4 border-b border-white/5 pb-2 flex items-center gap-2">
30
- <User size={16} /> Patient Profile
31
- </h3>
32
- <div className="grid grid-cols-2 lg:grid-cols-4 gap-4 text-sm">
33
- <div className="bg-black/20 p-3 rounded-lg border border-white/5"><span className="text-gray-500 text-xs block">NAME</span><span className="font-bold">{profile.name}</span></div>
34
- <div className="bg-black/20 p-3 rounded-lg border border-white/5"><span className="text-gray-500 text-xs block">AGE / GENDER</span><span className="font-bold">{profile.age} / {profile.gender}</span></div>
35
- <div className="bg-black/20 p-3 rounded-lg border border-white/5"><span className="text-gray-500 text-xs block">CONDITION</span><span className="font-bold text-neon-red">{profile.condition}</span></div>
36
- <div className="bg-black/20 p-3 rounded-lg border border-white/5"><span className="text-gray-500 text-xs block">SMOKING</span><span className="font-bold">{profile.smokingStatus}</span></div>
37
- </div>
38
- </section>
39
- <section>
40
- <h3 className="text-sm font-mono font-bold text-gray-400 uppercase mb-4 border-b border-white/5 pb-2 flex items-center gap-2">
41
- <Activity size={16} /> Vitals & Risk Assessment
42
- </h3>
43
- <div className="grid grid-cols-2 lg:grid-cols-5 gap-4 text-sm mb-4">
44
- <div className="bg-black/20 p-3 rounded-lg border border-white/5"><span className="text-gray-500 text-xs block">AVG BP (SYS)</span><span className="font-bold">{vitals.systolicBp} mmHg</span></div>
45
- <div className="bg-black/20 p-3 rounded-lg border border-white/5"><span className="text-gray-500 text-xs block">GLUCOSE</span><span className="font-bold">{vitals.glucose} mg/dL</span></div>
46
- <div className="bg-black/20 p-3 rounded-lg border border-white/5"><span className="text-gray-500 text-xs block">HEART RATE</span><span className="font-bold">{vitals.heartRate} bpm</span></div>
47
- <div className="bg-black/20 p-3 rounded-lg border border-white/5"><span className="text-gray-500 text-xs block">WEIGHT</span><span className="font-bold">{vitals.weight} kg</span></div>
48
- <div className="bg-black/20 p-3 rounded-lg border border-white/5"><span className="text-gray-500 text-xs block">RISK SCORE</span><span className={`font-bold text-xl ${!riskResult ? 'text-gray-500' : riskResult.numericScore > 60 ? 'text-neon-red' : riskResult.numericScore > 30 ? 'text-neon-yellow' : 'text-neon-green'}`}>{riskResult ? riskResult.numericScore : '--'}</span></div>
49
- </div>
50
- {riskResult && (
51
- <div className="bg-white/5 p-4 rounded-lg border border-white/5">
52
- <p className="text-xs font-bold text-neon-blue uppercase mb-1 flex items-center gap-1">
53
- <ShieldCheck size={12} /> Key Findings from {riskResult.source}
54
- </p>
55
- <p className="text-sm text-gray-300 leading-relaxed">{riskResult.summary}</p>
56
- </div>
57
- )}
58
- </section>
59
- <section>
60
- <h3 className="text-sm font-mono font-bold text-gray-400 uppercase mb-4 border-b border-white/5 pb-2 flex items-center gap-2">
61
- <Pill size={16} /> Medication Tracker
62
- </h3>
63
- <div className="overflow-x-auto">
64
- <table className="w-full text-sm text-left border-collapse">
65
- <thead>
66
- <tr className="bg-black/40 text-gray-400 text-xs uppercase font-mono">
67
- <th className="px-4 py-2 border border-white/5">Medication</th>
68
- <th className="px-4 py-2 border border-white/5">Dosage</th>
69
- <th className="px-4 py-2 border border-white/5">Time</th>
70
- <th className="px-4 py-2 border border-white/5">Status</th>
71
- </tr>
72
- </thead>
73
- <tbody className="text-gray-300">
74
- {medications.length > 0 ? medications.map((med, i) => (
75
- <tr key={i} className="hover:bg-black/30">
76
- <td className="px-4 py-3 border border-white/5 font-bold">{med.name}</td>
77
- <td className="px-4 py-3 border border-white/5 text-gray-400">{med.dosage}</td>
78
- <td className="px-4 py-3 border border-white/5 font-mono">{med.time}</td>
79
- <td className="px-4 py-3 border border-white/5">
80
- <span className={`px-2 py-0.5 rounded text-xs font-bold ${med.taken ? 'bg-green-500/10 text-green-400' : 'bg-gray-500/10 text-gray-400'}`}>
81
- {med.taken ? 'TAKEN' : 'PENDING'}
82
- </span>
83
- </td>
84
- </tr>
85
- )) : (
86
- <tr><td colSpan={4} className="px-4 py-6 text-center text-gray-500 italic">No medications recorded.</td></tr>
87
- )}
88
- </tbody>
89
- </table>
90
- </div>
91
- </section>
92
- <section>
93
- <h3 className="text-sm font-mono font-bold text-gray-400 uppercase mb-4 border-b border-white/5 pb-2 flex items-center gap-2">
94
- <MessageSquare size={16} /> Consultation Brief
95
- </h3>
96
- {chatSummary ? (
97
- <div className="bg-black/20 p-4 rounded-lg border border-white/5">
98
- <p className="text-sm text-gray-300 whitespace-pre-wrap leading-relaxed">
99
- {chatSummary}
100
- </p>
101
- </div>
102
- ) : (
103
- <p className="text-gray-500 text-sm italic">No consultation summary available.</p>
104
- )}
105
- </section>
106
- </div>
107
- </div>
108
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  };
110
 
111
  export default ReportView;
 
1
  import React from 'react';
2
  import { PatientProfile, ClinicalVitals, RiskAnalysisResult, ChatMessage, Medication } from '../types';
3
+ import { FileText, User, Activity, Pill, MessageSquare, ShieldCheck, Zap, Server, Clipboard } from 'lucide-react';
4
 
5
  interface ReportViewProps {
6
+ profile: PatientProfile;
7
+ vitals: ClinicalVitals;
8
+ riskResult: RiskAnalysisResult | null;
9
+ chatHistory: ChatMessage[];
10
+ chatSummary: string;
11
+ medications: Medication[];
12
  }
13
 
14
  const ReportView: React.FC<ReportViewProps> = ({
15
+ profile,
16
+ vitals,
17
+ riskResult,
18
+ chatHistory,
19
+ chatSummary,
20
+ medications
21
  }) => {
22
+ return (
23
+ <div className="space-y-6 mt-12 pt-8 border-t border-white/10">
24
+ <h2 className="text-2xl font-bold text-white flex items-center gap-2">
25
+ <FileText className="text-neon-green" /> Full Clinical Report
26
+ </h2>
27
+
28
+ <div className="glass-panel p-6 rounded-2xl space-y-8">
29
+ {/* 1. Demographics (Compact) */}
30
+ <section>
31
+ <h3 className="text-sm font-mono font-bold text-gray-400 uppercase mb-4 border-b border-white/5 pb-2 flex items-center gap-2">
32
+ <User size={16} /> Patient Demographics
33
+ </h3>
34
+ <div className="grid grid-cols-2 md:grid-cols-4 gap-4 text-sm">
35
+ <div className="bg-black/20 p-3 rounded-lg border border-white/5"><span className="text-gray-500 block text-xs uppercase tracking-wide">Name</span><span className="text-white font-bold">{profile.name}</span></div>
36
+ <div className="bg-black/20 p-3 rounded-lg border border-white/5"><span className="text-gray-500 block text-xs uppercase tracking-wide">Age</span><span className="text-white font-bold">{profile.age}</span></div>
37
+ <div className="bg-black/20 p-3 rounded-lg border border-white/5"><span className="text-gray-500 block text-xs uppercase tracking-wide">Gender</span><span className="text-white font-bold">{profile.gender}</span></div>
38
+ <div className="bg-black/20 p-3 rounded-lg border border-white/5"><span className="text-gray-500 block text-xs uppercase tracking-wide">Blood Group</span><span className="text-white font-bold">{profile.bloodGroup}</span></div>
39
+ </div>
40
+ </section>
41
+
42
+ {/* 2. Condition & History (Full Width - Moved here per request) */}
43
+ <section className="bg-white/5 p-4 rounded-xl border border-white/5">
44
+ <h3 className="text-sm font-mono font-bold text-gray-400 uppercase mb-3 flex items-center gap-2">
45
+ <Clipboard size={16} /> Clinical Background
46
+ </h3>
47
+ <div className="space-y-4">
48
+ <div>
49
+ <span className="text-xs text-neon-blue font-bold uppercase tracking-wide block mb-1">Primary Condition</span>
50
+ <p className="text-white text-sm bg-black/20 p-3 rounded-lg border border-white/5">{profile.condition}</p>
51
+ </div>
52
+ <div>
53
+ <span className="text-xs text-gray-500 font-bold uppercase tracking-wide block mb-1">Detailed History</span>
54
+ <p className="text-gray-300 text-sm bg-black/20 p-3 rounded-lg border border-white/5 leading-relaxed">
55
+ {profile.history || 'No detailed history recorded.'}
56
+ </p>
57
+ </div>
58
+ </div>
59
+ </section>
60
+
61
+ {/* 3. Vitals & Risk */}
62
+ <section>
63
+ <h3 className="text-sm font-mono font-bold text-gray-400 uppercase mb-4 border-b border-white/5 pb-2 flex items-center gap-2 justify-between">
64
+ <div className="flex items-center gap-2"><Activity size={16} /> Vitals & Risk Analysis</div>
65
+ {riskResult?.source && (
66
+ <span className="text-[10px] font-mono font-medium text-gray-500 flex items-center gap-1 bg-white/5 px-2 py-0.5 rounded">
67
+ {riskResult.source.includes('Gemini') ? <Zap size={10}/> : <Server size={10}/>}
68
+ {riskResult.source}
69
+ </span>
70
+ )}
71
+ </h3>
72
+ <div className="grid grid-cols-1 md:grid-cols-4 gap-4 mb-4">
73
+ <div className="bg-white/5 p-3 rounded-lg text-center border border-white/5">
74
+ <span className="text-gray-500 text-xs block">Systolic BP</span>
75
+ <span className="font-mono font-bold text-neon-green text-lg">{vitals.systolicBp}</span>
76
+ </div>
77
+ <div className="bg-white/5 p-3 rounded-lg text-center border border-white/5">
78
+ <span className="text-gray-500 text-xs block">Glucose</span>
79
+ <span className="font-mono font-bold text-neon-yellow text-lg">{vitals.glucose}</span>
80
+ </div>
81
+ <div className="bg-white/5 p-3 rounded-lg text-center border border-white/5">
82
+ <span className="text-gray-500 text-xs block">SpO2</span>
83
+ <span className={`font-mono font-bold text-lg ${vitals.spo2 < 95 ? 'text-neon-red' : 'text-cyan-400'}`}>{vitals.spo2}%</span>
84
+ </div>
85
+ <div className="bg-white/5 p-3 rounded-lg text-center border border-white/5">
86
+ <span className="text-gray-500 text-xs block">Risk Score</span>
87
+ <span className="font-mono font-bold text-neon-red text-lg">{riskResult?.numericScore ?? 'N/A'}</span>
88
+ </div>
89
+ </div>
90
+ {riskResult ? (
91
+ <div className="space-y-4">
92
+ <div className="text-sm text-gray-300 bg-black/20 p-4 rounded-lg border border-white/5">
93
+ <p><strong className="text-neon-blue font-mono text-xs uppercase block mb-1">Summary</strong> {riskResult.summary}</p>
94
+ <div className="grid grid-cols-1 md:grid-cols-2 gap-4 mt-3">
95
+ <div>
96
+ <strong className="text-neon-green font-mono text-xs uppercase block mb-1">Recommended Actions</strong>
97
+ <ul className="list-disc list-inside text-gray-400">
98
+ {riskResult.actionItems.map((item, idx) => <li key={idx}>{item}</li>)}
99
+ </ul>
100
+ </div>
101
+ </div>
102
+ </div>
103
+
104
+ {/* Medical Coding Pipeline Table */}
105
+ <div className="bg-black/20 rounded-lg border border-white/5 overflow-hidden">
106
+ <div className="px-4 py-2 bg-purple-500/10 border-b border-white/5 flex items-center gap-2 text-purple-300 font-bold text-xs uppercase tracking-wide">
107
+ <ShieldCheck size={14} /> Insurance & Coding Pipeline
108
+ </div>
109
+ <table className="w-full text-xs text-left">
110
+ <thead className="text-gray-500 border-b border-white/5">
111
+ <tr>
112
+ <th className="px-4 py-2">Diagnosis Type</th>
113
+ <th className="px-4 py-2">ICD-10 Code</th>
114
+ <th className="px-4 py-2">Description</th>
115
+ </tr>
116
+ </thead>
117
+ <tbody className="divide-y divide-white/5 text-gray-300">
118
+ {riskResult.codingPipeline?.map((code, idx) => (
119
+ <tr key={idx} className="hover:bg-white/5">
120
+ <td className="px-4 py-2 text-gray-400">{code.type}</td>
121
+ <td className="px-4 py-2 font-mono text-purple-400 font-bold">{code.code}</td>
122
+ <td className="px-4 py-2">{code.description}</td>
123
+ </tr>
124
+ ))}
125
+ {(!riskResult.codingPipeline || riskResult.codingPipeline.length === 0) && (
126
+ <tr>
127
+ <td colSpan={3} className="px-4 py-2 italic text-gray-500">Pipeline empty. Run analysis to generate.</td>
128
+ </tr>
129
+ )}
130
+ </tbody>
131
+ </table>
132
+ {riskResult.insuranceNote && (
133
+ <div className="px-4 py-2 border-t border-white/5 bg-white/5">
134
+ <p className="text-[10px] text-gray-500 uppercase font-bold">Medical Necessity Note</p>
135
+ <p className="text-xs text-gray-300 italic">{riskResult.insuranceNote}</p>
136
+ </div>
137
+ )}
138
+ </div>
139
+ </div>
140
+ ) : (
141
+ <p className="text-gray-500 text-sm italic">Analysis not yet performed.</p>
142
+ )}
143
+ </section>
144
+
145
+ {/* Meds */}
146
+ <section>
147
+ <h3 className="text-sm font-mono font-bold text-gray-400 uppercase mb-4 border-b border-white/5 pb-2 flex items-center gap-2">
148
+ <Pill size={16} /> Medication Schedule
149
+ </h3>
150
+ <ul className="grid grid-cols-1 md:grid-cols-2 gap-2">
151
+ {medications.length > 0 ? medications.map(med => (
152
+ <li key={med.id} className="flex justify-between items-center text-sm bg-white/5 p-3 rounded-lg border border-white/5">
153
+ <div>
154
+ <span className="font-bold text-white block">{med.name}</span>
155
+ <span className="text-xs text-gray-500">{med.dosage} • {med.time}</span>
156
+ </div>
157
+ <span className={`px-2 py-1 rounded text-xs font-bold ${med.taken ? "bg-green-500/20 text-green-400" : "bg-yellow-500/20 text-yellow-400"}`}>
158
+ {med.taken ? 'Taken' : 'Pending'}
159
+ </span>
160
+ </li>
161
+ )) : <li className="text-gray-500 text-sm italic">No medications recorded.</li>}
162
+ </ul>
163
+ </section>
164
+
165
+ {/* Chat Summary */}
166
+ <section>
167
+ <h3 className="text-sm font-mono font-bold text-gray-400 uppercase mb-4 border-b border-white/5 pb-2 flex items-center gap-2">
168
+ <MessageSquare size={16} /> Consultation Brief
169
+ </h3>
170
+ {chatSummary ? (
171
+ <div className="bg-black/20 p-4 rounded-lg border border-white/5">
172
+ <p className="text-sm text-gray-300 whitespace-pre-wrap leading-relaxed">
173
+ {chatSummary}
174
+ </p>
175
+ </div>
176
+ ) : (
177
+ <p className="text-gray-500 text-sm italic">No consultation summary available.</p>
178
+ )}
179
+ </section>
180
+ </div>
181
+ </div>
182
+ );
183
  };
184
 
185
  export default ReportView;