Spaces:
Sleeping
Sleeping
final
Browse files
app.py
CHANGED
|
@@ -99,13 +99,18 @@ def fill_textboxes(context: str) -> dict:
|
|
| 99 |
|
| 100 |
# Map answers to form fields in the correct order
|
| 101 |
return {
|
| 102 |
-
"Age": answers[0],
|
| 103 |
-
"Gender": answers[1],
|
| 104 |
-
"Chief complaint": answers[2],
|
| 105 |
-
"Medical history": answers[3],
|
| 106 |
-
"Dental history": answers[4],
|
| 107 |
-
"Clinical Findings": answers[5],
|
| 108 |
-
"Referred to": ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
}
|
| 110 |
|
| 111 |
# Supabase configuration
|
|
@@ -116,14 +121,14 @@ def main(audio: str, doctor_name: str, location: str) -> list:
|
|
| 116 |
context = transcribe_audio(audio)
|
| 117 |
|
| 118 |
if "Error" in context:
|
| 119 |
-
return [context] *
|
| 120 |
|
| 121 |
answers = fill_textboxes(context)
|
| 122 |
answers_list = [doctor_name, location, ""] # Initial patient name field empty
|
| 123 |
answers_list += [answers.get(field, "") for field in form_fields]
|
| 124 |
-
answers_list.append("") # Default for "
|
| 125 |
answers_list.append("") # Default for "Stains"
|
| 126 |
-
|
| 127 |
return answers_list
|
| 128 |
|
| 129 |
def save_answers(doctor_name: str, location: str, patient_name: str, age: str, gender: str, chief_complaint: str, medical_history: str, dental_history: str, clinical_findings: str, treatment_plan: str, referred_to: str, Calculus: str, stains: str) -> str:
|
|
|
|
| 99 |
|
| 100 |
# Map answers to form fields in the correct order
|
| 101 |
return {
|
| 102 |
+
"Age": answers[0] if len(answers) > 0 else "",
|
| 103 |
+
"Gender": answers[1] if len(answers) > 1 else "",
|
| 104 |
+
"Chief complaint": answers[2] if len(answers) > 2 else "",
|
| 105 |
+
"Medical history": answers[3] if len(answers) > 3 else "",
|
| 106 |
+
"Dental history": answers[4] if len(answers) > 4 else "",
|
| 107 |
+
"Clinical Findings": answers[5] if len(answers) > 5 else "",
|
| 108 |
+
"Referred to": "", # Default value
|
| 109 |
+
"Treatment plan": "", # Default value
|
| 110 |
+
"Calculus": "", # Default value
|
| 111 |
+
"Stains": "", # Default value
|
| 112 |
+
"Doctor’s Name": "", # Default value
|
| 113 |
+
"Location": "" # Default value
|
| 114 |
}
|
| 115 |
|
| 116 |
# Supabase configuration
|
|
|
|
| 121 |
context = transcribe_audio(audio)
|
| 122 |
|
| 123 |
if "Error" in context:
|
| 124 |
+
return [context] * len(oral_health_assessment_form) # Adjust for the number of fields
|
| 125 |
|
| 126 |
answers = fill_textboxes(context)
|
| 127 |
answers_list = [doctor_name, location, ""] # Initial patient name field empty
|
| 128 |
answers_list += [answers.get(field, "") for field in form_fields]
|
| 129 |
+
answers_list.append("") # Default for "Calculus"
|
| 130 |
answers_list.append("") # Default for "Stains"
|
| 131 |
+
answers_list.append("") # Default for "Treatment plan"
|
| 132 |
return answers_list
|
| 133 |
|
| 134 |
def save_answers(doctor_name: str, location: str, patient_name: str, age: str, gender: str, chief_complaint: str, medical_history: str, dental_history: str, clinical_findings: str, treatment_plan: str, referred_to: str, Calculus: str, stains: str) -> str:
|