Update new unified dose management, style/other improvements
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
export const LOCAL_STORAGE_KEY = 'medPlanAssistantState_v5';
|
||||
export const LOCAL_STORAGE_KEY = 'medPlanAssistantState_v6';
|
||||
export const LDX_TO_DAMPH_CONVERSION_FACTOR = 0.2948;
|
||||
|
||||
// Type definitions
|
||||
@@ -17,15 +17,17 @@ export interface PkParams {
|
||||
ldx: { halfLife: string; absorptionRate: string };
|
||||
}
|
||||
|
||||
export interface Dose {
|
||||
export interface DayDose {
|
||||
id: string;
|
||||
time: string;
|
||||
dose: string;
|
||||
label: string;
|
||||
ldx: string;
|
||||
damph?: string; // Optional, kept for backwards compatibility but not used in UI
|
||||
}
|
||||
|
||||
export interface Deviation extends Dose {
|
||||
dayOffset?: number;
|
||||
isAdditional: boolean;
|
||||
export interface DayGroup {
|
||||
id: string;
|
||||
isTemplate: boolean;
|
||||
doses: DayDose[];
|
||||
}
|
||||
|
||||
export interface SteadyStateConfig {
|
||||
@@ -39,7 +41,8 @@ export interface TherapeuticRange {
|
||||
|
||||
export interface UiSettings {
|
||||
showDayTimeOnXAxis: boolean;
|
||||
chartView: 'damph' | 'ldx' | 'both';
|
||||
showTemplateDay: boolean;
|
||||
chartView: 'ldx' | 'damph' | 'both';
|
||||
yAxisMin: string;
|
||||
yAxisMax: string;
|
||||
simulationDays: string;
|
||||
@@ -48,13 +51,25 @@ export interface UiSettings {
|
||||
|
||||
export interface AppState {
|
||||
pkParams: PkParams;
|
||||
doses: Dose[];
|
||||
days: DayGroup[];
|
||||
steadyStateConfig: SteadyStateConfig;
|
||||
therapeuticRange: TherapeuticRange;
|
||||
doseIncrement: string;
|
||||
uiSettings: UiSettings;
|
||||
}
|
||||
|
||||
// Legacy interfaces for backwards compatibility (will be removed later)
|
||||
export interface Dose {
|
||||
time: string;
|
||||
dose: string;
|
||||
label: string;
|
||||
}
|
||||
|
||||
export interface Deviation extends Dose {
|
||||
dayOffset?: number;
|
||||
isAdditional: boolean;
|
||||
}
|
||||
|
||||
export interface ConcentrationPoint {
|
||||
timeHours: number;
|
||||
ldx: number;
|
||||
@@ -67,18 +82,24 @@ export const getDefaultState = (): AppState => ({
|
||||
damph: { halfLife: '11' },
|
||||
ldx: { halfLife: '0.8', absorptionRate: '1.5' },
|
||||
},
|
||||
doses: [
|
||||
{ time: '06:30', dose: '25', label: 'morning' },
|
||||
{ time: '12:30', dose: '10', label: 'midday' },
|
||||
{ time: '17:00', dose: '10', label: 'afternoon' },
|
||||
{ time: '22:00', dose: '10', label: 'evening' },
|
||||
{ time: '01:00', dose: '0', label: 'night' },
|
||||
days: [
|
||||
{
|
||||
id: 'day-template',
|
||||
isTemplate: true,
|
||||
doses: [
|
||||
{ id: 'dose-1', time: '06:30', ldx: '25' },
|
||||
{ id: 'dose-2', time: '12:30', ldx: '10' },
|
||||
{ id: 'dose-3', time: '17:00', ldx: '10' },
|
||||
{ id: 'dose-4', time: '22:00', ldx: '10' },
|
||||
]
|
||||
}
|
||||
],
|
||||
steadyStateConfig: { daysOnMedication: '7' },
|
||||
therapeuticRange: { min: '10.5', max: '11.5' },
|
||||
doseIncrement: '2.5',
|
||||
uiSettings: {
|
||||
showDayTimeOnXAxis: true,
|
||||
showTemplateDay: false,
|
||||
chartView: 'both',
|
||||
yAxisMin: '0',
|
||||
yAxisMax: '16',
|
||||
|
||||
Reference in New Issue
Block a user