mirror of
https://github.com/gauvainboiche/ketapk.git
synced 2026-09-02 11:13:11 +02:00
fix: Changing colors in background to reflect KetaPK excel version
This commit is contained in:
@@ -1,21 +1,11 @@
|
||||
import { CLINICAL_THRESHOLDS } from './pkCore.js';
|
||||
import { t } from './i18n.js';
|
||||
|
||||
// Le texte des zones cliniques (zone.textHex) est calibré pour un fond sombre.
|
||||
// Sur le thème clair, il faut un texte foncé pour rester lisible sur le même fond pastel.
|
||||
const LIGHT_THEME_ZONE_TEXT = {
|
||||
inactive: '#854d0e',
|
||||
anti_hyperalgesic: '#3f6212',
|
||||
analgesia: '#92400e',
|
||||
psychedelic: '#9d174d',
|
||||
emergence: '#075985',
|
||||
narcosis: '#1e3a8a',
|
||||
excessive: '#7f1d1d'
|
||||
};
|
||||
|
||||
// Les couleurs de zone sont volontairement fixes (indépendantes du thème d'interface) :
|
||||
// elles reproduisent le dégradé de référence de l'outil KetaPK original. Seul le texte
|
||||
// (zone.textHex) est choisi pour rester lisible sur cette couleur de fond opaque.
|
||||
export function updateChartAnnotations(chart, mode, currentYMax) {
|
||||
const thresholds = CLINICAL_THRESHOLDS[mode];
|
||||
const theme = document.documentElement.getAttribute('data-theme') || 'dark';
|
||||
const annotations = {};
|
||||
|
||||
thresholds.zones.forEach((zone, index) => {
|
||||
@@ -24,6 +14,7 @@ export function updateChartAnnotations(chart, mode, currentYMax) {
|
||||
|
||||
annotations[`zone_${index}`] = {
|
||||
type: 'box',
|
||||
drawTime: 'beforeDraw',
|
||||
yMin: zone.min,
|
||||
yMax: Math.min(zoneMax, currentYMax),
|
||||
backgroundColor: zone.color,
|
||||
@@ -31,7 +22,7 @@ export function updateChartAnnotations(chart, mode, currentYMax) {
|
||||
label: {
|
||||
display: true,
|
||||
content: t(`zones.${zone.zoneKey}`),
|
||||
color: theme === 'light' ? (LIGHT_THEME_ZONE_TEXT[zone.zoneKey] || '#1e293b') : zone.textHex,
|
||||
color: zone.textHex,
|
||||
font: { size: 11, weight: 'bold' },
|
||||
position: 'center'
|
||||
}
|
||||
|
||||
+17
-16
@@ -8,7 +8,7 @@
|
||||
/**
|
||||
* Version unique de l'application (Centralisée)
|
||||
*/
|
||||
export const APP_VERSION = '0.18.0';
|
||||
export const APP_VERSION = '0.19.0';
|
||||
|
||||
export const MODES = {
|
||||
ESKETAMINE: 'ESKETAMINE',
|
||||
@@ -49,26 +49,26 @@ export const CLINICAL_THRESHOLDS = {
|
||||
maxScale: 500,
|
||||
defaultConcentration: 5,
|
||||
zones: [
|
||||
{ zoneKey: "inactive", min: 0, max: 10, color: "rgba(249, 252, 126, 0.25)", textHex: "#fef9c3" },
|
||||
{ zoneKey: "anti_hyperalgesic", min: 10, max: 50, color: "rgba(218, 247, 166, 0.25)", textHex: "#d9f99d" },
|
||||
{ zoneKey: "analgesia", min: 50, max: 150, color: "rgba(255, 195, 0, 0.25)", textHex: "#fef08a" },
|
||||
{ zoneKey: "psychedelic", min: 150, max: 350, color: "rgba(242, 160, 223, 0.25)", textHex: "#fbcfe8" },
|
||||
{ zoneKey: "emergence", min: 350, max: 500, color: "rgba(89, 196, 240, 0.25)", textHex: "#bae6fd" },
|
||||
{ zoneKey: "narcosis", min: 500, max: 1000, color: "rgba(43, 122, 244, 0.25)", textHex: "#ffffff" },
|
||||
{ zoneKey: "excessive", min: 1000, max: Infinity, color: "rgba(255, 87, 51, 0.25)", textHex: "#fecaca" }
|
||||
{ zoneKey: "inactive", min: 0, max: 10, color: "#eaf7d8", textHex: "#4d5a1e" },
|
||||
{ zoneKey: "anti_hyperalgesic", min: 10, max: 50, color: "#ddf78a", textHex: "#355e1a" },
|
||||
{ zoneKey: "analgesia", min: 50, max: 150, color: "#ffcc33", textHex: "#7a4a00" },
|
||||
{ zoneKey: "psychedelic", min: 150, max: 350, color: "#f562f0", textHex: "#6b0f61" },
|
||||
{ zoneKey: "emergence", min: 350, max: 500, color: "#4fd3f7", textHex: "#013a4d" },
|
||||
{ zoneKey: "narcosis", min: 500, max: 1000, color: "#0ea5f0", textHex: "#ffffff" },
|
||||
{ zoneKey: "excessive", min: 1000, max: Infinity, color: "#ff4d4d", textHex: "#ffffff" }
|
||||
]
|
||||
},
|
||||
[MODES.RACEMIQUE]: {
|
||||
maxScale: 1000,
|
||||
defaultConcentration: 10,
|
||||
zones: [
|
||||
{ zoneKey: "inactive", min: 0, max: 20, color: "rgba(249, 252, 126, 0.25)", textHex: "#fef9c3" },
|
||||
{ zoneKey: "anti_hyperalgesic", min: 20, max: 100, color: "rgba(218, 247, 166, 0.25)", textHex: "#d9f99d" },
|
||||
{ zoneKey: "analgesia", min: 100, max: 300, color: "rgba(255, 195, 0, 0.25)", textHex: "#fef08a" },
|
||||
{ zoneKey: "psychedelic", min: 300, max: 700, color: "rgba(242, 160, 223, 0.25)", textHex: "#fbcfe8" },
|
||||
{ zoneKey: "emergence", min: 700, max: 1000, color: "rgba(89, 196, 240, 0.25)", textHex: "#bae6fd" },
|
||||
{ zoneKey: "narcosis", min: 1000, max: 2000, color: "rgba(43, 122, 244, 0.25)", textHex: "#ffffff" },
|
||||
{ zoneKey: "excessive", min: 2000, max: Infinity, color: "rgba(255, 87, 51, 0.25)", textHex: "#fecaca" }
|
||||
{ zoneKey: "inactive", min: 0, max: 20, color: "#eaf7d8", textHex: "#4d5a1e" },
|
||||
{ zoneKey: "anti_hyperalgesic", min: 20, max: 100, color: "#ddf78a", textHex: "#355e1a" },
|
||||
{ zoneKey: "analgesia", min: 100, max: 300, color: "#ffcc33", textHex: "#7a4a00" },
|
||||
{ zoneKey: "psychedelic", min: 300, max: 700, color: "#f562f0", textHex: "#6b0f61" },
|
||||
{ zoneKey: "emergence", min: 700, max: 1000, color: "#4fd3f7", textHex: "#013a4d" },
|
||||
{ zoneKey: "narcosis", min: 1000, max: 2000, color: "#0ea5f0", textHex: "#ffffff" },
|
||||
{ zoneKey: "excessive", min: 2000, max: Infinity, color: "#ff4d4d", textHex: "#ffffff" }
|
||||
]
|
||||
}
|
||||
};
|
||||
@@ -191,7 +191,8 @@ export function generateSimulationData({ model, weightKg, timelineInputs, infusi
|
||||
if (!nextEvent) return;
|
||||
|
||||
const deltaT = nextEvent.time - event.time;
|
||||
const Rn = infusionRateToMgKgPerMin(event.infusionRate, infusionUnit, weightKg) / refDose;
|
||||
// Excel applique le débit déclaré à la fin de l'intervalle (colonne d'arrivée), pas celui du départ
|
||||
const Rn = infusionRateToMgKgPerMin(nextEvent.infusionRate, infusionUnit, weightKg) / refDose;
|
||||
|
||||
const Falpha = Math.exp(-alpha * deltaT);
|
||||
const Fbeta = Math.exp(-beta * deltaT);
|
||||
|
||||
Reference in New Issue
Block a user