Skip to content

Latest commit

 

History

History

spp_mis_demo_v2

README.rst

OpenSPP MIS Demo V2

Production/Stable License: LGPL-3 OpenSPP/OpenSPP2

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.

Key Capabilities

  • 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 SeededVolumeGenerator with random.Random(seed=42) — same seed always produces identical output
  • Install Logic Packs from spp_studio for 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

Key Models

Model Description
spp.mis.demo.generator Core demo generator with all generation logic
spp.mis.demo.wizard Wizard interface (inherits from generator)

Configuration

After installing:

  1. Navigate to Settings > Demo Data > Load MIS Demo
  2. The wizard opens with options for demo mode (Sales, Training, Testing, Complete)
  3. Click "Load Demo Data" to generate

For programmatic generation:

wizard = env['spp.mis.demo.wizard'].create({})
wizard.action_generate_demo_data()

Demo Programs

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)

Seeded Volume Generation

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.

UI Location

  • Menu: Settings > Demo Data > Load MIS Demo
  • Form: Wizard with generation options (demo mode, Logic Pack installation, volume data configuration)

Security

Group Access
spp_security.group_spp_admin Full CRUD

Extension Points

  • Override _create_demo_programs() to customize program definitions
  • Override _enroll_demo_stories() to modify enrollment logic
  • Add custom demo modes by extending demo_mode selection field
  • Inherit spp.mis.demo.generator to add fields or generation methods

Dependencies

spp_starter_sp_mis, spp_cr_types_advanced, spp_demo, spp_gis_report, spp_claim_169

Table of contents

19.0.2.1.5

  • fix(mis_demo): the Add Newborn demo change request resolves its birthdate against the user's today instead of the server's. STORY_CHANGE_REQUESTS is a class attribute, so the fields.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 a ValidationError and demo generation aborted. The definition now declares birthdate_days_back and _build_detail_changes resolves it with fields.Date.context_today at build time.

19.0.2.1.4

  • 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 sets new_head_id from the named new head, instead of the redesigned individual_id / per-member role lines.

19.0.2.1.3

  • fix: PHL story registrants map to the curated PSGC p-code area external IDs introduced by the re-landed spp_demo geodata (STORY_AREA_MAP still referenced the removed named IDs, silently dropping area assignments).

19.0.2.1.2

  • fix: demo GIS reports use dimension_ids + member_expansion instead of the removed disaggregate_by_* boolean fields (ported from #295, credit @kneckinator; required in lockstep with the spp_gis_report dimension change).

19.0.2.1.1

  • 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)

19.0.2.1.0

  • feat(demo): seed country-appropriate CR document types (≥5 per country for PHL / LKA / TGO) into the cr_document_type vocabulary during demo generation, so a document type can be selected when attaching files to a change request without defining them manually (#1102)

19.0.2.0.0

  • Initial migration to OpenSPP2

Bug Tracker

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.

Credits

Authors

  • OpenSPP.org

Maintainers

Current maintainers:

jeremi gonzalesedwin1123

This module is part of the OpenSPP/OpenSPP2 project on GitHub.

You are welcome to contribute.