Skip to content

Synthetic section-label training-data builder for the DocType/Section family #1826

Description

@maziyarpanahi

Summary

Epic OM-052 needs assembled training data for the DocType/Section model family before any training run, but the only synthetic generator today is training/synthetic/locale_phi.py for PHI. This sub-task adds a synthetic section-label corpus builder that emits token-classification examples (BIO section-boundary tags + a note-type label) from templated clinical notes, producing a leakage-checked JSONL dataset the recipe can consume. Actual GPU training is out of scope.

Scope

  • Add openmed/training/synthetic/section_labels.py generating templated notes with gold section boundaries (from clinical/sections.py canonical labels) and note-type labels.
  • Emit BIO-style section-boundary token tags plus a document-type label per example as JSONL, matching the corpus.py record contract.
  • Support a reproducible seed so a fixed seed yields byte-identical output; expose a build_section_dataset(seed, n) entrypoint.
  • Run a leakage check that no example text overlaps the synthetic eval fixtures (leakage-first) and stamp a dataset manifest.
  • Ensure only synthetic/public content is generated; DUA corpora are eval-only and never written to disk here.
  • Add unit tests for determinism, label validity against canonical section labels, and the leakage assertion.

Acceptance criteria

  • build_section_dataset(seed, n) writes JSONL with per-token section BIO tags and a document-type label per example.
  • A fixed seed produces byte-identical output across two runs (determinism unit-tested).
  • Every emitted section label is a member of the canonical section label set; invalid labels raise.
  • A leakage check asserts zero text overlap between generated data and the synthetic section eval fixtures.
  • New unit tests pass with .venv/bin/python -m pytest tests/unit/training/ -q.
  • No DUA or non-synthetic text is written; the builder is offline and deterministic.

Out of scope

  • R
  • u
  • n
  • n
  • i
  • n
  • g
  • G
  • P
  • U
  • t
  • r
  • a
  • i
  • n
  • i
  • n
  • g
  • ;
  • t
  • h
  • e
  • t
  • r
  • a
  • i
  • n
  • i
  • n
  • g
  • c
  • o
  • n
  • f
  • i
  • g
  • /
  • h
  • a
  • r
  • n
  • e
  • s
  • s
  • (
  • s
  • e
  • p
  • a
  • r
  • a
  • t
  • e
  • s
  • u
  • b
  • t
  • a
  • s
  • k
  • )
  • ;
  • t
  • h
  • e
  • a
  • c
  • t
  • u
  • a
  • l
  • D
  • o
  • c
  • T
  • y
  • p
  • e
  • /
  • S
  • e
  • c
  • t
  • i
  • o
  • n
  • c
  • h
  • e
  • c
  • k
  • p
  • o
  • i
  • n
  • t
  • a
  • n
  • d
  • i
  • t
  • s
  • g
  • a
  • t
  • e
  • s
  • ;
  • R
  • e
  • l
  • E
  • x
  • /
  • L
  • i
  • n
  • k
  • f
  • a
  • m
  • i
  • l
  • i
  • e
  • s
  • .

Files

  • openmed/training/synthetic/section_labels.py
  • openmed/training/corpus.py
  • tests/unit/training/test_synthetic_section_labels.py

Task: OM-818 · Milestone: v2.2 · Priority: P1 · Size: M
Depends on: OM-052 · Blocks: OM-819
Roadmap: v2.2 trustworthy clinical data exchange follow-on wave
Spec: PLANS/V2/EXECUTION/tasks/OM-818.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1HighfeatureNew capabilityroadmap-v2OpenMed V2 roadmap backlog

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions