Demo data generator for SP-MIS programs. Creates 7 social protection
programs with CEL eligibility expressions, enrolls 8 demo personas with
payment histories, and optionally generates ~730 deterministic
households from seeded blueprints (seed=42) for reproducible volume
data. Activates registry variables from spp_studio and installs
Logic Packs for eligibility rules.
- Generate 7 programs (Universal Child Grant, Conditional Child Grant, Elderly Pension, Emergency Relief, Cash Transfer, Disability Support, Food Assistance) with CEL expressions
- Enroll 8 demo personas with predefined stories and payment histories covering all demo scenarios
- Generate ~730 deterministic households with ~2555 members from 28
blueprints via
SeededVolumeGeneratorwithrandom.Random(seed=42)— same seed always produces identical output - Install Logic Packs from
spp_studiofor eligibility rules (child_benefit, social_pension, vulnerability_assessment, cash_transfer_basic, disability_assistance) - Activate registry variables (age, child_count, hh_total_income, dependency_ratio, etc.) via post_init_hook
- 4 demo modes (Sales, Training, Testing, Complete) with automatic field defaults
- Multi-locale support for name generation (fil_PH, si_LK, fr_TG)
- Geographic data loading for Philippines, Sri Lanka, and Togo
- Create change requests at various workflow stages (draft, pending, approved, rejected)
- Cross-module integration: automatically creates GRM tickets, case records, and Claim 169 QR credentials when those modules are installed
- Fairness analysis demo data and PRISM API client creation
| Model | Description |
|---|---|
spp.mis.demo.generator |
Core demo generator with all generation logic |
spp.mis.demo.wizard |
Wizard interface (inherits from generator) |
After installing:
- Navigate to Settings > Demo Data > Load MIS Demo
- The wizard opens with options for demo mode (Sales, Training, Testing, Complete)
- Click "Load Demo Data" to generate
For programmatic generation:
wizard = env['spp.mis.demo.wizard'].create({})
wizard.action_generate_demo_data()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
- Elderly Social Pension:
r.is_group == false and age >= retirement_age(age computation) - Emergency Relief Fund:
dependency_ratio >= 1.5 or (is_female_headed and elderly_count > 0)(compound conditions) - Cash Transfer Program:
hh_total_income < poverty_line and hh_size >= 2(income-based targeting) - Disability Support Grant:
r.is_group == true and has_disabled_member(member existence check) - Food Assistance:
r.is_registrant == true and r.active == true(simple field comparison)
The SeededVolumeGenerator uses random.Random(seed=42) for all
structural choices:
- Ages, incomes, genders, and names from locale-specific pools
- Birthdates, registration dates, GPS coordinates
- Household structure from 28 deterministic blueprints across 5 categories (young families, middle-age, elderly, working-age, extended/vulnerable)
- Membership realism applied post-generation (83% enrolled, 10% exited, 5% paused, 2% not eligible)
Running the generator twice with the same seed produces identical output.
- Menu: Settings > Demo Data > Load MIS Demo
- Form: Wizard with generation options (demo mode, Logic Pack installation, volume data configuration)
| Group | Access |
|---|---|
spp_security.group_spp_admin |
Full CRUD |
- Override
_create_demo_programs()to customize program definitions - Override
_enroll_demo_stories()to modify enrollment logic - Add custom demo modes by extending
demo_modeselection field - Inherit
spp.mis.demo.generatorto add fields or generation methods
spp_starter_sp_mis, spp_cr_types_advanced, spp_demo,
spp_gis_report, spp_claim_169
Table of contents
- fix(mis_demo): the Add Newborn demo change request resolves its
birthdate against the user's today instead of the server's.
STORY_CHANGE_REQUESTSis a class attribute, so thefields.Date.today()literal it carried was evaluated once at import — and it was the server's UTC date. The birthdate guard added for #362 refuses a date the user has not reached yet, so an admin west of UTC running the generator between 00:00 UTC and their local midnight got aValidationErrorand demo generation aborted. The definition now declaresbirthdate_days_backand_build_detail_changesresolves it withfields.Date.context_todayat build time.
- revert(mis_demo): the Add Member and Change Head of Household demo CRs
match the reinstated old flows (see
spp_change_request_v2#871/#873 revert) — Add Member builds a new individual (given/family name, birthdate, relationship) and Change HoH setsnew_head_idfrom the named new head, instead of the redesignedindividual_id/ per-member role lines.
- fix: PHL story registrants map to the curated PSGC p-code area
external IDs introduced by the re-landed spp_demo geodata
(
STORY_AREA_MAPstill referenced the removed named IDs, silently dropping area assignments).
- fix: demo GIS reports use
dimension_ids+member_expansioninstead of the removeddisaggregate_by_*boolean fields (ported from #295, credit @kneckinator; required in lockstep with the spp_gis_report dimension change).
- feat(demo): adapt the change-request demo generator to the redesigned CR flows — Add Member selects an existing individual (#871) and Change Head of Household uses per-member role lines (#873) (#242)
- feat(demo): seed country-appropriate CR document types (≥5 per country
for PHL / LKA / TGO) into the
cr_document_typevocabulary during demo generation, so a document type can be selected when attaching files to a change request without defining them manually (#1102)
- Initial migration to OpenSPP2
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed feedback.
Do not contact contributors directly about support or help with technical issues.
- OpenSPP.org
Current maintainers:
This module is part of the OpenSPP/OpenSPP2 project on GitHub.
You are welcome to contribute.




