Update migrated js to ts and shadcn
This commit is contained in:
79
src/constants/defaults.ts
Normal file
79
src/constants/defaults.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
// Application constants
|
||||
export const LOCAL_STORAGE_KEY = 'medPlanAssistantState_v5';
|
||||
export const LDX_TO_DAMPH_CONVERSION_FACTOR = 0.2948;
|
||||
|
||||
// Type definitions
|
||||
export interface PkParams {
|
||||
damph: { halfLife: string };
|
||||
ldx: { halfLife: string; absorptionRate: string };
|
||||
}
|
||||
|
||||
export interface Dose {
|
||||
time: string;
|
||||
dose: string;
|
||||
label: string;
|
||||
}
|
||||
|
||||
export interface Deviation extends Dose {
|
||||
dayOffset?: number;
|
||||
isAdditional: boolean;
|
||||
}
|
||||
|
||||
export interface SteadyStateConfig {
|
||||
daysOnMedication: string;
|
||||
}
|
||||
|
||||
export interface TherapeuticRange {
|
||||
min: string;
|
||||
max: string;
|
||||
}
|
||||
|
||||
export interface UiSettings {
|
||||
showDayTimeOnXAxis: boolean;
|
||||
chartView: 'damph' | 'ldx' | 'both';
|
||||
yAxisMin: string;
|
||||
yAxisMax: string;
|
||||
simulationDays: string;
|
||||
displayedDays: string;
|
||||
}
|
||||
|
||||
export interface AppState {
|
||||
pkParams: PkParams;
|
||||
doses: Dose[];
|
||||
steadyStateConfig: SteadyStateConfig;
|
||||
therapeuticRange: TherapeuticRange;
|
||||
doseIncrement: string;
|
||||
uiSettings: UiSettings;
|
||||
}
|
||||
|
||||
export interface ConcentrationPoint {
|
||||
timeHours: number;
|
||||
ldx: number;
|
||||
damph: number;
|
||||
}
|
||||
|
||||
// Default application state
|
||||
export const getDefaultState = (): AppState => ({
|
||||
pkParams: {
|
||||
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' },
|
||||
],
|
||||
steadyStateConfig: { daysOnMedication: '7' },
|
||||
therapeuticRange: { min: '10.5', max: '11.5' },
|
||||
doseIncrement: '2.5',
|
||||
uiSettings: {
|
||||
showDayTimeOnXAxis: true,
|
||||
chartView: 'both',
|
||||
yAxisMin: '0',
|
||||
yAxisMax: '16',
|
||||
simulationDays: '3',
|
||||
displayedDays: '2',
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user