Skip to content

Commit b7e9371

Browse files
Merge pull request #121 from praekeltfoundation/SIGMA-4262
Showing non-trivial valid responses to the user
2 parents 1e6e8be + 15575d9 commit b7e9371

File tree

2 files changed

+9
-40
lines changed

2 files changed

+9
-40
lines changed

src/ai4gd_momconnect_haystack/pipelines.py

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -112,55 +112,27 @@
112112
# --- The ANC Survey flow, statically defined ---
113113
ANC_SURVEY_FLOW_LOGIC = {
114114
# --- Entry Point ---
115-
"intro": lambda ctx: "start_not_going"
115+
"intro": lambda ctx: "Q_why_not_go"
116116
if ctx.get("intro") == "NO"
117117
else "start_going_soon"
118118
if ctx.get("intro") == "SOON"
119119
else "Q_seen",
120120
# --- Branch 1: Going Soon ---
121121
"start_going_soon": lambda ctx: None, # Ends flow, triggers 3-day reminder
122122
# --- Branch 2: Not Going ---
123-
"start_not_going": lambda ctx: "Q_why_not_go"
124-
if ctx.get("start_not_going") == "YES"
125-
else "mom_ANC_remind_me_01",
126-
"Q_why_not_go": lambda ctx: "Q_why_not_go_other"
127-
if ctx.get("Q_why_not_go") == "SOMETHING_ELSE"
128-
else "intent",
129-
"Q_why_not_go_other": lambda ctx: "intent",
123+
"Q_why_not_go": lambda ctx: "intent",
130124
# --- Branch 3: Went to Clinic ---
131-
"Q_seen": lambda ctx: "seen_yes" if ctx.get("Q_seen") == "YES" else "Q_seen_no",
125+
"Q_seen": lambda ctx: "Q_bp" if ctx.get("Q_seen") == "YES" else "Q_why_no_visit",
132126
# > Sub-branch: Was Seen
133-
"seen_yes": lambda ctx: "Q_bp"
134-
if ctx.get("seen_yes") == "YES"
135-
else "mom_ANC_remind_me_01",
136127
"Q_bp": lambda ctx: "Q_experience",
137-
"Q_experience": lambda ctx: "bad"
128+
"Q_experience": lambda ctx: "Q_visit_bad"
138129
if ctx.get("Q_experience") in ["EXP_BAD", "EXP_VERY_BAD"]
139-
else "good",
140-
"good": lambda ctx: "Q_visit_good"
141-
if ctx.get("good") == "YES"
142-
else "mom_ANC_remind_me_01",
143-
"bad": lambda ctx: "Q_visit_bad"
144-
if ctx.get("bad") == "YES"
145-
else "mom_ANC_remind_me_01",
146-
"Q_visit_bad": lambda ctx: "Q_visit_other"
147-
if ctx.get("Q_visit_bad") == "SOMETHING_ELSE"
148-
else "Q_challenges",
149-
"Q_visit_good": lambda ctx: "Q_visit_other"
150-
if ctx.get("Q_visit_good") == "SOMETHING_ELSE"
151-
else "Q_challenges",
152-
"Q_visit_other": lambda ctx: "Q_challenges",
153-
"Q_challenges": lambda ctx: "Q_challenges_other"
154-
if ctx.get("Q_challenges") == "SOMETHING_ELSE"
155-
else "intent",
156-
"Q_challenges_other": lambda ctx: "intent",
130+
else "Q_visit_good",
131+
"Q_visit_bad": lambda ctx: "Q_challenges",
132+
"Q_visit_good": lambda ctx: "Q_challenges",
133+
"Q_challenges": lambda ctx: "intent",
157134
# > Sub-branch: Was at clinic but NOT Seen
158-
"Q_seen_no": lambda ctx: "Q_why_no_visit"
159-
if ctx.get("Q_seen_no") == "YES"
160-
else "mom_ANC_remind_me_01",
161-
"Q_why_no_visit": lambda ctx: "Q_why_no_visit_other"
162-
if ctx.get("Q_why_no_visit") == "SOMETHING_ELSE"
163-
else "intent",
135+
"Q_why_no_visit": lambda ctx: "intent",
164136
# --- Converging Paths & End States ---
165137
"intent": lambda ctx: (
166138
"feedback_if_first_survey" if ctx.get("first_survey") else "end"

src/ai4gd_momconnect_haystack/utilities.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,6 @@ def prepare_valid_responses_to_display_to_anc_survey_user(
263263
if valid_responses and step_title in [
264264
"Q_experience",
265265
"feedback_if_first_survey",
266-
"seen_yes",
267-
"Q_seen_no",
268-
"start_not_going",
269266
]:
270267
options = "\n\n" + "\n".join(
271268
prepend_valid_responses_with_alphabetical_index(valid_responses)

0 commit comments

Comments
 (0)