ObjDataSeedReusable synthetic data generation for the Axion platform.
Centralises all Faker usage across the codebase. No other module
should import faker.Faker directly -- use ObjDataSeed.get_faker()
or the convenience class methods instead.
Updated: 2026-03-20
Copyright: proprietary to TechnoCore Automate
ObjData
└── ObjDataSeed
ObjDataSeed inherits from ObjData directly (not ObjDataTransfer)
so it can be used independently in tests, CLI scripts, or any module
that needs realistic fake data without pulling in the full
data-transfer dependency tree.
from ObjDataSeed import ObjDataSeed
# Class method style (no instance needed, no DB connection)
name = ObjDataSeed.fake_name()
email = ObjDataSeed.fake_email()
score = ObjDataSeed.fake_int(min_val=300, max_val=850)
# Instance style (for methods that need DB access)
seed = ObjDataSeed()
records = seed.generate_test_data(count=50, seed=42)
seed.seed_credit_profiles(count=200, target="mariadb")
seed.seed_credit_score_history(profiles=100, months=36)
get_faker(locale, seed) -- static methodReturn a configured Faker instance. This is the single entry point
for obtaining a Faker object across the entire platform.
| Parameter | Type | Default | Description |
|---|---|---|---|
locale |
str |
"en_GB" |
Faker locale string |
seed |
int \| None |
None |
Optional seed for reproducibility |
fake = ObjDataSeed.get_faker(seed=42)
print(fake.name())
All fake_* methods are @classmethod calls that use a shared
internal Faker singleton (en_GB locale). They require no instance
and no database connection.
| Method | Return Type | Notes |
|---|---|---|
fake_name() |
str |
Full name |
fake_first_name() |
str |
First name only |
fake_last_name() |
str |
Last name only |
fake_email() |
str |
Email address |
fake_phone() |
str |
Phone number |
fake_address() |
str |
Full multi-line address |
fake_street_address() |
str |
Street address line |
fake_city() |
str |
City name |
fake_country() |
str |
Country name |
fake_company() |
str |
Company name |
fake_ipv4() |
str |
IPv4 address (e.g. "192.168.1.1") |
fake_hostname() |
str |
Hostname |
fake_user_agent() |
str |
Browser user-agent string |
fake_sentence() |
str |
Single sentence |
fake_word() |
str |
Single word |
fake_text(max_chars=200) |
str |
Paragraph text up to max_chars |
fake_iso8601() |
str |
ISO 8601 datetime string |
fake_int(min_val=0, max_val=9999) |
int |
Random integer in range |
fake_float(min_val=0.0, max_val=1000.0) |
float |
Random float, 2 decimal places |
fake_boolean() |
bool |
Random boolean |
fake_choice(elements) |
str |
Random element from a list |
fake_uuid() |
str |
UUID4 string |
from ObjDataSeed import ObjDataSeed
name = ObjDataSeed.fake_name()
email = ObjDataSeed.fake_email()
active = ObjDataSeed.fake_boolean()
status = ObjDataSeed.fake_choice(["ACTIVE", "CLOSED", "PENDING"])
generate_test_data(count, include_guid, seed)Generate general-purpose test records using Faker. Returns a list of
dictionaries with fields: name, email, phone, address, city,
country, company, job_title, value, price, is_active,
created_at, description, and optionally guid.
| Parameter | Type | Default | Description |
|---|---|---|---|
count |
int |
10 |
Number of records to generate |
include_guid |
bool |
True |
Include a GUID field per record |
seed |
int \| None |
None |
Faker seed for reproducibility |
seed = ObjDataSeed()
records = seed.generate_test_data(count=5, seed=42)
for r in records:
print(r["name"], r["email"])
seed_credit_profiles(count, table_name, seed, target)Seed synthetic South African credit bureau profiles into MariaDB,
MSSQL, or MongoDB. Creates the target table/collection if it does not
exist. Each record includes a valid-format SA ID number (Luhn
checksum), demographic data, credit score with risk band, income/debt
ratios, and account status.
| Parameter | Type | Default | Description |
|---|---|---|---|
count |
int |
100 |
Number of profiles to insert |
table_name |
str |
data_credit_profile |
Target table or collection name |
seed |
int \| None |
None |
Random seed for reproducibility |
target |
str |
mssql |
Database target: mssql, mariadb, or mongodb |
Connection details are read from config.yaml:
mssql reads from terraform.mssqlmariadb reads from database.primary*mongodb reads from terraform.mongoCredit profile fields:
| Field | Description |
|---|---|
ProfileGuid |
UUID4 primary key |
IDNumber |
Valid-format 13-digit SA ID (Luhn checksum) |
FirstName, LastName |
Name (gender-matched) |
DateOfBirth, Age, Gender |
Demographics |
PhoneNumber, EmailAddress |
Contact details |
Province |
South African province |
CreditScore |
300-850 range |
RiskBand |
A (750+), B (650+), C (550+), D (450+), E (<450) |
MonthlyIncome, TotalDebt |
Financial data |
DebtToIncomeRatio |
Percentage (capped at 999.99) |
ArrearsBalance, MonthsInArrears |
Arrears info |
EmploymentStatus |
EMPLOYED, SELF_EMPLOYED, UNEMPLOYED, RETIRED |
AccountStatus |
GOOD_STANDING, ARREARS, DEFAULT, LEGAL, WRITTEN_OFF |
OpenAccounts, ClosedAccounts |
Account counts |
CreatedDate |
Timestamp of insertion |
seed_credit_score_history(profiles, months, seed, bucket)Write synthetic credit score time-series data into InfluxDB. For each
profile, generates a random-walk credit score trajectory with monthly
granularity.
| Parameter | Type | Default | Description |
|---|---|---|---|
profiles |
int |
50 |
Number of synthetic profiles |
months |
int |
24 |
Monthly data points per profile |
seed |
int \| None |
None |
Random seed for reproducibility |
bucket |
str \| None |
None |
InfluxDB bucket (defaults to active package) |
Measurement: credit_score_history
Tags: profile_guid, risk_band, province, employment_status
Fields: credit_score, arrears_balance, debt_to_income_ratio, months_in_arrears
_build_sa_id(dob, gender)Generates a valid-format 13-digit South African ID number from a date
of birth and gender string ("M" or "F"). The sequence range encodes
gender (5000-9999 for male, 0-4999 for female) and the final digit is
a Luhn checksum.
| Parameter | Type | Description |
|---|---|---|
dob |
date |
Date of birth |
gender |
str |
"M" or "F" |
# Seed credit profiles into MSSQL (default)
python ObjDataSeed.py seed-credit-profiles --count 500
# Seed into MariaDB with reproducible output
python ObjDataSeed.py seed-credit-profiles \
--target mariadb --count 200 --seed 42
# Seed into MongoDB
python ObjDataSeed.py seed-credit-profiles \
--target mongodb --count 200
# Seed credit score time-series into InfluxDB
python ObjDataSeed.py seed-credit-history \
--profiles 100 --months 36
# Seed with reproducible output
python ObjDataSeed.py seed-credit-history \
--profiles 50 --seed 42