aasiavakil commited on
Commit
6f930da
·
verified ·
1 Parent(s): dff2aa5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -10
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(county):
44
- county = county.lower()
45
- sections = clinic_data.split("###")
46
- for section in sections:
47
- if county in section:
48
- lines = section.strip().split("\n")
49
- if lines and county in lines[0].lower():
50
- lines = lines[1:]
51
- return "\n".join(lines).strip()
52
- return "Sorry, I couldn't find any clinics for that county. Please check your spelling or try a nearby county."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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):