| import gradio as gr | |
| def submit_form( | |
| patient_name, dob, ssn, goal_met, goal_reason, | |
| discharge_date, wound1_location, wound1_status, wound1_measure_date, wound1_length, wound1_width, wound1_depth, | |
| wound2_location, wound2_status, wound2_measure_date, wound2_length, wound2_width, wound2_depth, | |
| provider_name, provider_phone, info_date | |
| ): | |
| result = f""" | |
| Patient Information: | |
| Name: {patient_name} | |
| DOB: {dob} | |
| SSN: {ssn} | |
| Physician's Goal Met: {'Yes' if goal_met else 'No'} | |
| Reason (if no): {goal_reason} | |
| Discharge Date: {discharge_date} | |
| Wound #1: | |
| Location: {wound1_location} | |
| Status: {', '.join(wound1_status)} | |
| Measurement Date: {wound1_measure_date} | |
| Length: {wound1_length} cm, Width: {wound1_width} cm, Depth: {wound1_depth} cm | |
| Wound #2: | |
| Location: {wound2_location} | |
| Status: {', '.join(wound2_status)} | |
| Measurement Date: {wound2_measure_date} | |
| Length: {wound2_length} cm, Width: {wound2_width} cm, Depth: {wound2_depth} cm | |
| Provider Information: | |
| Name: {provider_name} | |
| Phone: {provider_phone} | |
| Information Date: {info_date} | |
| """ | |
| return result | |
| with gr.Blocks() as app: | |
| gr.Markdown("### Discharge Form") | |
| with gr.Row(): | |
| patient_name = gr.Textbox(label="Patient's Name (Last, First, MI)") | |
| dob = gr.Textbox(label="Date of Birth (MM/DD/YYYY)") | |
| ssn = gr.Textbox(label="Social Security Number (XXX-XX-XXXX)") | |
| goal_met = gr.Checkbox(label="Was the Physician’s Goal Met?") | |
| goal_reason = gr.Textbox(label="If No, Explain Why") | |
| discharge_date = gr.Textbox(label="Therapy Discharge Date (MM/DD/YYYY)") | |
| gr.Markdown("### Wound #1") | |
| with gr.Row(): | |
| wound1_location = gr.Textbox(label="Wound Location") | |
| wound1_status = gr.CheckboxGroup(["Adequate granulation", "Patient in hospital", "Wound unresponsive", "Pain", "Wound healed", "Delayed primary closure", "Patient non-compliant", "Patient expired", "Wound sutured closed", "Tunnel dimensions decreased or closed", "Undermining improved or resolved", "4 months of treatment completed", "Other"], label="Wound Status") | |
| wound1_measure_date = gr.Textbox(label="Final Measurement Date (MM/DD/YYYY)") | |
| with gr.Row(): | |
| wound1_length = gr.Number(label="Length (cm)") | |
| wound1_width = gr.Number(label="Width (cm)") | |
| wound1_depth = gr.Number(label="Depth (cm)") | |
| gr.Markdown("### Wound #2 (if applicable)") | |
| with gr.Row(): | |
| wound2_location = gr.Textbox(label="Wound Location") | |
| wound2_status = gr.CheckboxGroup(["Adequate granulation", "Patient in hospital", "Wound unresponsive", "Pain", "Wound healed", "Delayed primary closure", "Patient non-compliant", "Patient expired", "Wound sutured closed", "Tunnel dimensions decreased or closed", "Undermining improved or resolved", "4 months of treatment completed", "Other"], label="Wound Status") | |
| wound2_measure_date = gr.Textbox(label="Final Measurement Date (MM/DD/YYYY)") | |
| with gr.Row(): | |
| wound2_length = gr.Number(label="Length (cm)") | |
| wound2_width = gr.Number(label="Width (cm)") | |
| wound2_depth = gr.Number(label="Depth (cm)") | |
| gr.Markdown("### Provider Information") | |
| provider_name = gr.Textbox(label="Print Name, Title, Employer") | |
| provider_phone = gr.Textbox(label="Phone Number") | |
| info_date = gr.Textbox(label="Information Date (MM/DD/YYYY)") | |
| submit = gr.Button("Submit") | |
| output = gr.Textbox(label="Form Output", interactive=False) | |
| submit.click(submit_form, inputs=[ | |
| patient_name, dob, ssn, goal_met, goal_reason, | |
| discharge_date, wound1_location, wound1_status, wound1_measure_date, wound1_length, wound1_width, wound1_depth, | |
| wound2_location, wound2_status, wound2_measure_date, wound2_length, wound2_width, wound2_depth, | |
| provider_name, provider_phone, info_date | |
| ], outputs=output) | |
| app.launch() | |