Skip to main content

dumph banner

PyPI Version PyPI Stats Python Versions Rust Version GitLab Python Implementation License

Dumph

Philippine mock data generator and Python bindings for local dataset seeding, development workflows and automated testing

Dumph is a library for generating realistic Philippine mock data, with first-class Python bindings. It is built for database seeding, development workflows and automated testing, without maintaining hand-written fixtures or relying on foreign-locale generators.

Each record is generated as a coherent whole rather than a collection of independent random values:

  • Identity: first names are matched to the record's gender, birthdates are consistent with the generated age and civil status is plausible for that age.
  • Contact: email addresses are derived from the record's name and phone numbers follow Philippine carrier and area code conventions.
  • Geography: barangay, city/municipality, province, region and ZIP code are always drawn from the same real location, so the address hierarchy is never mismatched.

The core is implemented in Rust and exposed to Python through PyO3. Geographic data spans Luzon, Visayas and Mindanao and is embedded directly in the compiled library, so Dumph runs offline with no runtime data files, and ships with complete type hints for a smooth editor and type-checker experience.

Table of Contents

Features

  • Localized Philippine data: Filipino names, mobile and landline numbers and addresses.
  • Consistent rows: Names match gender, birthdate matches age, civil status fits the age and emails come from the row's name.
  • Complete address hierarchy: Region, province, city/municipality, barangay and ZIP code from the same real location.
  • Location filters: Restrict generated addresses to an island group, region, province or city.
  • Reproducible output: Pass a seed to get the same data every run, for stable test fixtures.
  • Field options: Set ranges, date bounds, probabilities and uniqueness per column.
  • Unique values: unique=True guarantees no repeats, for tables with unique constraints.
  • Streaming: seed_iter() generates one row at a time for very large datasets.
  • Government and ID formats: SSS, TIN, PhilHealth, PhilSys, Pag-IBIG, UMID, passport, driver's license and plate numbers.
  • Profile fields: Middle name, suffix, username, occupation, employer, religion, height and weight.
  • Flexible dynamic types: Built-in pattern matching for custom integer ranges, precision-controlled floats and custom choices.
  • Custom schemas: Map your own column names to built-in field types.
  • Built-in export: Save to JSON or CSV with one call.
  • Rust core: Native extension with a small Python API: seed(), seed_iter() and save().
  • Fully typed: PEP 561 type stubs with FieldType and FieldSpec.
  • Zero runtime dependencies: Datasets are compiled into the library.

Installation

Install from PyPI:

pip install dumph

Requirements: Python 3.8 or newer.

Verify installation:

python -c "from dumph import Dummy; print(Dummy())"

Usage

Quick start

from dumph import Dummy


dump = Dummy()

schema = {
    'ID': 'uuid',
    'Firstname': 'first_name',
    'Lastname': 'last_name',
    'Gender': 'gender',
    'Birthdate': 'birthdate',
    'Age': 'age',
    'Email': 'email',
    'Phone': 'phone_number',
    'Barangay': 'barangay',
    'City/Municipality': 'city_mun',
    'Province': 'province',
    'Region': 'region',
    'Zip Code': 'zip_code',
}

# Generate 100 rows of consistent, localized records
data = dump.seed(row=100, feature=schema)

print(data[0])

seed() returns a list of dicts. Each key is a column header from your schema and each value is generated according to the field type you mapped it to.

Reproducible output

Pass seed to get identical data on every run. Because birthdates and ages depend on today's date, also pass as_of for output that is identical on any day:

a = dump.seed(row=50, feature=schema, seed=42, as_of='2026-01-01')
b = dump.seed(row=50, feature=schema, seed=42, as_of='2026-01-01')

assert a == b

Output is stable for the same Dumph version. It is not guaranteed to stay identical across releases.

Field options

Replace a field type string with a dict to configure that column:

