real-time graph view
This commit is contained in:
parent
31333c8ba3
commit
aea7403f10
@ -10,12 +10,26 @@ const PatientDetailModal = ({ patient, onClose }) => {
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [selectedMetric, setSelectedMetric] = useState('all');
|
||||
|
||||
useEffect(() => {
|
||||
useEffect(() => {
|
||||
// 1. Fetch immediately on open
|
||||
fetchPatientHistory();
|
||||
|
||||
// 2. Set up polling interval (every 2 seconds)
|
||||
const intervalId = setInterval(() => {
|
||||
// We pass 'true' to indicate this is a background update
|
||||
// (so we don't show the loading spinner again)
|
||||
fetchPatientHistory(true);
|
||||
}, 2000);
|
||||
|
||||
// 3. Cleanup on close
|
||||
return () => clearInterval(intervalId);
|
||||
}, [patient.patient_id]);
|
||||
|
||||
const fetchPatientHistory = async () => {
|
||||
const fetchPatientHistory = async (isBackgroundUpdate = false) => {
|
||||
try {
|
||||
// Only show loading spinner on the FIRST load, not subsequent updates
|
||||
if (!isBackgroundUpdate) setLoading(true);
|
||||
|
||||
const response = await fetch(`${API_BASE}/api/patients/${patient.patient_id}/vitals-history?limit=200`);
|
||||
const data = await response.json();
|
||||
|
||||
|
||||
4
vitallink/logs/all_pids.txt
Normal file
4
vitallink/logs/all_pids.txt
Normal file
@ -0,0 +1,4 @@
|
||||
68835
|
||||
68890
|
||||
68897
|
||||
69003
|
||||
File diff suppressed because it is too large
Load Diff
1
vitallink/logs/backend.pid
Normal file
1
vitallink/logs/backend.pid
Normal file
@ -0,0 +1 @@
|
||||
68835
|
||||
@ -3,7 +3,7 @@
|
||||
> vite
|
||||
|
||||
|
||||
VITE v7.1.10 ready in 262 ms
|
||||
VITE v7.1.10 ready in 223 ms
|
||||
|
||||
➜ Local: http://localhost:5173/
|
||||
➜ Network: use --host to expose
|
||||
|
||||
1
vitallink/logs/dashboard.pid
Normal file
1
vitallink/logs/dashboard.pid
Normal file
@ -0,0 +1 @@
|
||||
68897
|
||||
@ -4,7 +4,7 @@
|
||||
|
||||
Port 5173 is in use, trying another one...
|
||||
|
||||
VITE v7.1.10 ready in 236 ms
|
||||
VITE v7.1.10 ready in 216 ms
|
||||
|
||||
➜ Local: http://localhost:5174/
|
||||
➜ Network: use --host to expose
|
||||
|
||||
1
vitallink/logs/kiosk.pid
Normal file
1
vitallink/logs/kiosk.pid
Normal file
@ -0,0 +1 @@
|
||||
69003
|
||||
1
vitallink/logs/wristbands.pid
Normal file
1
vitallink/logs/wristbands.pid
Normal file
@ -0,0 +1 @@
|
||||
68890
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user