dawit45's picture
Update src/store/useOncologyStore.ts
e9135bc verified
import { create } from 'zustand';
// src/store/useOncologyStore.ts
export interface TrialMatch {
nct_id: string;
title: string;
match_quality: number;
phase: string;
location: string;
}
export interface ToxicityAlert {
id: string;
symptom: string;
grade: 1 | 2 | 3 | 4 | 5;
recommendation: string;
timestamp: string;
}
interface OncologyState {
mutation: string;
cancerType: string;
matches: TrialMatch[];
alerts: ToxicityAlert[];
setProfile: (mutation: string, cancerType: string) => void;
setMatches: (matches: TrialMatch[]) => void;
addAlert: (alert: ToxicityAlert) => void;
}
// src/store/useOncologyStore.ts (Updated with sample data)
export const useOncologyStore = create<OncologyState>((set) => ({
mutation: 'BRAF V600E',
cancerType: 'Melanoma',
// Add a sample trial here so the dashboard isn't empty
matches: [
{
nct_id: "NCT04567890",
title: "Targeted Therapy for BRAF-Mutant Advanced Melanoma",
match_quality: 0.95,
phase: "Phase III",
location: "Mayo Clinic, MN"
}
],
alerts: [],
setProfile: (mutation, cancerType) => set({ mutation, cancerType }),
setMatches: (matches) => set({ matches }),
addAlert: (alert) => set((state) => ({ alerts: [alert, ...state.alerts] })),
}));