Skip to content
Sidharth1743Public

About

A Synthetic Data Generation pipeline that generates a high-quality, multilingual (22 Indic + English) synthetic clinical-document dataset with inline PII/PHI surrogate annotations, curates & deduplicates it, formats it for GLiNER, and proves quality via intrinsic metrics + a downstream GLiNER fine-tuning learning curve.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

IndicPHI

IndicPHI is a reproducible synthetic clinical data pipeline for Indic-language PHI/PII de-identification. It generates multilingual synthetic clinical documents across 23 languages (22 official Indian languages plus English), annotates inline PHI/PII surrogates, audits them with an LLM judge plus deterministic validators, curates them with NeMo Curator, and exports GLiNER-ready span labels with a persona-held-out train/eval split.

If you are searching for Indic synthetic dataset, Indian clinical NER, multilingual PHI de-identification, synthetic health records for Indian languages, Aadhaar-safe clinical data, or GLiNER training data for Indic languages, this repository is built for that problem.

Why this exists

Real Indian clinical text cannot be freely shared (DPDP). We synthesize realistic clinical docs across Indic languages, seeded by nvidia/Nemotron-Personas-India, with checksum-valid surrogates and a fail-closed audit loop.

What this repository provides

  • Synthetic Indian clinical documents across 23 languages
  • Inline PHI/PII surrogate tags such as [[TYPE|value]]
  • Deterministic validation for identifiers like Aadhaar and phone numbers
  • NeMo Curator-based deduplication and balancing
  • GLiNER-ready training and evaluation exports
  • Timestamped run folders with manifest.json, pipeline.resolved.yaml, and failures.md

Pipeline overview

End-to-end flow from Nemotron personas through generation, audit/repair, and curation to a GLiNER train/eval set. Green-bordered stages use NVIDIA tooling; orange loops mark in-stage repair.

IndicPHI pipeline flowchart

Pipeline stages (S1-S10)

Stage Role Module
S1 Seeded hash-rank persona sampling + demographics audit main/designers/persona_sampler.py
S2 Taxonomy 14 doc types x 7 domains main/designers/taxonomy.py
S2b Persona clinical summary (Sarvam-30B, row-checkpointed) main/designers/persona_summarizer.py
S3 Prompt construction + entity profiles main/designers/prompt_builder.py
S4 NeMo Data Designer generation (Sarvam-105B) + tag/stuffing repair main/pipeline/designer_config.py
S4b Tag-preserving translation + script repair main/designers/translator.py
S5 Linguistic judge (Grok-4.3 / Azure Foundry, checkpointed) main/designers/linguistic_judge.py
S6 Deterministic auditor (checksums, PHI residue, DICS) main/designers/deterministic_auditor.py
S7-S8 NeMo Curator fuzzy dedup + semantic pass + balance main/pipeline/curate.py
S9 GLiNER format + intrinsic metrics main/pipeline/gliner_format.py
S10 Persona-held-out train/eval split main/pipeline/split.py

Agent entrypoints are summarized under main/agents/.

Taxonomy

Each persona is assigned a cell in a 14 document types × 7 clinical domains grid. Eligibility gates block impossible combinations (for example, maternal delivery notes for male personas).

14 document types

14 clinical document types

7 clinical domains

7 clinical domains

Model selection

Roles were assigned from a multi-task benchmark (accuracy and invalid-output rate). Grok-4.3 is the linguistic judge (0% invalid outputs). Sarvam-105B is the generator/translator. Sarvam-30B is limited to persona summarization because of higher invalid-output rates on structural tasks.

Model benchmarks used for role selection

Requirements

  • Python >=3.12
  • uv
  • API credentials for:
    • SARVAM_API_KEY
    • AZURE_FOUNDRY_API_KEY
  • Access to the required NVIDIA tooling used by the configs in this repo:
    • NeMo Data Designer
    • NeMo Curator
    • nvidia/Nemotron-Personas-India

Reproducible Quickstart

# 1) Create env file with required keys
cp configs/nim.env.example .env

# 2) Install dependencies
uv sync

# 3) Run a small smoke pipeline
./scripts/smoke_test.sh

