DEV Community

Cover image for Stop Generating Nonsense Indian Mock Data. I Built a Better Way!
Abhay Mourya
Abhay Mourya

Posted on

Stop Generating Nonsense Indian Mock Data. I Built a Better Way!

If you build apps for the Indian market, you've probably needed mock demographic data for testing, UI previews, or training ML models.

And if you've used standard mock-data generators, you've probably ended up with a profile that looks something like this: A Sikh person named Mohammed Sharma living in Mizoram. ๐Ÿ˜…

Most fake-data libraries generate impossible demographic combinations because they operate on simple random selection. They pick a first name from list A, a last name from list B, a religion from list C, and a state from list D.

When context matters, that bad data can ruin your testing environment. Thatโ€™s why I built indian-fakedata.

Output Sample (one profile)

{
  "id": "33553413-2014-4616-9361-511204427271",
  "firstName": "Pushpa",
  "lastName": "Sharma",
  "fatherName": "Santosh Sharma",
  "motherName": "Geeta Sharma",
  "spouseName": "Sanjay Sharma",
  "gender": "female",
  "age": 34,
  "dateOfBirth": "1992-06-11",
  "bloodGroup": "O+",
  "heightCm": 152.9,
  "weightKg": 65.9,
  "bmi": 28.2,
  "aadhaarNumber": "500233102039",
  "panNumber": "EKIPS1361G",
  "voterIdNumber": "MHR3140140",
  "phoneNumber": "7513110431",
  "email": "pushpasharma328@gmail.com",
  "state": "Maharashtra",
  "stateCode": "MH",
  "district": "Aurangabad",
  "areaType": "urban",
  "addressLine": "469/A, Adarsh Colony, Aurangabad",
  "locality": "Adarsh Colony",
  "pinCode": "418683",
  "religion": "Hindu",
  "caste": "Deshastha Brahmin",
  "socialCategory": "General",
  "motherTongue": "Marathi",
  "secondLanguage": "English",
  "education": "secondary",
  "occupation": "agricultural_labourer",
  "employmentSector": "self_employed",
  "maritalStatus": "married",
  "annualIncomeINR": 194000,
  "monthlyExpenditureINR": 15300,
  "numberOfChildren": 1,
  "dietaryPreference": "non_vegetarian",
  "disability": "none",
  "isMigrant": true,
  "migrationOriginState": "Kerala",
  "bankIFSC": "PUNB0314300",
  "bankName": "Punjab National Bank",
  "bankAccountNumber": "03131130413",
  "rationCardType": "APL",
  "healthInsurance": "none",
  "landOwnershipAcres": 0,
  "vehicleRegistration": "MH 01 BG 3908",
  "vehicleType": "four_wheeler",
  "hasInternetAccess": true,
  "hasSmartphone": true,
  "usesSocialMedia": true,
  "upiId": "pushpa@okicici",
  "personality": {
    "openness": 53,
    "conscientiousness": 47,
    "extraversion": 53,
    "agreeableness": 46,
    "neuroticism": 74
  },
  "politicalLeaning": "nationalist_right",
  "religiosity": "very_religious",
  "cognitiveProfile": {
    "aptitudeScore": 40,
    "numeracyScore": 37,
    "literacyScore": 75,
    "digitalLiteracyScore": 45,
    "financialLiteracyScore": 93
  },
  "interests": {
    "primarySport": "cricket",
    "petPreference": "fish",
    "entertainment": [
      "Bollywood", "TV Serials", "Cricket Matches", "News",
      "YouTube", "OTT/Netflix", "Devotional Music"
    ],
    "readingHabit": "rare",
    "musicPreference": "Bollywood",
    "preferredSocialMedia": "WhatsApp"
  },
  "habits": {
    "tobaccoUse": "none",
    "alcoholUse": "none",
    "exerciseFrequency": "weekly",
    "avgSleepHours": 9.3,
    "cooksAtHome": true,
    "chronotype": "early_riser"
  },
  "educationDetails": {
    "fieldOfStudy": null,
    "institutionType": "private",
    "mediumOfInstruction": "English",
    "qualificationYear": 2008,
    "competitiveExamPercentile": null
  },
  "culturalProfile": {
    "entrepreneurialScore": 32,
    "academicOrientation": 64,
    "artisticInclination": 41,
    "militaryTradition": 37,
    "agriculturalRootedness": 21,
    "artisanTradition": 1,
    "bureaucraticOrientation": 50,
    "socialActivism": 13,
    "communityBonding": 67,
    "migrationTendency": 24,
    "careerPreference": "business_trade",
    "familyStructure": "nuclear_family",
    "savingsOrientation": 65,
    "riskAppetite": 12
  },
  "householdSize": 1,
  "householdAssets": {
    "hasRadioTransistor": false,
    "hasTelevision": true,
    "hasComputer": true,
    "hasPhone": true,
    "hasBicycle": true,
    "hasScooter": true,
    "hasCar": true,
    "bankingService": true,
    "treatedWaterSource": true,
    "latrineFacility": true,
    "numberOfRooms": 2,
    "roofMaterial": "concrete",
    "wallMaterial": "burnt_brick",
    "cookingFuel": "lpg",
    "lightingSource": "electricity",
    "drinkingWaterSource": "tap_treated"
  },
  "probabilityMetrics": {
    "nationalReligionFreq": 0.8033,
    "stateGivenReligionProb": 0.1032,
    "casteGivenContextProb": 0.0423,
    "lastNameGivenCasteProb": 0.2000,
    "socialCategoryProb": 0,
    "educationProb": 0.2189,
    "occupationProb": 0.1800,
    "jointProbability": 2.76e-05
  },
  "generatedAt": "2026-07-12T21:56:35.146855",
  "seed": 7
}
Enter fullscreen mode Exit fullscreen mode

