"""
This file is the framework for generating multiple Streamlit applications 
through an object oriented framework. 
"""

# Import necessary libraries 
import streamlit as st
from src.visualization.insert import insert_app
from src.visualization.recall import recall_app

# Define the multipage class to manage the multiple apps in our program 
class MultiPage: 
    """Framework for combining multiple streamlit applications."""

    def __init__(self) -> None:
        """Constructor class to generate a list which will store all our applications as an instance variable."""
        self.pages = []
    
    def add_page(self, title, func) -> None: 
        """Class Method to Add pages to the project
        Args:
            title ([str]): The title of page which we are adding to the list of apps 
            
            func: Python function to render this page in Streamlit
        """

        self.pages.append({
          
                "title": title, 
                "function": func
            })

    def run(self):
        # Drodown to select the page to run  
        page = st.sidebar.selectbox(
            'App Navigation', 
            self.pages, 
            format_func=lambda page: page['title']
        )

        # run the app function 
        page['function']()



# Create an instance of the app 
app = MultiPage()

# Title of the main page
st.title("KLINIČNI PRIMERI")

# Add all your applications (pages) here
app.add_page("Dodaj klinični primer", insert_app)
app.add_page("Poglej klinične primere", recall_app)

# The main app
app.run()
"""
This file is the framework for generating multiple Streamlit applications 
through an object oriented framework. 
"""

# Import necessary libraries 
import streamlit as st
from src.visualization.insert import insert_app
from src.visualization.recall import recall_app

# Define the multipage class to manage the multiple apps in our program 
class MultiPage: 
    """Framework for combining multiple streamlit applications."""

    def __init__(self) -> None:
        """Constructor class to generate a list which will store all our applications as an instance variable."""
        self.pages = []
    
    def add_page(self, title, func) -> None: 
        """Class Method to Add pages to the project
        Args:
            title ([str]): The title of page which we are adding to the list of apps 
            
            func: Python function to render this page in Streamlit
        """

        self.pages.append({
          
                "title": title, 
                "function": func
            })

    def run(self):
        # Drodown to select the page to run  
        page = st.sidebar.selectbox(
            'App Navigation', 
            self.pages, 
            format_func=lambda page: page['title']
        )

        # run the app function 
        page['function']()



# Create an instance of the app 
app = MultiPage()

# Title of the main page
st.title("KLINIČNI PRIMERI")

# Add all your applications (pages) here
app.add_page("Dodaj klinični primer", insert_app)
app.add_page("Poglej klinične primere", recall_app)

# The main app
app.run()
This file is the framework for generating multiple Streamlit applications  through an object oriented framework. # Import necessary libraries # Define the multipage class to manage the multiple apps in our program Framework for combining multiple streamlit applications. Constructor class to generate a list which will store all our applications as an instance variable. Class Method to Add pages to the project         Args:             title ([str]): The title of page which we are adding to the list of apps                           func: Python function to render this page in Streamlit # Drodown to select the page to run # run the app function # Create an instance of the app # Title of the main page # Add all your applications (pages) here # The main app