You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the quarantine triggers in Tally Ho enforce strict rules that determine whether a form should be quarantined. However, there is no flexibility to account for small, acceptable deviations in form data.
For example, the pass_registrants_trigger check flags a form when the sum of ballots inside the box + canceled ballots exceeds the number of registered voters + buffer (qc.value).
This strict threshold can sometimes cause false positives, unnecessarily flagging forms that may have insignificant deviations due to human or system errors.
To improve accuracy, all quarantine triggers should allow a configurable deviation percentage to reduce unnecessary quarantining while still catching serious issues.
Proposed Changes
1️⃣ Introduce a Deviation Percentage for All Quarantine Checks
✅ Modify all quarantine trigger functions to include an acceptable deviation percentage.
✅ Retrieve the deviation percentage from a configuration setting (qc.deviation_percentage) stored in the QuarantineCheck model.
✅ If a check slightly exceeds the threshold but falls within the deviation range, pass the check instead of quarantining.
2️⃣ Update pass_registrants_trigger as an Example
✅ Instead of a strict registrant limit, allow a small configurable deviation before triggering quarantine.
3️⃣ Apply Deviation Logic to All Quarantine Triggers
✅ Modify each quarantine check to incorporate the deviation percentage logic.
✅ Ensure that the deviation percentage is optional (default: 0% if not set).
✅ Add necessary unit tests to verify behavior with different deviation values.
Acceptance Criteria
✅ All quarantine trigger functions respect a deviation percentage.
✅ The deviation percentage is configurable via the QuarantineCheck model.
✅ Forms just slightly above a threshold are not quarantined unnecessarily.
✅ Unit tests cover cases with different deviation percentages.
Context
Currently, the quarantine triggers in Tally Ho enforce strict rules that determine whether a form should be quarantined. However, there is no flexibility to account for small, acceptable deviations in form data.
For example, the
pass_registrants_trigger
check flags a form when the sum of ballots inside the box + canceled ballots exceeds the number of registered voters + buffer (qc.value
).To improve accuracy, all quarantine triggers should allow a configurable deviation percentage to reduce unnecessary quarantining while still catching serious issues.
Proposed Changes
1️⃣ Introduce a Deviation Percentage for All Quarantine Checks
qc.deviation_percentage
) stored in the QuarantineCheck model.2️⃣ Update
pass_registrants_trigger
as an Example3️⃣ Apply Deviation Logic to All Quarantine Triggers
0%
if not set).Acceptance Criteria
✅ All quarantine trigger functions respect a deviation percentage.
✅ The deviation percentage is configurable via the
QuarantineCheck
model.✅ Forms just slightly above a threshold are not quarantined unnecessarily.
✅ Unit tests cover cases with different deviation percentages.
Implementation Plan
1️⃣ Modify
QuarantineCheck
Model2️⃣ Update
pass_registrants_trigger
to Use Deviation3️⃣ Modify Other Quarantine Triggers
[quarantine_checks.py](https://github.com/onaio/tally-ho/blob/5f926f6b2bb6e38b22fcc90aa66aa293e4ec87cd/tally_ho/libs/verify/quarantine_checks.py#L42)
to include deviation handling.4️⃣ Add Unit Tests
5️⃣ QA & UAT
Estimated Level of Effort (LOE)
QuarantineCheck
Modelpass_registrants_trigger
Total Estimated LOE: ~44-62 hours (~5-8 working days / ~1-1.5 weeks)
🚀 Effort Level: 🟡 Medium to High Complexity
The text was updated successfully, but these errors were encountered: