Skip to content

Commit c3c0549

Browse files
committed
refactor(spp_mis_demo_v2): remove Faker dependency, use pure seeded RNG for name generation
Replace all Faker usage with deterministic random.Random(seed).choice() from locale-specific name arrays. This ensures fully reproducible output across runs with the same seed. - Remove create_faker import and fake variable from mis_demo_generator - Delete dead code: _generate_random_groups, _create_random_individual, _generate_volume_enrollments - Remove fake parameter from _create_program_cycles - Remove faker from external_dependencies in manifest - Remove tests that called deleted _create_random_individual method - Update docs and docstrings to reflect seeded RNG approach
1 parent 8fd4f27 commit c3c0549

6 files changed

Lines changed: 72 additions & 424 deletions

File tree

spp_mis_demo_v2/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"spp_claim_169",
2525
# Demo-specific extensions
2626
],
27-
"external_dependencies": {"python": ["faker", "requests"]},
27+
"external_dependencies": {"python": ["requests"]},
2828
"post_init_hook": "post_init_hook",
2929
"data": [
3030
"security/ir.model.access.csv",

spp_mis_demo_v2/docs/USE_CASES.md

Lines changed: 40 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# OpenSPP MIS Demo V2 - Use Cases Guide
22

3-
This document describes the different demo use cases available in the `spp_mis_demo_v2` module and how to use them
4-
effectively for sales demos, training, and testing.
3+
This document describes the different demo use cases available in the `spp_mis_demo_v2`
4+
module and how to use them effectively for sales demos, training, and testing.
55

66
## Table of Contents
77

@@ -19,11 +19,13 @@ effectively for sales demos, training, and testing.
1919

2020
## Overview
2121

22-
The MIS Demo V2 module provides realistic demo data that showcases OpenSPP's capabilities for social protection program
23-
management. It follows the **Blueprint + Seeded Faker** architecture:
22+
The MIS Demo V2 module provides realistic demo data that showcases OpenSPP's
23+
capabilities for social protection program management. It follows the **Blueprint +
24+
Seeded RNG** architecture:
2425

2526
- **Fixed Stories**: 8 named personas with predefined program journeys (unchanged)
26-
- **Deterministic Volume**: ~730 households with ~2,500 members from 28 blueprint templates
27+
- **Deterministic Volume**: ~730 households with ~2,500 members from 28 blueprint
28+
templates
2729
- **Demo Programs**: 6 programs covering different social protection scenarios
2830
- **100% Reproducible**: Same country selection = identical output every run
2931
- **Country-aware Names**: Names change by locale (Philippines, Sri Lanka, Togo)
@@ -32,14 +34,17 @@ management. It follows the **Blueprint + Seeded Faker** architecture:
3234

3335
## Blueprint Architecture
3436

35-
Volume data is generated from **28 household blueprint templates** — deterministic definitions that specify household
36-
composition (members, ages, genders), income bracket, and program eligibility. Blueprints are multiplied by their
37-
`count` to reach the target volume.
37+
Volume data is generated from **28 household blueprint templates** — deterministic
38+
definitions that specify household composition (members, ages, genders), income bracket,
39+
and program eligibility. Blueprints are multiplied by their `count` to reach the target
40+
volume.
3841

3942
**Key properties:**
4043

41-
- All structural choices (ages, incomes, genders for "any" specs) use `random.Random(42)` — deterministic
42-
- Names are generated by `Faker(locale, seed=42)` — deterministic per locale
44+
- All structural choices (ages, incomes, genders for "any" specs) use
45+
`random.Random(42)` — deterministic
46+
- Names are generated by `random.Random(42).choice()` from locale-specific arrays —
47+
deterministic per locale
4348
- Reserved story names are never used for volume records
4449
- Each blueprint defines eligibility flags per program, ensuring consistent enrollment
4550

@@ -56,15 +61,17 @@ composition (members, ages, genders), income bracket, and program eligibility. B
5661

5762
## Country / Locale Support
5863

59-
The wizard lets you choose a country. This determines the locale for name generation and the company currency.
64+
The wizard lets you choose a country. This determines the locale for name generation and
65+
the company currency.
6066

6167
| Country | Locale | Currency | Name Examples |
6268
| ----------- | -------- | ---------------------------- | ---------------------------- |
6369
| Philippines | `fil_PH` | PHP (Philippine Peso) | Juan Santos, Maria Dela Cruz |
6470
| Sri Lanka | `si_LK` | LKR (Sri Lankan Rupee) | Kasun Perera, Ishara Silva |
6571
| Togo | `fr_TG` | XOF (West African CFA Franc) | Koffi Mensah, Ama Dosseh |
6672

67-
**Reproducibility guarantee**: Selecting the same country always produces the exact same set of records.
73+
**Reproducibility guarantee**: Selecting the same country always produces the exact same
74+
set of records.
6875

6976
---
7077

@@ -440,8 +447,8 @@ The wizard lets you choose a country. This determines the locale for name genera
440447

441448
## Formula Library Demo
442449

443-
The MIS Demo includes comprehensive formula library data demonstrating versioned, auditable business rules for
444-
eligibility, entitlements, and scoring.
450+
The MIS Demo includes comprehensive formula library data demonstrating versioned,
451+
auditable business rules for eligibility, entitlements, and scoring.
445452

446453
### Formula Categories
447454

@@ -472,9 +479,10 @@ eligibility, entitlements, and scoring.
472479
household.pmt_score < 45.0 && household.member_count > 0
473480
```
474481

475-
**Test Cases:** | Persona | PMT Score | Expected | Result | |---------|-----------|----------|--------| | Maria Santos |
476-
38 | `true` | ✓ Eligible | | Rosa Garcia | 42 | `true` | ✓ Eligible | | Carlos Morales | 48 | `false` | ✗ Not eligible |
477-
| Ibrahim Hassan | 35 | `true` | ✓ Eligible |
482+
**Test Cases:** | Persona | PMT Score | Expected | Result |
483+
|---------|-----------|----------|--------| | Maria Santos | 38 | `true` | ✓ Eligible |
484+
| Rosa Garcia | 42 | `true` | ✓ Eligible | | Carlos Morales | 48 | `false` | ✗ Not
485+
eligible | | Ibrahim Hassan | 35 | `true` | ✓ Eligible |
478486

479487
---
480488

@@ -493,8 +501,9 @@ household.pmt_score < 45.0 && household.member_count > 0
493501
individual.age >= 65 && !individual.receives_other_pension
494502
```
495503

496-
**Test Cases:** | Persona | Age | Other Pension | Expected | |---------|-----|---------------|----------| | Rosa Garcia
497-
| 72 | No | `true`| | Maria Santos | 45 | No | `false`| | Pedro Reyes | 55 | No | `false`|
504+
**Test Cases:** | Persona | Age | Other Pension | Expected |
505+
|---------|-----|---------------|----------| | Rosa Garcia | 72 | No | `true`| |
506+
Maria Santos | 45 | No | `false` ✗ | | Pedro Reyes | 55 | No | `false` ✗ |
498507

499508
---
500509

@@ -513,8 +522,9 @@ individual.age >= 65 && !individual.receives_other_pension
513522
150.0 + (household.child_count * 50.0) * (household.is_rural ? 1.2 : 1.0)
514523
```
515524

516-
**Test Cases:** | Persona | Children | Rural | Expected Amount | |---------|----------|-------|-----------------| |
517-
Maria Santos | 2 | Yes | $270 | | Carlos Morales | 3 | No | $300 | | Ana Mendoza | 1 | Yes | $210 |
525+
**Test Cases:** | Persona | Children | Rural | Expected Amount |
526+
|---------|----------|-------|-----------------| | Maria Santos | 2 | Yes | $270 | |
527+
Carlos Morales | 3 | No | $300 | | Ana Mendoza | 1 | Yes | $210 |
518528

519529
---
520530

@@ -537,8 +547,9 @@ min(40, (100 - household.pmt_score) * 0.5)
537547
```
538548

539549
**Test Cases:** | Persona | Female-Headed | Disabled | Dep. Ratio | PMT | Score |
540-
|---------|---------------|----------|------------|-----|-------| | Rosa Garcia | No | No | 0.0 | 42 | 29 | | Maria
541-
Santos | Yes | No | 0.4 | 38 | 51 | | Ibrahim Hassan | No | Yes | 0.6 | 35 | 72 |
550+
|---------|---------------|----------|------------|-----|-------| | Rosa Garcia | No |
551+
No | 0.0 | 42 | 29 | | Maria Santos | Yes | No | 0.4 | 38 | 51 | | Ibrahim Hassan | No |
552+
Yes | 0.6 | 35 | 72 |
542553

543554
---
544555

@@ -587,7 +598,8 @@ vulnerability_score(household) * 0.6 +
587598

588599
**Objective:** Demonstrate formula versioning for policy changes
589600

590-
**Story:** Government decides to expand Cash Transfer coverage by raising PMT threshold from 45 to 50.
601+
**Story:** Government decides to expand Cash Transfer coverage by raising PMT threshold
602+
from 45 to 50.
591603

592604
**Steps:**
593605

@@ -817,7 +829,8 @@ vulnerability_score(household) * 0.6 +
817829

818830
## Event Data
819831

820-
The MIS Demo generates event records that track beneficiary interactions with the system.
832+
The MIS Demo generates event records that track beneficiary interactions with the
833+
system.
821834

822835
### Event Types
823836

@@ -914,7 +927,8 @@ This ensures proper integration between modules and complete demo scenarios.
914927

915928
### GRM Integration
916929

917-
The GRM demo creates specific tickets for story personas that integrate with their MIS journeys:
930+
The GRM demo creates specific tickets for story personas that integrate with their MIS
931+
journeys:
918932

919933
| Story | GRM Ticket | Links To |
920934
| ---------------- | -------------------- | -------------------------- |

0 commit comments

Comments
 (0)