building-gold-corpus
Что он делает
Этот скилл настраивает проект эталонной разметки, то есть набор вручную размеченных тестовых примеров для измерения модели. Он охватывает метки, инструкции, настройку инструмента разметки и отдельные наборы train, dev и test. Он нужен командам, которым нужно правильно измерять свои модели.
Когда использовать
- ✓Когда вам нужны тестовые примеры для измерения модели клинического NER или обезличивания.
- ✓Когда вы начинаете разметку и вам нужны набор меток и инструкции.
- ✓Когда вам нужен небольшой синтетический тестовый набор, который можно сохранить в репозитории и проверять в CI.
Ссылка на скилл
https://github.com/maziyarpanahi/openmed/blob/master/skills/building-gold-corpus/SKILL.mdСкопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.
Как использовать
Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.
Готовое сообщение для вставки
Для Claude Code, Codex или Cursor: запустите в папке проекта, и скилл установится.
Скачайте SKILL.md и положите его в папку скиллов вашего агента.
Пример запроса к вашему ИИ
“Помоги настроить проект разметки с набором меток, инструкциями и тестовой выборкой для измерения нашей модели обезличивания.”
5 новых скиллов в неделю. 1 минута чтения.
Как это работает
Агент задаёт схему меток и инструкции, настраивает формат инструмента разметки и создаёт отдельные наборы train, dev и test без пересечений.
Технический текст (оригинальный 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
- Обновлён
- 02.11.2026
Комментарии
- …
Другие скиллы из этого репозитория
annotating-variants
5.8kПомогает агенту предсказать, что делает генетический вариант, перевести названия HGVS в позиции генома и добавить частоты в популяциях, с помощью бесплатных публичных аннотаторов.
ask-openmed
5.8kПомогает агенту выбрать правильный рабочий процесс OpenMed для запроса по клиническому тексту, начиная с проверки конфиденциальности, если могут быть данные пациентов.
assembling-fhir-bundles
5.8kУпаковывает несколько медицинских записей FHIR в один транзакционный Bundle, готовый к отправке в EHR, с правильно связанными внутренними ссылками.
auditing-deid-leakage
5.8kСканирует обезличенный клинический текст на остатки идентификаторов, например СНИЛС, номера карт, электронные адреса и даты, и блокирует выпуск, если что-то осталось.
Похожие скиллы
gitcrawl
394kПозволяет агенту искать в сохраненном архиве задач и запросов на слияние GitHub, объединять дубликаты и проверять их текущий статус на GitHub.
slacrawl
394kПозволяет агенту искать и считать сообщения в локальном архиве Slack, проверять его свежесть и при необходимости обновлять архив.
goplaces
394kПомогает агенту искать места, получать их подробности и отзывы и определять названия мест через Google Places, с выводом в JSON для скриптов.