import gradio as gr def display_discharge_form( patient_first, patient_last, patient_middle, dob, age, sex, address, city, state, zip_code, doctor_first, doctor_last, doctor_middle, hospital, doctor_address, doctor_city, doctor_state, doctor_zip, admission_date, referral_source, admission_method, discharge_date, discharge_reason, death_date, diagnosis, procedures, medications, preparer_name, job_title, signature ): form = f""" **Patient Details:** - **Name:** {patient_first} {patient_middle} {patient_last} - **Date of Birth:** {dob}, **Age:** {age}, **Sex:** {sex} - **Address:** {address}, {city}, {state} {zip_code} **Primary Healthcare Professional Details:** - **Name:** {doctor_first} {doctor_middle} {doctor_last} - **Hospital/Clinic:** {hospital} - **Address:** {doctor_address}, {doctor_city}, {doctor_state} {doctor_zip} **Admission and Discharge Details:** - **Date of Admission:** {admission_date} - **Source of Referral:** {referral_source} - **Method of Admission:** {admission_method} - **Date of Discharge:** {discharge_date} - **Discharge Reason:** {discharge_reason} - **Date of Death:** {death_date if discharge_reason == 'Patient Died' else 'N/A'} **Diagnosis & Procedures:** - **Diagnosis:** {diagnosis} - **Operations & Procedures:** {procedures} **Medication Details:** - **Medication on Discharge:** {medications} **Prepared By:** - **Name:** {preparer_name}, **Job Title:** {job_title} - **Signature:** {signature} """ return form discharge_interface = gr.Interface( fn=display_discharge_form, inputs=[ gr.Textbox(label="Patient First Name"), gr.Textbox(label="Patient Last Name"), gr.Textbox(label="Patient Middle Initial"), gr.Textbox(label="Date of Birth"), gr.Textbox(label="Age"), gr.Textbox(label="Sex"), gr.Textbox(label="Address"), gr.Textbox(label="City"), gr.Textbox(label="State"), gr.Textbox(label="Zip Code"), gr.Textbox(label="Doctor First Name"), gr.Textbox(label="Doctor Last Name"), gr.Textbox(label="Doctor Middle Initial"), gr.Textbox(label="Hospital/Clinic Name"), gr.Textbox(label="Doctor Address"), gr.Textbox(label="Doctor City"), gr.Textbox(label="Doctor State"), gr.Textbox(label="Doctor Zip Code"), gr.Textbox(label="Date of Admission"), gr.Textbox(label="Source of Referral"), gr.Textbox(label="Method of Admission"), gr.Textbox(label="Date of Discharge"), gr.Radio(["Treated", "Transferred", "Discharge Against Advice", "Patient Died"], label="Discharge Reason"), gr.Textbox(label="Date of Death (if applicable)"), gr.Textbox(label="Diagnosis"), gr.Textbox(label="Operations & Procedures"), gr.Textbox(label="Medication on Discharge"), gr.Textbox(label="Prepared By (Name)"), gr.Textbox(label="Job Title"), gr.Textbox(label="Signature"), ], outputs=gr.Markdown(), title="Patient Discharge Form", description="Fill in the required fields to generate a complete patient discharge summary." ) discharge_interface.launch()