building-gold-corpus
できること
このスキルは、正解付きの注釈プロジェクトを設定します。正解とは、モデルを測るために人が手でラベルを付けたテスト例のことです。ラベル、ガイドライン、注釈ツールの設定、重ならない訓練・検証・テストの分割を扱います。モデルを正しく測る必要があるチーム向けです。
使う場面
- ✓臨床NERや匿名化モデルを測るテスト例が必要なとき。
- ✓注釈の取り組みを始め、ラベルの体系とガイドラインが必要なとき。
- ✓コミットしてCIで確認できる、小さな合成のテストセットがほしいとき。
スキルのリンク
https://github.com/maziyarpanahi/openmed/blob/master/skills/building-gold-corpus/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“匿名化モデルを測るために、ラベルの体系、ガイドライン、テスト用の分割を含む注釈プロジェクトを設定してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントはラベルのスキーマとガイドラインを定義し、注釈ツールの形式を設定します。そして、訓練、検証、テストの分割を、重なりがないように作ります。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Building a Gold Corpus
You can't evaluate what you can't measure against. This skill scaffolds a gold-standard annotation project whose output drops straight into the OpenMed eval harness as fixtures. The hard rule: anything committed to the repo is synthetic. Licensed clinical corpora (i2b2, n2c2, MIMIC) are DUA-gated — use them at eval time from the user's own copy, never check them in.
When to use this skill
- You need eval fixtures for
benchmarking-clinical-nerorevaluating-with-leakage-gatesand have none. - You're standing up an annotation effort: schema, guidelines, tool config.
- You need disciplined train/dev/test splits with no leakage between them.
- You want a small synthetic golden set you can commit and gate on in CI.
The OpenMed fixture shape (your target output)
Annotations must serialize to character-offset spans the harness understands:
{
"fixtures": [
{
"id": "synthetic-0001",
"language": "en",
"text": "Ms. Jane Roe (MRN 0000000) seen 2099-01-02 for type 2 diabetes.",
"gold_spans": [
{"start": 4, "end": 12, "label": "PERSON"},
{"start": 18, "end": 25, "label": "ID_NUM"},
{"start": 32, "end": 42, "label": "DATE"},
{"start": 47, "end": 62, "label": "DISEASE"}
]
}
]
}
openmed.eval.harness.load_fixtures accepts a top-level list or a {"fixtures": [...]} mapping. Offsets are character indices into text; labels are
OpenMed-canonical.
Quick start — scaffold the project
eval/
gold/
guidelines.md # annotation manual + edge-case decisions
label_schema.json # canonical labels + definitions + examples
synthetic/ # COMMITTED synthetic fixtures (CI-gateable)
train.json
dev.json
test.json
external/ # GITIGNORED: licensed DUA corpora, eval-only
.gitignore # * (never commit i2b2/n2c2/MIMIC)
Verify your synthetic fixtures load and validate spans before you trust them:
from openmed.eval.harness import load_fixtures
fixtures = load_fixtures("eval/gold/synthetic/test.json")
print(len(fixtures), "fixtures;", sum(len(f.gold_spans) for f in fixtures), "spans")
# load_fixtures normalizes spans against source text and rejects duplicate ids.
Workflow
- Define the label schema. Reuse OpenMed canonical labels (PERSON, DATE, ID_NUM, EMAIL, PHONE, DISEASE, DRUG, ...). Each label gets a one-line definition, in/out examples, and a boundary rule (include titles? trailing punctuation?).
- Write annotation guidelines. The manual is the contract: span boundaries, nested/overlapping policy, ambiguous cases, and a decision log appended as real cases force calls. Vague guidelines → low agreement → unusable gold.
- Generate synthetic source text. Compose realistic clinical narratives with fabricated identifiers (Faker-style names, impossible dates like 2099-, all-zero MRNs). Never paste real notes into committed data.
- Configure the tool. BRAT uses
annotation.conf(entity types) producing.annstandoff; Label Studio uses a labeling-config XML producing JSON. Map either back to the fixture shape above. - Double-annotate and measure agreement. Have ≥2 annotators on an overlap set; compute span-level inter-annotator agreement (F1 or Cohen's κ). Adjudicate disagreements and fold the resolutions into the decision log.
- Split with discipline. Partition by document/patient, not by sentence, so no patient appears in two splits. Freeze test; never tune on it.
- Validate and commit. Run
load_fixtures; confirm spans align and ids are unique. Commit only the synthetic splits.
Hand-off to / from OpenMed
- To
benchmarking-clinical-ner: dev/test fixtures feedrun_suiteanderror_reportfor the NER scorecard. - To
evaluating-with-leakage-gatesandgating-deid-leakage: the synthetic held-out set is exactly what the release gates and the CI gate run against. - To
building-with-openmed: synthetic notes can be generated by running surrogate replacement throughopenmed.deidentify(method="replace"). - Pairs with
auditing-subgroup-fairness: tag each gold span with agroupinmetadatasofairness_reportcan slice by demographic surrogate.
Edge cases & gotchas
- Committed = synthetic. No exceptions. Real PHI in the repo is a breach even if the repo is private. G
よくある質問
実際の患者の記録をコミットできますか?
いいえ。リポジトリにコミットするものは合成データに限ります。ライセンスのある臨床コーパスは、利用者自身のコピーからのみ使います。
注釈はどの形式で保存されますか?
評価ツールが読める文字オフセットのスパンとして保存されます。
なぜ分割を分けるのですか?
分割を分けておくと、訓練とテストの間で情報が漏れず、スコアが正直なままになります。
詳細
作者による元の説明
Scaffold a synthetic gold-standard annotation project for evaluating OpenMed NER and de-identification models — label schema, annotation guidelines, BRAT or Label Studio config, and disjoint train/dev/test splits. Use when the user wants to create eval fixtures, set up annotation, define a label set, write guidelines, configure an annotation tool, or build a held-out gold set for the OpenMed eval harness. Trigger on \"gold corpus\", \"annotation project\", \"label schema\", \"annotation guidelines\", \"BRAT\", \"Label Studio\", \"train dev test split\", or \"build eval fixtures\" for OpenMed.
repo: maziyarpanahi/openmed
人気
- GitHubのスター
- 5.8k
- ランキング
- #14678
- ライセンス
- Apache-2.0
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
annotating-variants
5.8kエージェントが、無料の公開アノテーターを使って、遺伝子バリアントの作用を予測し、HGVS名をゲノム上の位置に変換し、集団の頻度を付与できるよう支援します。
ask-openmed
5.8kエージェントが、臨床テキストの依頼に合ったOpenMedのワークフローを選べるよう支援します。患者データが含まれる可能性がある場合は、必ずプライバシーの確認から始めます。
assembling-fhir-bundles
5.8kエージェントが、複数のFHIR健康記録を、内部の参照を正しくつないだ一つのトランザクションBundleにまとめ、EHRに送れる状態にします。
auditing-deid-leakage
5.8kエージェントが、匿名化済みの臨床テキストに残っている識別子(SSN、カード番号、メール、日付など)をスキャンし、残っていれば公開を止めます。
似ているスキル
gitcrawl
394k保存されたGitHubのイシューとプルリクエストのアーカイブを検索し、重複をまとめ、GitHub上の現在の状態を確認するようエージェントを支援します。
slacrawl
394kローカルのSlackアーカイブ内のメッセージを検索して件数を数え、アーカイブの新しさを確認し、必要に応じて更新するようエージェントを支援します。
goplaces
394kGoogle Placesを使って、場所を検索し、詳細や口コミを取得し、場所の名前を解決するようエージェントを支援します。スクリプト用にJSON出力もできます。