import streamlit as st # Set the page configuration to use the full width of the screen st.set_page_config(layout="wide") # Define the letter types and their corresponding definitions and fields letter_types = { "Referral Letters": { "Definition": "Letters asking for more help or treatment", "Fields": ["Patient info", "Referral details"] }, "Medical Certificate Letters": { "Definition": "Letters about a patient's health problem or limits", "Fields": ["Patient info", "Health problem details"] }, "Prescription Letters": { "Definition": "Letters allowing medicine", "Fields": ["Patient info", "Medicine details"] }, "Diagnosis Letters": { "Definition": "Letters explaining a patient's health problem", "Fields": ["Patient info", "Health problem details"] }, "Treatment Plan Letters": { "Definition": "Letters with a plan for getting better", "Fields": ["Patient info", "Treatment details"] }, "Surgery Recommendation Letters": { "Definition": "Letters saying a patient needs surgery", "Fields": ["Patient info", "Surgery details"] }, "Medical Clearance Letters": { "Definition": "Letters saying a patient can do activities", "Fields": ["Patient info", "Activity details"] }, "Follow-up Appointment Letters": { "Definition": "Letters reminding about appointments", "Fields": ["Patient info", "Appointment details"] }, "Disability Support Letters": { "Definition": "Letters about a patient's disability", "Fields": ["Patient info", "Disability details"] }, "Health Education Letters": { "Definition": "Letters teaching about health", "Fields": ["Patient info", "Education topic"] } } # Streamlit UI st.title("AI Letter Generation") # User selects the letter type selected_letter_type = st.selectbox("Select Letter Type", list(letter_types.keys())) # Display the definition and fields for the selected letter type st.write("Definition:", letter_types[selected_letter_type]["Definition"]) st.write("Fields Usually Needed:") for field in letter_types[selected_letter_type]["Fields"]: st.button(field) def generate_referral_letters_ui(): st.set_page_config(layout="wide") # Use the full width of the screen st.title("🀝 Referral Letters") # Create columns for layout col1, col2 = st.columns([3, 1]) # Adjust the ratio of column widths as needed # Search-style text box with col2: search_query = st.text_input("Search Referral Letters") # Buttons with emojis and boldface text st.button("πŸ“ **First**") st.button("πŸ“ **Middle**") st.button("πŸ“ **Last**") # Text areas with default values based on letter examples first_default = "Urgent need for further diagnostic testing for Mrs. Smith, who has persistent stomach issues\n" \ "Request for an audiological assessment for Mr. Johnson, aged 60" middle_default = "The patient has symptoms that suggest a more comprehensive review is required\n" \ "The patient’s issue requires specialized care beyond the scope of the referring physician" last_default = "Patient demographics, Referral details\n" \ "Diagnostic test reports, Medication details" with col2: first_text = st.text_area("First: State the request for consultation/treatment", value=first_default, max_chars=None, height=None) middle_text = st.text_area("Middle: Explain the reason for referral", value=middle_default, max_chars=None, height=None) last_text = st.text_area("Last: Provide patient info needed for the referred service", value=last_default, max_chars=None, height=None) # Username field with an emoji with col2: username = st.text_input("πŸ‘€ Username") # Run the Streamlit UI function # generate_referral_letters_ui() def generate_medical_certificate_letters_ui(): st.title("πŸ“œ Medical Certificate Letters") # Search-style text box search_query = st.text_input("Search Medical Certificate Letters") # Buttons with emojis and boldface text st.button("πŸ“ **First**") st.button("πŸ“ **Middle**") st.button("πŸ“ **Last**") # Text areas with default values based on letter examples first_default = "To certify Mr. Brown’s condition and advise on work restrictions\n" \ "To certify Ms. Lee’s health status for her impending travel." middle_default = "Mr. Brown has suffered from a heart attack and is under medication\n" \ "Ms. Lee has a chronic back pain condition that requires special accommodations during her travel" last_default = "No driving should be allowed for 6 months\n" \ "Ms. Lee must have an aisle seat and use cushions for lumbar support" first_text = st.text_area("First: State the reason for certification", value=first_default, max_chars=None, height=None) middle_text = st.text_area("Middle: Explain the patient’s medical condition", value=middle_default, max_chars=None, height=None) last_text = st.text_area("Last: Outline any necessary work/travel adjustments", value=last_default, max_chars=None, height=None) # Username field with an emoji username = st.text_input("πŸ‘€ Username") def generate_prescription_letters_ui(): st.title("πŸ’Š Prescription Letters") # Search-style text box search_query = st.text_input("Search Prescription Letters") # Buttons with emojis and boldface text st.button("πŸ“ **First**") st.button("πŸ“ **Middle**") st.button("πŸ“ **Last**") # Text areas with default values based on letter examples first_default = "Request for prescription for Mr. Clarke\n" \ "Prescription authorization for Mrs. Davis" middle_default = "Mr. Clarke requires medication for hypertension - Lisinopril 10mg BD with food\n" \ "Mrs. Davis is required to take two 500mg penicillin V tablets every 6 hours" last_default = "Medication details, allergies and any known side effects" first_text = st.text_area("First: Introduce prescription request", value=first_default, max_chars=None, height=None) middle_text = st.text_area("Middle: List dosage and frequency of medication", value=middle_default, max_chars=None, height=None) last_text = st.text_area("Last: Provide medication details", value=last_default, max_chars=None, height=None) # Username field with an emoji username = st.text_input("πŸ‘€ Username") def generate_diagnosis_letters_ui(): st.title("πŸ”¬ Diagnosis Letters") # Search-style text box search_query = st.text_input("Search Diagnosis Letters") # Buttons with emojis and boldface text st.button("πŸ“ **First**") st.button("πŸ“ **Middle**") st.button("πŸ“ **Last**") # Text areas with default values based on letter examples first_default = "The results of Mr. Thompson’s chest x-ray reveal Pneumonia\n" \ "The blood test results indicate that Mrs. Jones has Type 2 diabetes" middle_default = "Mr. Thompson has a bacterial infection that requires antibiotic treatment\n" \ "Mrs. Jones has a lifelong condition that requires medication, dietary adjustments, and lifestyle changes." last_default = "Recommend follow-up visits for monitoring and periodic testing\n" \ "Refer patients to the relevant healthcare specialist" first_text = st.text_area("First: State the diagnosis", value=first_default, max_chars=None, height=None) middle_text = st.text_area("Middle: Explain the diagnosis details", value=middle_default, max_chars=None, height=None) last_text = st.text_area("Last: Provide any necessary follow-up recommendations", value=last_default, max_chars=None, height=None) # Username field with an emoji username = st.text_input("πŸ‘€ Username") def generate_prescription_letters_ui(): st.title("πŸ’Š Prescription Letters") # Search-style text box search_query = st.text_input("Search Prescription Letters") # Buttons with emojis and boldface text st.button("πŸ“ **First**") st.button("πŸ“ **Middle**") st.button("πŸ“ **Last**") # Text areas with default values based on letter examples first_default = "Request for prescription for Mr. Clarke\n" \ "Prescription authorization for Mrs. Davis" middle_default = "Mr. Clarke requires medication for hypertension - Lisinopril 10mg BD with food\n" \ "Mrs. Davis is required to take two 500mg penicillin V tablets every 6 hours" last_default = "Medication details, allergies and any known side effects" first_text = st.text_area("First: Introduce prescription request", value=first_default, max_chars=None, height=None) middle_text = st.text_area("Middle: List dosage and frequency of medication", value=middle_default, max_chars=None, height=None) last_text = st.text_area("Last: Provide medication details", value=last_default, max_chars=None, height=None) # Username field with an emoji username = st.text_input("πŸ‘€ Username") def generate_treatment_plan_letters_ui(): st.title("🩹 Treatment Plan Letters") # Search-style text box search_query = st.text_input("Search Treatment Plan Letters") # Buttons with emojis and boldface text st.button("πŸ“ **First**") st.button("πŸ“ **Middle**") st.button("πŸ“ **Last**") # Text areas with default values based on letter examples first_default = "Outline treatment and testing plan for Mr.Smith\n" \ "Suggest handling chronic asthma for Mrs.White" middle_default = "Mr. Smith’s treatment will involve IV medication and chest x-ray\n" \ "Mrs. White’s asthma management plan requires frequent use of recommended inhaler and daily monitoring" last_default = "Recommend follow-up visits for monitoring and periodic testing\n" \ "Provide contact information in case of any emergencies" first_text = st.text_area("First: Introduce treatment plan", value=first_default, max_chars=None, height=None) middle_text = st.text_area("Middle: Explain treatment plan specifics", value=middle_default, max_chars=None, height=None) last_text = st.text_area("Last: Detail any follow-up needed", value=last_default, max_chars=None, height=None) # Username field with an emoji username = st.text_input("πŸ‘€ Username") def generate_medical_clearance_letters_ui(): st.title("πŸƒβ€β™‚οΈ Medical Clearance Letters") # Search-style text box search_query = st.text_input("Search Medical Clearance Letters") # Buttons with emojis and boldface text st.button("πŸ“ **First**") st.button("πŸ“ **Middle**") st.button("πŸ“ **Last**") # Text areas with default values based on letter examples first_default = "Allow Mrs. Anderson to safely participate in a marathon\n" \ "Clear Mr. White to begin strength training" middle_default = "The patient has been tested and has no chronic medical conditions or injuries\n" \ "The patient’s prior conditions are monitored, and it is advised to begin any physical activity or routine" last_default = "Encourage gradual progression and cautious approach to intense activity\n" \ "List exercises that should be avoided, for instance, weightlifting for an individual with a heart condition" first_text = st.text_area("First: State clearance conditions", value=first_default, max_chars=None, height=None) middle_text = st.text_area("Middle: Explain clearance Details", value=middle_default, max_chars=None, height=None) last_text = st.text_area("Last: Provide guidance on physical activity", value=last_default, max_chars=None, height=None) # Username field with an emoji username = st.text_input("πŸ‘€ Username") def generate_surgery_recommendation_letters_ui(): st.title("πŸ₯ Surgery Recommendation Letters") # Search-style text box search_query = st.text_input("Search Surgery Recommendation Letters") # Buttons with emojis and boldface text st.button("πŸ“ **First**") st.button("πŸ“ **Middle**") st.button("πŸ“ **Last**") # Text areas with default values based on letter examples first_default = "Recommend endoscopy procedure for Mr.Baker\n" \ "Recommend an angiography for Mrs.Taylor" middle_default = "Mr. Baker needs endoscopy for the diagnosis of GI tract abnormalities\n" \ "Mrs. Taylor needs angiography to locate any arterial blockages" last_default = "Suggest to take extra measures regarding allergies or post-procedural appointments\n" \ "Provide details on necessary pre and post-hospitalization guidance" first_text = st.text_area("First: Introduce surgical procedure", value=first_default, max_chars=None, height=None) middle_text = st.text_area("Middle: Explain surgical procedure specifics", value=middle_default, max_chars=None, height=None) last_text = st.text_area("Last: Detail any adjustment needed before/after surgery", value=last_default, max_chars=None, height=None) # Username field with an emoji username = st.text_input("πŸ‘€ Username") def generate_follow_up_appointment_letters_ui(): st.title("πŸ“… Follow-up Appointment Letters") # Search-style text box search_query = st.text_input("Search Follow-up Appointment Letters") # Buttons with emojis and boldface text st.button("πŸ“ **First**") st.button("πŸ“ **Middle**") st.button("πŸ“ **Last**") # Text areas with default values based on letter examples first_default = "This is a reminder for Mrs. Rodriguez’s appointment on Friday, 17th September, at 11:00 am\n" \ "This letter is to confirm Mr. Johnson’s appointment on Monday, 20th September, at 1:00 pm" middle_default = "Review the date, time, and location of appointment\n" \ "Detail any necessary preparations for the appointment" last_default = "Provide contact information and phone numbers in case of schedule change or emergency\n" \ "Encourage to reach out if an appointment must be canceled, or if there are any questions or concerns" first_text = st.text_area("First: Remind of the appointment", value=first_default, max_chars=None, height=None) middle_text = st.text_area("Middle: Confirm appointment details", value=middle_default, max_chars=None, height=None) last_text = st.text_area("Last: Provide contact details", value=last_default, max_chars=None, height=None) # Username field with an emoji username = st.text_input("πŸ‘€ Username") # Run the Streamlit UI function generate_follow_up_appointment_letters_ui() def generate_health_education_letters_ui(): st.title("🍎 Health Education Letters") # Search-style text box search_query = st.text_input("Search Health Education Letters") # Buttons with emojis and boldface text st.button("πŸ“ **First**") st.button("πŸ“ **Middle**") st.button("πŸ“ **Last**") # Text areas with default values based on letter examples first_default = "This letter is to provide Ms. Prince with information on healthy eating habits\n" \ "This letter offers suggestions for stress management to Mr. Martin" middle_default = "Outline the benefits of specific health practices for overall health\n" \ "Detail steps that can be taken to manage specific health conditions properly" last_default = "Provide handouts, online resources, or any relevant materials to supplement the information\n" \ "Encourage patients to schedule follow-up appointments to discuss any questions or concerns." first_text = st.text_area("First: Introduce the health education topic", value=first_default, max_chars=None, height=None) middle_text = st.text_area("Middle: Explain the recommended practices", value=middle_default, max_chars=None, height=None) last_text = st.text_area("Last: Provide Resources", value=last_default, max_chars=None, height=None) # Username field with an emoji username = st.text_input("πŸ‘€ Username") def generate_disability_support_letters_ui(): st.title("β™Ώ Disability Support Letters") # Search-style text box search_query = st.text_input("Search Disability Support Letters") # Buttons with emojis and boldface text st.button("πŸ“ **First**") st.button("πŸ“ **Middle**") st.button("πŸ“ **Last**") # Text areas with default values based on letter examples first_default = "The purpose of this letter is to validate Mr. Williams’ disability so that he can receive disability benefits\n" \ "The purpose of this letter is to document Ms. Radcliff’s disability to request special accommodations at work" middle_default = "Detail the patient’s physical or cognitive condition and how it affects their daily life\n" \ "Explain the cause of the patient’s condition and duration of symptoms" last_default = "Outline the assistive equipment or technology necessary for the patient\n" \ "Describe the special consideration or modifications required" first_text = st.text_area("First: State the purpose of the letter", value=first_default, max_chars=None, height=None) middle_text = st.text_area("Middle: Explain the patient’s condition", value=middle_default, max_chars=None, height=None) last_text = st.text_area("Last: List any necessary accommodations", value=last_default, max_chars=None, height=None) # Username field with an emoji username = st.text_input("πŸ‘€ Username") def generate_letter_grid_ui(): st.title("πŸ₯ Letter Type Selection") # Define the data for the table letter_types = [ ("1️⃣ Referral Letters", "🀝 Letters asking for more help or treatment", "πŸ“„ Patient info, Referral details", generate_referral_letters_ui), ("2️⃣ Medical Certificate Letters", "πŸ’Ό Letters about a patient's health problem or limits", "πŸ“„ Patient info, Health problem details", generate_medical_certificate_letters_ui), ("3️⃣ Prescription Letters", "πŸ’Š Letters allowing medicine", "πŸ“„ Patient info, Medicine details", generate_prescription_letters_ui), ("4️⃣ Diagnosis Letters", "πŸ”Ž Letters explaining a patient's health problem", "πŸ“„ Patient info, Health problem details", generate_diagnosis_letters_ui), ("5️⃣ Treatment Plan Letters", "πŸš‘ Letters with a plan for getting better", "πŸ“„ Patient info, Treatment details", generate_treatment_plan_letters_ui), ("6️⃣ Surgery Recommendation Letters", "πŸ₯ Letters saying a patient needs surgery", "πŸ“„ Patient info, Surgery details", generate_surgery_recommendation_letters_ui), ("7️⃣ Medical Clearance Letters", "πŸƒ Letters saying a patient can do activities", "πŸ“„ Patient info, Activity details", generate_medical_clearance_letters_ui), ("8️⃣ Follow-up Appointment Letters", "πŸ“… Letters reminding about appointments", "πŸ“„ Patient info, Appointment details", generate_follow_up_appointment_letters_ui), ("9️⃣ Disability Support Letters", "β™Ώ Letters about a patient's disability", "πŸ“„ Patient info, Disability details", generate_disability_support_letters_ui), ("πŸ”Ÿ Health Education Letters", "🍎 Letters teaching about health", "πŸ“„ Patient info, Education topic", generate_health_education_letters_ui), ] # Create the table with buttons for letter_type, definition, fields, letter_function in letter_types: col1, col2, col3, col4 = st.columns(4) with col1: if st.button(letter_type): letter_function() with col2: st.write(definition) with col3: st.write(fields) # Run the Streamlit UI function generate_letter_grid_ui() # Run the Streamlit UI function #generate_referral_letters_ui() # Run the Streamlit UI function #generate_medical_certificate_letters_ui() # Run the Streamlit UI function #generate_prescription_letters_ui() # Run the Streamlit UI function #generate_prescription_letters_ui() # Run the Streamlit UI function #generate_treatment_plan_letters_ui() # Run the Streamlit UI function #generate_surgery_recommendation_letters_ui() # Run the Streamlit UI function #generate_health_education_letters_ui() # Run the Streamlit UI function #generate_letter_grid_ui()