Compare commits

..

No commits in common. "e3492dd5de804a89e5774ebe9ec5673f2e939548" and "d2c3a11ce2c5fe8bba739d481a345ea81168931f" have entirely different histories.

2 changed files with 3 additions and 29 deletions

View File

@ -247,7 +247,7 @@ async def update_latest_data():
current_data = latest_data[f"PU_{pu}"]
logging.debug(f"[MONITOR BUFFER] PU{pu}: {current_data}")
# logging.info(f"[MONITOR BUFFER] latest_data: {latest_data}")
await asyncio.sleep(0.05)
await asyncio.sleep(0.1)
@app.get("/monitor")
@ -348,7 +348,7 @@ async def record_data_loop():
recording_file.flush()
last_flush_time = datetime.datetime.now()
await asyncio.sleep(0.05) # 10 Hz
await asyncio.sleep(0.1) # 10 Hz
## AUTOMATIC TESTING

View File

@ -17,7 +17,7 @@
.plot-container {
display: flex;
flex-direction: column;
gap: 10px;
gap: 40px;
align-items: center;
}
.plot {
@ -67,8 +67,6 @@ function initAllPlots() {
xaxis: { title: 'Time', type: 'date' },
yaxis: { title: plot.id.includes('P') ? 'Pressure (bar)' : 'Flow (L/h)' },
};
// Add ref line if present
if (plot.ref !== undefined) {
data.push({
x: [time0[0], time0[0]],
@ -79,23 +77,9 @@ function initAllPlots() {
showlegend: true
});
}
// Add QSkid trace only for Qperm plot
if (plot.id === 'Qperm-plot') {
data.push({
x: time0.slice(),
y: zero.slice(),
name: 'QSkid',
mode: 'lines',
line: { color: 'black', width: 2, dash: 'dot' },
legendgroup: 'PatientSkid'
});
}
Plotly.newPlot(plot.id, data, layout);
});
}
async function updateAllPlots() {
try {
const res = await fetch('/monitor');
@ -126,16 +110,6 @@ async function updateAllPlots() {
y: [[plot.ref]]
}, [puList.length], maxPoints); // the ref line is always the last trace
}
// Extend PatientSkid.QSkid only for Qperm plot
if (plot.id === 'Qperm-plot') {
const qSkid = SkidData["QSkid"];
const skidX = [[timestamp]];
const skidY = [[qSkid !== undefined ? qSkid : null]];
const qSkidTraceIndex = puList.length + (plot.ref !== undefined ? 1 : 0); // last trace index
Plotly.extendTraces(plot.id, { x: skidX, y: skidY }, [qSkidTraceIndex], maxPoints);
}
});
} catch (err) {
console.error("Failed to update plots:", err);