fix: Fixing dose calculus + small display changes

This commit is contained in:
gauvainboiche
2026-08-02 17:28:06 +02:00
parent abe44eca1d
commit 165935521a
2 changed files with 8 additions and 10 deletions
+5 -5
View File
@@ -94,24 +94,24 @@ export function calculate5MinInfusionDose(rate, unit, weight) {
}
/**
* Calcul d'un bolus unique à l'instant t
* Calcul d'un bolus unique à l'instant t avec prise en compte de refDose
*/
export function calculateBolusCp(model, doseMg, weightKg, timeElapsedMin) {
if (timeElapsedMin < 0 || weightKg <= 0) return 0;
if (timeElapsedMin < 0 || weightKg <= 0 || !model.refDose) return 0;
const dosePerKg = doseMg / weightKg;
const { A, alpha, B, beta, C, gamma } = model;
const { A, alpha, B, beta, C, gamma, refDose } = model;
const termA = A * Math.exp(-alpha * timeElapsedMin);
const termB = B * Math.exp(-beta * timeElapsedMin);
const termC = C * (gamma ? Math.exp(-gamma * timeElapsedMin) : 0);
return dosePerKg * (termA + termB + termC);
// Division par refDose pour respecter la formule exacte de l'Excel
return (dosePerKg / refDose) * (termA + termB + termC);
}
/**
* Propage la perfusion active sur la timeline (pas de 5 min)
* Indique si chaque pas de temps possède une consigne explicite (isExplicit) ou héritée.
*/
export function processTimelineEvents(timelineInputs, weightKg, infusionUnit) {
let currentRate = 0;