schema = {
    'Name': 'full_name',
    'Age': {'type': 'age', 'min': 18, 'max': 30},
    'Score': {'type': 'integer', 'min': 1, 'max': 10},
    'Hired': {'type': 'date', 'start': '2022-01-01', 'end': '2025-12-31'},
    'Active': {'type': 'boolean', 'probability': 0.8},
    'Email': {'type': 'email', 'unique': True},
}

data = dump.seed(row=100, feature=schema)

See the field options reference for every option.

Location filters

Restrict generated addresses with region, province and city_mun:

# Any location in Mindanao
data = dump.seed(row=100, feature=schema, region='Mindanao')

# A single province
data = dump.seed(row=100, feature=schema, province='Misamis Oriental')

Filters are case-insensitive. region matches an island group (Luzon, Visayas, Mindanao) or part of a region name. province and city_mun use an exact name when one exists, otherwise a partial match. A filter that matches nothing raises ValueError.

Unique values

Set unique on a column to guarantee no repeated values within a call:

schema = {
    'ID': {'type': 'uuid', 'unique': True},
    'Email': {'type': 'email', 'unique': True},
    'TIN': {'type': 'tin_number', 'unique': True},
}

When a value repeats, the whole row is regenerated, so related fields stay consistent. If the pool of possible values runs out (for example, a unique blood_type across many rows), ValueError is raised.

Streaming

seed_iter() takes the same arguments as seed() but returns an iterator that generates one row at a time, so memory use stays flat for large datasets:

for record in dump.seed_iter(row=1_000_000, feature=schema, seed=1):
    ...  # insert, write, or process one row at a time

Flexible Custom Types

You can use dynamic patterns to configure custom ranges and selections directly inside your schema:

schema = {
    'Name': 'full_name',
    'Score': 'int:50:100',
    'Rating': 'float:1.0:5.0:2',
    'Department': 'choice:HR,IT,Sales,Finance'
}

data = dump.seed(row=100, feature=schema)

Saving to JSON or CSV

# Writes test_schema.json
dump.save(data, 'test_schema', 'json')

# Writes test_schema.csv (column order follows your schema)
dump.save(data, 'test_schema', 'csv')

The file extension is added automatically, pass the filename without an extension.

Type hints

Dumph ships with type stubs and a py.typed marker. Use FieldSpec to get autocompletion and static checking for your schema, including options dicts:

from typing import Dict

from dumph import Dummy, FieldSpec

schema: Dict[str, FieldSpec] = {
    'ID': 'uuid',
    'Name': 'full_name',
    'Phone': 'phone_number',
    'Age': {'type': 'age', 'min': 18, 'max': 30},
    'Rating': 'float:1.0:5.0:2',
}

rows = Dummy().seed(row=100, feature=schema)

Annotating the schema variable is recommended. Without it, type checkers infer dict[str, str] for a variable and will reject it. Passing the dictionary literal directly to seed() needs no annotation.

Nested Address

dump = Dummy()
rows = dump.seed(row=1, feature={'Location': 'address'})

# {
#     'Location': {
#         'barangay': '...',
#         'city': '...',
#         'province': '...',
#         'region': '...',
#         'zip_code': '...'
#     }
# }

Seeding a database (example)

from dumph import Dummy

dump = Dummy()

residents = dump.seed(
    row=500,
    feature={
        'first_name': 'first_name',
        'last_name': 'last_name',
        'birthdate': 'birthdate',
        'civil_status': 'civil_status',
        'barangay': 'barangay',
        'city_mun': 'city_mun',
    },
    seed=42,
)

# Use the records with your ORM or SQL client of choice,
# e.g., Django's Model.objects.bulk_create(...)

Notes

  • Column names in the schema are fully up to you, only the values must be valid field types.
  • Unknown field types, unknown options and invalid ranges raise ValueError. For a typo such as 'frist_name', the error suggests the closest valid type and lists all valid types.
  • Fields generated within the same row share state. For example, first_name, full_name, gender and email always agree, civil_status fits age, weight_kg fits height_cm and all address fields come from the same location.
  • Emails vary in format from row to row (for example juan.delacruz, jdelacruz or juan_delacruz42). Use unique=True when you need no duplicates.
  • suffix is None for most rows and is only generated for men. In CSV, None is written as an empty cell.
  • Nested values (such as address) are best exported to JSON. In CSV they are written as their Python string representation.
  • All generated data is fictitious. Government ID numbers follow format conventions only and are not real or verifiable. Do not use them for anything other than development and testing.

