File size: 1,718 Bytes
3af198d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b9cc8ad
 
 
3af198d
b9cc8ad
 
3af198d
b9cc8ad
 
 
3af198d
b9cc8ad
 
3af198d
b9cc8ad
fb525d2
3af198d
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import streamlit as st
from components.api_manager import APIManager
from components.agent_system import AgentSystem
from components.data_fetcher import DataFetcher
from components.animation_engineer import AnimationEngineer

class PrecisionMedicineApp:
    def __init__(self):
        self.api_manager = APIManager()
        self.agent_system = AgentSystem()
        self.data_fetcher = DataFetcher(self.api_manager)
        self.animation_engineer = AnimationEngineer()

    def run(self):
        st.title("Precision Medicine with MindsDB & Agent System")
        
        patient_number = st.text_input("Enter patient number for precision care analysis:")
        
        if st.button('Get Recommendations'):
            if patient_number:
                self.process_patient(patient_number)
            else:
                st.error("Please enter a patient number.")

    def process_patient(self, patient_number):
        with st.spinner("Fetching patient data..."):
            patient_data = self.data_fetcher.fetch_patient_data(patient_number)
        
        if patient_data:
            st.subheader("Patient Data:")
            st.json(patient_data)
            
            with st.spinner("Analyzing and coordinating care..."):
                patient_data_dict = self.data_fetcher.parse_patient_data(patient_data)
                final_plan = self.agent_system.coordinate_care(patient_data_dict)
            
            st.subheader("Care Plan:")
            st.success(final_plan)
            
            st.subheader("Care Plan Visualization:")
            self.animation_engineer.display_care_plan_animation(final_plan)

if __name__ == "__main__":
    app = PrecisionMedicineApp()
    app.run()