fix(spp_demo,spp_mis_demo_v2): convert stories to households, locale-aware names, sync docs#131
fix(spp_demo,spp_mis_demo_v2): convert stories to households, locale-aware names, sync docs#131
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on synchronizing and enhancing the documentation for two demo data generators, Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the documentation for spp_farmer_registry_demo and spp_mis_demo_v2. A new DESCRIPTION.md is added for the farmer registry demo, and the existing one for the MIS demo is updated to reflect new features like additional programs and seeded data generation. The changes are accurate and improve the documentation. I have a couple of suggestions to further improve the documentation's consistency and formatting.
| | Model | Description | | ||
| | ------------------------------ | --------------------------------------------------- | | ||
| | `spp.farmer.demo.generator` | Core demo generator wizard with all generation logic | |
There was a problem hiding this comment.
The markdown table formatting is a bit messy. For better readability and maintainability of the source, please align the columns.
| | Model | Description | | |
| | ------------------------------ | --------------------------------------------------- | | |
| | `spp.farmer.demo.generator` | Core demo generator wizard with all generation logic | | |
| | Model | Description | | |
| |-------------------------------|------------------------------------------------------| | |
| | `spp.farmer.demo.generator` | Core demo generator wizard with all generation logic | |
| All programs use CEL expressions with activated registry variables: | ||
|
|
||
| - **Universal Child Grant**: `r.is_group == true and child_count > 0` (member aggregation) | ||
| - **Conditional Child Grant**: First 1,000 days targeting for young children |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## 19.0 #131 +/- ##
==========================================
+ Coverage 70.98% 72.44% +1.45%
==========================================
Files 899 903 +4
Lines 52791 53081 +290
==========================================
+ Hits 37476 38456 +980
+ Misses 15315 14625 -690
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
…h code - Create DESCRIPTION.md for spp_farmer_registry_demo (was missing) - Fix spp_mis_demo_v2: 6 programs -> 7, document seeded generation, add Conditional Child Grant, multi-locale, geographic data loading
Include auto-generated README.rst and index.html from oca-gen-addon-readme (Python 3.11) to match CI expectations.
- spp_case_demo: mention 3 background cases, clarify non-deterministic generation - spp_grm_demo: list all 8 personas, add missing dependencies (spp_grm_registry, spp_grm_programs), clarify non-deterministic generation
Include auto-generated README.rst and index.html from oca-gen-addon-readme (Python 3.11) to match CI expectations.
Delete README.md — its content is covered by readme/DESCRIPTION.md (module description) and docs/USE_CASES.md (developer guide). Fix "6 programs" -> "7 programs" in USE_CASES.md overview.
…locale-aware names - Convert maria_santos, juan_dela_cruz, ibrahim_hassan, ahmed_said from individual/farmer to household type with proper head/spouse/children members, fixing enrollment in group-targeting programs - Replace all non-Filipino default names with Filipino names so the default locale (fil_PH) is culturally consistent; si_LK and fr_TG locale overrides continue to work via LOCALE_NAMES - Remove all farm references (farm_size, farm_type, Input Subsidy, Livestock Improvement) from story definitions and MIS demo - Update USE_CASES.md to match actual programs and stories - Fix david_sofia_martinez enrollment key mismatch - Update event_types.xml: farm_condition_score -> household_condition_score
…prettier formatting
…th custom template, remove OCA banner
2169de7 to
9d87db3
Compare
…er story family names from seeded generator
…ment fixes - Story households use family-name-only (Santos, Dela Cruz, etc.) - Manuel Santos elderly renamed to Pangilinan to avoid Santos conflict - Tutorial families renamed: Santos→Tolentino, Cruz→Salazar, Reyes→Mercado - Locale names updated for si_LK and fr_TG (family name only for groups) - Expanded name pools: fil_PH 714, si_LK 535, fr_TG 561 surnames - Seeded generator: suffix filter for compound names, unique names from shuffled pool, shared family name within households - Fix cycle creation: use today then backdate via SQL to bypass _check_dates constraint (fixes Santos 0 payments, Gutierrez bug) - Batch create optimization: mail_create_nolog + tracking_disable
Add compliance managers to Cash Transfer (per_capita_income < poverty_line) and Conditional Child Grant (per_capita_income < income_threshold with program-level override to 2000). Santos story demonstrates compliance failure triggering graduation (non_compliant cycle membership), while Dela Cruz demonstrates compliance passing on the same program. - Configure compliance CEL expressions on 2 of 7 programs - Add program constant override for income_threshold via spp.cel.program.parameter - Mark Santos cycle membership as non_compliant after payment creation - Add CCG eligibility flag to 4 household blueprints (bp_01, bp_04, bp_06, bp_28) - Add Santos Universal Child Grant enrollment for partial exit story - Update wizard view, translations, and USE_CASES.md to v3 spec - Add 12 new tests for compliance configuration and behavior
The spp CLI imports tomllib which is only available in Python 3.11+. Add a fallback to the tomli backport package, and gracefully skip TOML config loading with a warning if neither is available.
Remove `str | None` and `str | list` type annotations that require Python 3.10+. The spp CLI now works on Python 3.9+.
…low, use case accuracy Fix eligibility managers not getting CEL expressions set (get_manager doesn't handle MANAGER_ELIGIBILITY — use program.eligibility_manager_ids directly instead). Fix CR approval workflow using with_user() for the correct validator users (local + HQ) to pass multi-tier approval checks. Fix eligibility UI summary showing "Configured" instead of actual CEL. spp_mis_demo_v2: - Fix _configure_eligibility_manager to access wrapper directly - Fix _configure_logic_studio to always set CEL on eligibility manager - Fix _set_cr_state to use demo_cr_local_validator and demo_cr_hq_validator for multi-tier approval (approve, reject, revision) - Change Rosa Garcia exit CR from applied to pending (prevents enrollment deletion) - Update use case: Santos 5 members (add Lola), Reyes multi-generational 8 members, 13 CRs with accurate types/states, fix Rosa Garcia and Lorna Pascual references spp_programs: - Show "CEL Expression" as eligibility type when mode is cel - Show actual CEL expression in eligibility summary (was just "Configured") spp_demo: - Fix Rosa Garcia age 67 → 72 - Fix Lorna Pascual age 32 → 55
| cr.sudo().action_submit_for_approval() | ||
| cr.sudo().action_approve() | ||
| # Approve all tiers — multi-tier requires each tier's validator | ||
| cr.with_user(local_validator).sudo().action_approve() |
Check warning
Code scanning / Semgrep OSS
Semgrep Finding: semgrep.odoo-sudo-without-context Warning
| cr.with_user(local_validator).sudo().action_approve() | ||
| if cr.approval_state == "pending": | ||
| # Still pending = more tiers, approve with HQ validator | ||
| cr.with_user(hq_validator).sudo().action_approve() |
Check warning
Code scanning / Semgrep OSS
Semgrep Finding: semgrep.odoo-sudo-without-context Warning
| if rejection_reason and "rejection_reason" in cr._fields: | ||
| cr.sudo().write({"rejection_reason": rejection_reason}) | ||
| # Use _do_reject directly to bypass the wizard | ||
| cr.with_user(local_validator).sudo()._do_reject(rejection_reason or "Request rejected") |
Check warning
Code scanning / Semgrep OSS
Semgrep Finding: semgrep.odoo-sudo-without-context Warning
| if revision_notes and "revision_notes" in cr._fields: | ||
| cr.sudo().write({"revision_notes": revision_notes}) | ||
| # Use _do_request_revision directly to bypass the wizard | ||
| cr.with_user(local_validator).sudo()._do_request_revision( |
Check warning
Code scanning / Semgrep OSS
Semgrep Finding: semgrep.odoo-sudo-without-context Warning
| if apply: | ||
| try: | ||
| cr.sudo().action_apply() | ||
| cr.with_user(hq_validator).sudo().action_apply() |
Check warning
Code scanning / Semgrep OSS
Semgrep Finding: semgrep.odoo-sudo-without-context Warning
| cr.sudo().action_submit_for_approval() | ||
| cr.sudo().action_approve() | ||
| # Approve all tiers — multi-tier requires each tier's validator | ||
| cr.with_user(local_validator).sudo().action_approve() |
Check notice
Code scanning / Semgrep OSS
Semgrep Finding: semgrep.odoo-with-user-unvalidated Note
| cr.with_user(local_validator).sudo().action_approve() | ||
| if cr.approval_state == "pending": | ||
| # Still pending = more tiers, approve with HQ validator | ||
| cr.with_user(hq_validator).sudo().action_approve() |
Check notice
Code scanning / Semgrep OSS
Semgrep Finding: semgrep.odoo-with-user-unvalidated Note
| if rejection_reason and "rejection_reason" in cr._fields: | ||
| cr.sudo().write({"rejection_reason": rejection_reason}) | ||
| # Use _do_reject directly to bypass the wizard | ||
| cr.with_user(local_validator).sudo()._do_reject(rejection_reason or "Request rejected") |
Check notice
Code scanning / Semgrep OSS
Semgrep Finding: semgrep.odoo-with-user-unvalidated Note
| if revision_notes and "revision_notes" in cr._fields: | ||
| cr.sudo().write({"revision_notes": revision_notes}) | ||
| # Use _do_request_revision directly to bypass the wizard | ||
| cr.with_user(local_validator).sudo()._do_request_revision( |
Check notice
Code scanning / Semgrep OSS
Semgrep Finding: semgrep.odoo-with-user-unvalidated Note
| if apply: | ||
| try: | ||
| cr.sudo().action_apply() | ||
| cr.with_user(hq_validator).sudo().action_apply() |
Check notice
Code scanning / Semgrep OSS
Semgrep Finding: semgrep.odoo-with-user-unvalidated Note
…rator Add address, email, phone, birth_place, civil_status, ID documents, and bank accounts to all demo registrants. Data is locale-aware across Philippines, Togo, and Sri Lanka, and fully deterministic (seeded RNG). Groups get: street address, city, zip, country, email, phone (char + spp.phone.number with country), bank account (res.partner.bank), household registration ID (spp.registry.id). Individuals get: birth_place, civil_status (age-appropriate), email, phone (char + spp.phone.number with country), national ID for adults (age >= 15), birth certificate for children (age < 15). - New DemographicEnricher utility class with batch and single-record modes - Extend locale providers (fil_PH, fr_TG, si_LK) with cities, streets, phone formats, email domains, birth places, banks, ID format templates - Integrate into SeededVolumeGenerator (Phase 5+6 after existing phases) - Integrate into story registrant creation (enriches all story registrants) - Add spp_banking dependency to manifest
spp_mis_demo_v2/docs/USE_CASES.md
Outdated
| | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | Target | Household (Group) | | ||
| | CEL (Eligibility) | `r.is_group == true and hh_total_income < poverty_line and hh_size >= 2` | | ||
| | CEL (Compliance) | `per_capita_income < poverty_line` | |
There was a problem hiding this comment.
@emjay0921 does it make sense to have per_capita_income < poverty_line here?
Since it is conditionality, I would think something like if the per capita income is > 50% of the poverty line or something would make more sense?
Becuase since the total_hh_income must be less than poverty_line, I don't see how the average income across household members can be higher.
And since there is a need for at least two household members to be eligible, we would allow quite high aggregated household incomes before marking members as non_compliant.
…s, fix head enrollment - Fix use case Country Name Equivalents: correct all Togolese and Sri Lankan names to match actual demo_stories.py mappings (e.g., Silva->Bandara, Agbeko->Lawson, Amouzou->Deku, etc.) - Rewrite USE_CASES.md using QA's HH code format with all locale member names filled in, unified geographic table, corrected story IDs - Add locale-aware area assignments to story registrants via STORY_AREA_MAP (specific areas per country for each story household/individual) - Fix enroll_individual to find actual head member by membership type instead of first member by ID - Verified 90/90 checks + 9/9 area assignments across all 3 locales
Why is this change needed?
Several demo stories were created as individuals but enrolled in group-targeting programs, causing CEL expression mismatches. Default story names were a mix of Filipino, Arabic, and other origins instead of being culturally consistent per locale. USE_CASES.md and program references were outdated. Demo programs had no compliance criteria configured, missing a key feature demonstration.
How was the change implemented?
Story & Program Fixes (spp_demo, spp_mis_demo_v2)
Compliance Criteria (spp_mis_demo_v2)
per_capita_income < poverty_lineper_capita_income < income_threshold(overridden to 2000)non_compliant)enrolled)_CCGeligibility flag to 4 household blueprints (bp_01, bp_04, bp_06, bp_28) for Conditional Child Grant volume enrollments (~110 households)spp.cel.program.parameterfor income_thresholdDocumentation Sync (spp_mis_demo_v2)
README Regeneration
New unit tests
Unit tests executed by the author
How to test manually
per_capita_income < poverty_lineRelated links