File size: 3,926 Bytes
5372c12 |
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
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()
|