import React, { useState, useRef } from 'react'; import { ClipboardList, PlusCircle, MessageCircle, Info, Mail, Award, Stethoscope, Search, X, Send, Upload, User, Clock, Phone, AlertCircle } from 'lucide-react'; export default function App() { const [activeTab, setActiveTab] = useState('dashboard'); const [patients, setPatients] = useState([ { id: 'P-001', name: 'John Doe', age: 32, symptoms: 'Fever', status: 'Infected', note: 'High parasitemia detected in peripheral blood smear.' }, ]); const [showModal, setShowModal] = useState(false); const [isAnalyzing, setIsAnalyzing] = useState(false); const [patientInfo, setPatientInfo] = useState({ name: '', age: '', symptoms: '' }); const [selectedFile, setSelectedFile] = useState(null); const [scanResult, setScanResult] = useState(null); const [messages, setMessages] = useState([ { sender: 'doctor', text: 'Hello! I am your AI clinical assistant. How can I assist you with your screening or research questions today?' } ]); const [inputValue, setInputValue] = useState(''); const [isTyping, setIsTyping] = useState(false); const fileInputRef = useRef(null); const handleScan = () => { setIsAnalyzing(true); // Simulate clinical reasoning setTimeout(() => { const isPositive = Math.random() > 0.4; const result = { status: isPositive ? 'Infected' : 'Uninfected', note: isPositive ? 'Analysis detected distinct ring-stage trophozoites and elevated parasitemia levels in the 40x magnified sample.' : 'Negative for Plasmodium species. Normal hematological morphology observed.' }; setScanResult(result); setPatients(prev => [{ id: `P-${Math.floor(Math.random()*900)}`, ...patientInfo, ...result }, ...prev]); setIsAnalyzing(false); }, 2500); }; const handleSendMessage = async () => { if (!inputValue.trim()) return; const userMessage = inputValue; setMessages(prev => [...prev, { sender: 'user', text: userMessage }]); setInputValue(''); setIsTyping(true); try { const systemPrompt = "You are a highly professional virtual clinical assistant for a Malaria Clinic. Provide accurate, evidence-based, and concise medical information."; const apiUrl = `https://generativelanguage.googleapis.com/v1beta/models/gemini-3-flash-preview:generateContent`; const payload = { contents: [{ parts: [{ text: userMessage }] }], tools: [{ "google_search": {} }], systemInstruction: { parts: [{ text: systemPrompt }] } }; const response = await fetch(apiUrl, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }); const result = await response.json(); const candidate = result.candidates?.[0]; let assistantText = "I'm sorry, I couldn't process that query right now."; let sources = []; if (candidate && candidate.content?.parts?.[0]?.text) { assistantText = candidate.content.parts[0].text; if (candidate.groundingMetadata?.groundingAttributions) { sources = candidate.groundingMetadata.groundingAttributions .map(attr => ({ uri: attr.web?.uri, title: attr.web?.title })) .filter(s => s.uri && s.title); } } setMessages(prev => [...prev, { sender: 'doctor', text: assistantText, sources }]); } catch (error) { setMessages(prev => [...prev, { sender: 'doctor', text: "I encountered an error while searching for that information. Please try again." }]); } finally { setIsTyping(false); } }; const NavItem = ({ id, icon: Icon, label }) => ( ); return (
Automated Malaria Screening System
{p.name} ({p.age}y)
{p.symptoms}
{p.status}
{item.val}
{item.desc}
Clinic Sentinel is an advanced diagnostic initiative dedicated to eradicating the diagnostic bottleneck in malaria detection. Our core model is a custom-engineered Convolutional Neural Network (CNN) that achieves 98.99% accuracy.
Over 15 years of experience in tropical medicine and automated diagnostic imaging.
Specializes in Deep Learning for medical vision, bridging the gap between AI and patient care.
{selectedFile ? selectedFile.name : 'Upload Blood Smear Image'}
setSelectedFile(e.target.files[0])} />{scanResult.note}