# 4) Print the latest run/report locations
./scripts/run_demo.sh --no-run

Populate .env with at least SARVAM_API_KEY and AZURE_FOUNDRY_API_KEY before running generation.

New runs write to data/generated/runs/<timestamp>/. Each run records:

  • pipeline.resolved.yaml for the exact resolved config
  • manifest.json for run metadata
  • failures.md for rejected or repaired records

Common Run Commands

# Default smoke run: about 10 docs across 10 languages
./scripts/smoke_test.sh

# Medium smoke run: about 20 docs
./scripts/smoke_test.sh configs/synthetic-data/pipeline.smoke.medium.yaml

# Diversity run: 23 languages, about 69 docs
python -m main.pipeline.run_pipeline \
  --config configs/synthetic-data/pipeline.diversity.yaml

Pipeline demo UI (live + replay)

FastAPI backend for the IndicPHI presentation UI (main/ui_api/):

# Terminal 1 - API on http://127.0.0.1:8765
./scripts/run_ui.sh

# Terminal 2 - Vite UI (when ui/ is present)
cd ui && npm install && npm run dev
  • Replay: POST /api/replay/{run_id} builds a ~40s event timeline from an existing folder under data/generated/runs/. No API keys required.
  • Live smoke: POST /api/runs with {num_docs, language_codes} writes a temporary YAML overlay on pipeline.smoke.yaml and runs the orchestrator in a background thread. Progress is available via GET /api/runs/{id} or /api/runs/{id}/stream. This requires .env.

Configs: configs/synthetic-data/pipeline.yaml (full), pipeline.smoke.yaml (10 docs), pipeline.smoke.medium.yaml (20 docs), pipeline.diversity.yaml (23 languages, about 69 docs).

Persona seed shard: data/nemotron-personas-india/ (nvidia/Nemotron-Personas-India local parquet).

NVIDIA tooling (required)

  • NeMo Data Designer (S4): required engine (generation.engine: data_designer). No silent Sarvam-HTTP bypass around Designer. Post-gen repair for missing tags / stuffing via generator (main/designers/repair.py).
  • NeMo Curator (S7): required backend (curation.dedup.backend: nemo_curator). cpu_minhash is disabled. Semantic near-dup runs after Curator on English-pivot / PHI-masked text.
  • Personas: nvidia/Nemotron-Personas-India.
  • Sarvam-105B: generation + translation across 22 official Indian languages plus English

Repository Layout

.
  README.md  LICENSE  .gitignore
  docs/           architecture, demo-script, evaluation-plan, blog, planning
  main/           agents/ + designers + pipeline + entities + llm + validators
  configs/        nim.env.example + training + synthetic-data
  data/
    samples/                 stage previews
    eval/                    gold/eval placeholders
    nemotron-personas-india/ persona seed shard for S1
  scripts/        smoke_test.sh + run_demo.sh + helpers
  results/
    runs/         packaged run folders (s1-s10 artifacts)
    logs/         smoke console logs
    audits/       failures_*.md quick views
    eval_report.md
    screenshots/

No notebooks/ directory is used.

Reproducibility Notes

  • The orchestrator is config-driven; the exact config used for a run is saved in each run directory.
  • Stage outputs are checkpointed so interrupted runs can be resumed.
  • Validation is fail-closed: invalid checksum, residue, or structural issues are not silently accepted.
  • The smoke config is the easiest way to verify your setup before attempting the 23-language diversity run.

Troubleshooting

  • If ./scripts/smoke_test.sh cannot find a virtualenv, it falls back to python3.
  • If .env is missing, ./scripts/run_demo.sh warns and only works if keys are already exported in your shell.
  • If a run fails mid-pipeline, inspect data/generated/runs/latest/ and failures.md first.
  • Use results/README.md and results/eval_report.md for packaged evidence and expected output examples.

Further Reading

License

MIT - see LICENSE.

About

A Synthetic Data Generation pipeline that generates a high-quality, multilingual (22 Indic + English) synthetic clinical-document dataset with inline PII/PHI surrogate annotations, curates & deduplicates it, formats it for GLiNER, and proves quality via intrinsic metrics + a downstream GLiNER fine-tuning learning curve.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages