|
112 | 112 | # --- The ANC Survey flow, statically defined --- |
113 | 113 | ANC_SURVEY_FLOW_LOGIC = { |
114 | 114 | # --- Entry Point --- |
115 | | - "intro": lambda ctx: "start_not_going" |
| 115 | + "intro": lambda ctx: "Q_why_not_go" |
116 | 116 | if ctx.get("intro") == "NO" |
117 | 117 | else "start_going_soon" |
118 | 118 | if ctx.get("intro") == "SOON" |
119 | 119 | else "Q_seen", |
120 | 120 | # --- Branch 1: Going Soon --- |
121 | 121 | "start_going_soon": lambda ctx: None, # Ends flow, triggers 3-day reminder |
122 | 122 | # --- 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", |
130 | 124 | # --- 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", |
132 | 126 | # > 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", |
136 | 127 | "Q_bp": lambda ctx: "Q_experience", |
137 | | - "Q_experience": lambda ctx: "bad" |
| 128 | + "Q_experience": lambda ctx: "Q_visit_bad" |
138 | 129 | 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", |
157 | 134 | # > 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", |
164 | 136 | # --- Converging Paths & End States --- |
165 | 137 | "intent": lambda ctx: ( |
166 | 138 | "feedback_if_first_survey" if ctx.get("first_survey") else "end" |
|
0 commit comments