Installation

Node.js / TypeScript

npm install @abhay557/indian-fakedata
Enter fullscreen mode Exit fullscreen mode

Requires **Node.js >= 18.

Python

pip install indian-fakedata
Enter fullscreen mode Exit fullscreen mode

Requires **Python 3.8+.


CLI Usage (Both Languages)

Both packages ship with the indian-fakedata CLI binary. The arguments are identical across both versions!

# Node.js
npx @abhay557/indian-fakedata [options]

# Python (or globally installed Node package)
indian-fakedata [options]
Enter fullscreen mode Exit fullscreen mode

Run with no arguments to display the full help menu.

Core Options

Flag Alias Description Default
--count <n> -c Number of profiles to generate 100
--output <path> -o File path to save output stdout
--format <fmt> -f Output format: json, jsonl, csv json
--seed <number> -s Reproducibility seed for RNG random
--no-metrics Exclude probability metrics from output included
--help -h Show help screen

Demographic Constraints

Filter generated profiles to specific demographic slices:

Flag Values
--religion <string> Hindu, Muslim, Christian, Sikh, Buddhist, Jain
--state <string> e.g. Maharashtra, Tamil Nadu, Punjab
--gender <gender> male, female, other
--caste <string> e.g. Brahmin, Maratha, Jat
--socialCategory <cat> SC, ST, OBC, General
--areaType <type> urban, rural
--minAge <n> Minimum age (0โ€“100)
--maxAge <n> Maximum age (0โ€“100)
--education <level> illiterate, primary, secondary, graduate, etc.
--occupation <sector> cultivator, other_worker, non_worker, etc.
--maritalStatus <status> never_married, married, widowed, etc.

Enrichment Layers (Progressive Depth)

Flag Description
--enrich Enable ALL enrichment layers (outcomes + narrative:all + persona)
--outcomes [Layer 2] Add credit score, health risk, employment outcome, education attainment
--bias <0-1> Bias dial for outcome simulation. 0.0 = pure meritocracy, 1.0 = max historical discrimination. Default: 0.3
--narrative <type> [Layer 3] Generate realistic Indian text documents. Repeat for multiple types: loan_application, medical_consultation, school_enrollment, ration_card_application, hinglish_conversation, all
--persona [Layer 4] Generate LLM-ready agent persona (system prompt, beliefs, memory seeds)

Quick Examples

# 1000 profiles as CSV
indian-fakedata -c 1000 -f csv -o profiles.csv

# 50K Tamil Nadu Hindus as JSONL
indian-fakedata -c 50000 -f jsonl -o tn_data.jsonl --state "Tamil Nadu" --religion Hindu

# All enrichment layers with moderate bias
indian-fakedata -c 100 --enrich --bias 0.3 -f jsonl -o enriched.jsonl

# SC community fairness audit
indian-fakedata -c 5000 --outcomes --bias 0.5 --socialCategory SC -f jsonl -o sc_bias.jsonl
Enter fullscreen mode Exit fullscreen mode

Programmatic API

Node.js / TypeScript

import { generate, generateEnriched } from '@abhay557/indian-fakedata';

const profiles = generate({ count: 10 });
const enriched = generateEnriched({ count: 5, includeOutcomes: true });
Enter fullscreen mode Exit fullscreen mode

Python

from indian_fakedata import generate, generate_enriched

profiles = generate(count=10)
enriched = generate_enriched(count=5, include_outcomes=True)
Enter fullscreen mode Exit fullscreen mode

Data Sources & Real-World Accuracy

Every demographic profile, name distribution, and asset weighting is calibrated against public survey data:

  1. Census of India 2011 (D-Series & C-Series Tables): Core distributions for religion, state-by-state population metrics, and mother tongue frequencies.
  2. National Family Health Survey (NFHS-5): State-wise dietary preferences, BMI, blood groups, height/weight by age.
  3. MSME Census: Community-level occupational sectors, vocational rates, industry divisions.
  4. UIDAI & RTO Records: Structural syntax for Aadhaar, Voter ID, PAN, IFSC, and RTO registrations.
  5. CSDS/Lokniti Election Studies: Political leanings and religiosity index biases.

Top comments (0)