Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,16 +40,30 @@ program_explanations = {
|
|
| 40 |
"aca": "ACA subsidies are financial help from the Affordable Care Act that reduce your monthly insurance premium based on your income.",
|
| 41 |
}
|
| 42 |
|
| 43 |
-
def find_clinic_by_county(
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
# helper to get clinics by county
|
| 55 |
def get_clinics_by_county(county_name, file_path="info.txt", limit=5):
|
|
|
|
| 40 |
"aca": "ACA subsidies are financial help from the Affordable Care Act that reduce your monthly insurance premium based on your income.",
|
| 41 |
}
|
| 42 |
|
| 43 |
+
def find_clinic_by_county(county_name, file_path="info.txt"):
|
| 44 |
+
clinics = []
|
| 45 |
+
with open(file_path, "r", encoding="utf-8") as file:
|
| 46 |
+
lines = file.readlines()
|
| 47 |
+
|
| 48 |
+
inside = False
|
| 49 |
+
for line in lines:
|
| 50 |
+
if line.strip().lower().startswith(county_name.lower() + " county"):
|
| 51 |
+
inside = True
|
| 52 |
+
continue
|
| 53 |
+
if inside:
|
| 54 |
+
if "county" in line.lower() and county_name.lower() not in line.lower():
|
| 55 |
+
break
|
| 56 |
+
if line.strip():
|
| 57 |
+
clinics.append(line.strip())
|
| 58 |
+
|
| 59 |
+
if not clinics:
|
| 60 |
+
return "Sorry, I couldn't find any clinics for that county. Please check your spelling or try a nearby county."
|
| 61 |
+
|
| 62 |
+
# Add Medicaid / EBT explanation
|
| 63 |
+
clinics.append("\n---\nMedicaid (Apple Health) is Washington’s free health insurance for low-income residents. It covers doctor visits, mental health, prescriptions, dental, and more.\n\nEBT (SNAP) helps you buy groceries if you qualify. You’ll get a card you can use at most stores.")
|
| 64 |
+
|
| 65 |
+
return "\n".join(clinics)
|
| 66 |
+
|
| 67 |
|
| 68 |
# helper to get clinics by county
|
| 69 |
def get_clinics_by_county(county_name, file_path="info.txt", limit=5):
|