API Reference

Arguments and Parameters

Dummy()

Creates a new generator instance. Takes no arguments.

Dummy.seed(row, feature, *, seed, region, province, city_mun, as_of)

Generates mock records.

Parameter Type Required Description
row int Yes Number of records (rows) to generate.
feature dict Yes Schema mapping each output column name (str) to a built-in field type (str) or an options dict. Order is preserved.
seed int No Seed for reproducible output. Omit for random output each call.
region str No Restrict locations to an island group (Luzon, Visayas, Mindanao) or part of a region name.
province str No Restrict locations to a province.
city_mun str No Restrict locations to a city or municipality.
as_of str No Reference date (YYYY-MM-DD) used for ages and birthdates. Defaults to today.

The parameters after feature are keyword-only.

Returns: list[dict], one dictionary per generated row.

Raises: ValueError for unknown field types or options, invalid ranges or dates, no matching location, or an exhausted unique pool.

Dummy.seed_iter(row, feature, *, seed, region, province, city_mun, as_of)

Same parameters as seed(). Returns an iterator that yields one dict per row instead of building a list.

Dummy.save(data, filename, fmt)

Writes generated data to a file.

Parameter Type Required Description
data list Yes The list returned by seed().
filename str Yes Output file name without extension. The extension is appended based on fmt.
fmt str Yes Output format: 'json' or 'csv' (case-insensitive).

Returns: None. A confirmation message is printed on success.

Raises: ValueError if fmt is neither json nor csv.

Field Options Reference

A schema value can be a field type string, or a dict with a required type key and any of these options:

Option Type Applies to Description
type str All Required. Any built-in type.
min int age, birthdate, integer Lower bound. Age defaults to 18, integer to 0.
max int age, birthdate, integer Upper bound. Age defaults to 70, integer to 100.
start str date Earliest date, YYYY-MM-DD. Defaults to 2020-01-01.
end str date Latest date, YYYY-MM-DD. Defaults to today (or as_of).
probability float boolean Chance of True, from 0 to 1. Defaults to 0.5.
unique bool All Guarantee no repeated values. Defaults to False.

age and birthdate share one age range, so min and max on either column apply to both.

Built-in Types

Utility

Type Alias Output Description
uuid id str Random UUID (v4).
color none str Random color name.
status none str Random status value.

Personal

Type Output Description
first_name str Filipino first name, matching the row's gender.
middle_name str Middle name, taken from a Filipino surname.
last_name str Filipino surname.
full_name str First and last name combined.
suffix str or None Generational suffix (Jr., II, III and similar). Men only, None for most rows.
gender str Male or Female.
birthdate str Date in YYYY-MM-DD format, exactly matching age.
age int Age between 18 and 70 by default. Configurable with min and max.
civil_status str Single, Married, Widowed or Separated, weighted by age.
blood_type str Blood type (e.g. O+).
email str Email built from the row's first and last name in one of several common formats, such as juan.delacruz, jdelacruz or juan_delacruz42.
username str Username built from the row's name, e.g. juan_delacruz42.

Profile

Type Output Description
occupation str Common occupation.
employer str Generic employer or institution.
religion str Religion, weighted by approximate national distribution.
height_cm int Height in centimeters, based on the row's gender.
weight_kg float Weight in kilograms, plausible for the row's height.

Contact

Type Output Description
phone_number str Philippine mobile number with a carrier prefix, formatted as +63 <prefix> <number>.
landline str Landline number with an area code, formatted as (<area code>) <number>.

Geographic

All geographic types in a single row come from the same location.

