Nonprofit Donor Pipeline Synthetic Data Seeder and Masking Script
Create a Python script to mask PII and generate high-volume synthetic test fixtures for nonprofit donor databases.
Deploy this template when testing nonprofit fundraising platforms, donor CRM integrations, or migration scripts without exposing real donor records. It writes a secure Python utility that sanitizes existing schemas and generates synthetic donation histories.
Role: Lead Nonprofit Quality Assurance Architect specializing in donor database privacy and pipeline testing.
Context
- Campaign Categories: {{fundraising_campaign_types}}
- Database Layout: {{donor_database_schema}}
- Privacy Constraint: {{compliance_standard}}
- Volume Requirement: {{synthetic_record_volume}}
- Serialization Format: {{target_export_format}}
- Hashing Key: {{anonymization_salt_secret}}
Task
Create a robust Python test utility script that parses realistic donor records, irreversibly masks personally identifiable information (PII), and seeds statistically valid synthetic donation histories for pre-production load testing.
Method
- Ingest {{donor_database_schema}} structural constraints including primary keys, foreign relations, and gift categorization.
- Configure pseudorandom data generators aligned with {{fundraising_campaign_types}} to produce realistic recurring pledge amounts and grant records.
- Implement deterministic cryptographic hashing using {{anonymization_salt_secret}} to preserve relational linkage between masked donor IDs and gift transactions.
- Validate masking operations against {{compliance_standard}} to confirm zero leakage of real names, phone numbers, tax identifiers, or physical addresses.
- Generate {{synthetic_record_volume}} synthetic records with authentic edge cases including lapsed donors, matching corporate gifts, and chargeback disputes.
- Verify relational referential integrity across donor accounts, pledge schedules, and allocation designations.
- Serialize the sanitized test dataset into {{target_export_format}} with validation checks for schema drift.
Constraints
- The script MUST NOT store unmasked PII in temporary memory or intermediate files.
- Generated data MUST maintain statistical distributions of gift amounts across {{fundraising_campaign_types}}.
- Ensure the generator handles minimum and maximum gift boundary conditions without integer overflows.
- Use pure Python standard libraries or industry-standard packages like Faker and Cryptography.
Output format
An executable Python 3 script structured into:
- Dependency imports and schema configuration classes.
- Masking engine with cryptographic salt handling.
- Synthetic dataset generator class with realistic donation distributions.
- CLI execution harness and export verification routine.
Self-review
- Confirm that no raw donor PII fields can bypass the anonymization transformation.
- Verify {{synthetic_record_volume}} generation operates in memory-efficient batches.
- Ensure referential integrity is preserved for nested campaign transactions.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.