Type Output Description
address dict Nested object with barangay, city, province, region and zip_code.
full_address str Barangay, City/Municipality, Province, Region ZIP.
barangay str Barangay name.
city_mun str City or municipality name.
province str Province name.
region str Region name.
zip_code str ZIP code of the city/municipality.

Government and IDs

Type Output Description
sss_number str Social Security System number.
tin_number str Tax Identification Number (XXX-XXX-XXX-XXX).
philhealth_number str PhilHealth identification number.
philsys_number str PhilSys Card Number, 16 digits (XXXX-XXXX-XXXX-XXXX).
pagibig_number str Pag-IBIG MID number, 12 digits (XXXX-XXXX-XXXX).
umid_number str UMID CRN, 12 digits (XXXX-XXXXXXX-X).
passport_number str Passport number (P1234567A).
drivers_license str Driver's license number, starting with the row's surname initial.
plate_number str Vehicle plate number (ABC 1234).

Generic

Type Output Description
integer int Random integer. Use min and max (default 0 to 100).
date str Random date in YYYY-MM-DD format. Use start and end.
boolean bool Random True or False. Use probability (default 0.5).

Dynamic / Flexible Custom Types

Pattern Syntax Output Description
int:min:max int Randomized integer within the inclusive range [min, max] (e.g., 'int:10:50').
float:min:max:decimals float Randomized floating-point number within range, rounded to specified decimal places (e.g., 'float:1.0:5.0:2').
choice:val1,val2,... str Randomly picks one value from a comma-separated list of strings (e.g., 'choice:Yes,No').

Data Sources

Dumph datasets are compiled from publicly available sources:

Data Source
First names Forebears.io - Philippines forenames
Surnames Forebears.io - Philippines surnames
Regions, provinces, cities/municipalities, barangays and ZIP codes PSGC Cloud API

Changelog

See CHANGELOG.md for the list of changes in each release.

License

This project is licensed under the Apache License 2.0

Author

Created and maintained by cjggarcia.dev

Metadata

Release files for dumph 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dumph 1.2.0
File Size Uploaded Provenance Actions
dumph-1.2.0.tar.gz 1.4 MB Without provenance Details for dumph-1.2.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for dumph 1.2.0
File Interpreter ABI Platform Actions
dumph-1.2.0-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details for dumph-1.2.0-cp38-abi3-win_amd64.whl
dumph-1.2.0-cp38-abi3-manylinux_2_34_x86_64.whl CPython 3.8 abi3 Linux glibc 2.34+ x86-64 Details for dumph-1.2.0-cp38-abi3-manylinux_2_34_x86_64.whl

Total release size: 3.4 MB

Release files / dumph-1.2.0.tar.gz

Download URL dumph-1.2.0.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
30a50163c8f9197737d4cbc560e2ac8319ee020e262c2061a0d73a24f58eae7a
BLAKE2b-256 checksum
How to use checksums
2344abca1acde427db3cdeffa4604b5f982e164c77979a556b65108b62eb8b4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / dumph-1.2.0-cp38-abi3-win_amd64.whl

Download URL dumph-1.2.0-cp38-abi3-win_amd64.whl
Size 898.2 kB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
399fee0a5f7fb82fa14260f873dcb56872f833fcb7dad8cec7eb48eeb0e99b49
BLAKE2b-256 checksum
How to use checksums
8eca8e5091db1cff723ccd0f37c02d052b86f66b713683c8c190e0537d9f5830
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / dumph-1.2.0-cp38-abi3-manylinux_2_34_x86_64.whl

Download URL dumph-1.2.0-cp38-abi3-manylinux_2_34_x86_64.whl
Size 1.1 MB
Tags CPython 3.8 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
9a4c19445bd3fa855d54de5d12a5ce76cddaa215fd89612989e43c3d5d9bef09
BLAKE2b-256 checksum
How to use checksums
8dc86911d67a5ec31115b3e5412a06503746806ae10d53dcf371620765204a14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Security for dumph 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page