gating-deid-leakage
ما الذي تفعله
تضيف هذه المهارة فحصاً آلياً إلى خط البناء، يفشل عندما يفوّت نموذج إزالة الهوية معرّفات كثيرة أو يسرّب معرّفاً حرجاً. وهي موجهة للفرق التي تريد اختبار كل تغيير مقابل مجموعة اختبار محجوزة من تفاصيل مرضى اصطناعية.
متى تستخدمها
- ✓عندما تريد اختباراً يُفشل البناء إذا نزل استرجاع إزالة الهوية عن حد أدنى.
- ✓عندما تحتاج إلى منع طلبات الدمج التي تسمح بتسرب معرّف شخصي.
- ✓عندما تريد فرض بوابات الإصدار تلقائياً في خط CI.
رابط المهارة
https://github.com/maziyarpanahi/openmed/blob/master/skills/gating-deid-leakage/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“أضف إلى خط CI عندنا اختباراً يُفشل البناء إذا نزل الاسترجاع على مجموعة PHI الاصطناعية عن 99 بالمئة، أو تسرب أي رقم ضمان اجتماعي.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
يكتب وكيلك اختباراً يشغّل التقييم على مجموعة اصطناعية محفوظة في المستودع، ويفحص حد الاسترجاع وصفر التسرب الحرج، ويعيد حالة فشل إذا لم يتحقق أي منهما.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من GitHub.
Gating De-id Leakage in CI
Logs, baselines, and models drift. The only durable defense is a gate that runs on every change and fails closed when de-identification regresses. This skill operationalizes OpenMed's leakage-first ethos into a CI check: recall must stay above the floor and critical leakage must be exactly zero, or the build goes red.
When to use this skill
- You want a pytest test or CLI step that exits nonzero on de-id regression.
- You need to block PRs that drop PHI recall or introduce a leak.
- You want OpenMed's release gates (
ReleaseGate, G1a–G8) enforced in CI. - You maintain a synthetic held-out PHI set and want it checked automatically.
For the full gate semantics see evaluating-with-leakage-gates; this skill is
about wiring it into CI so it fails the build.
Quick start — a pytest gate
# tests/eval/test_deid_leakage_gate.py
import pytest
from openmed.eval import run_suite, ReleaseGate, RELEASABLE
RECALL_FLOOR = 0.99 # direct-identifier recall floor
HELD_OUT = "eval/heldout/phi_synthetic.json" # SYNTHETIC, committed
@pytest.fixture(scope="module")
def gate_report():
report = run_suite(
HELD_OUT,
suite="golden",
model_name="OpenMed/Privacy-PII-Detection",
device="cpu",
metadata={"family": "PII", "tier": "base", "policy": "hipaa_safe_harbor"},
)
return ReleaseGate(milestone="v1.6", policy="hipaa_safe_harbor").evaluate(report)
def test_no_critical_leakage(gate_report):
# Hard zero: one leaked SSN/credit-card is a breach, full stop.
assert gate_report.critical_leakage_count == 0, "critical PHI leaked"
def test_recall_floor(gate_report):
low = {
label: r
for label, r in gate_report.per_label_recall.items()
if r < RECALL_FLOOR
}
assert not low, f"recall below floor: {low}"
def test_releasable(gate_report):
# The structural decision: any failed gate -> QUARANTINED -> red build.
failed = [c.gate for c in gate_report.gate_results if not c.passed]
assert gate_report.decision == RELEASABLE, f"quarantined; failed gates: {failed}"
pytest exits nonzero on any failure, so CI turns red automatically.
Quick start — a CLI gate
The harness ships a main() that fails closed (exit 1 on quarantine):
# Produce a candidate report, then gate it. Nonzero exit blocks the job.
python -m openmed.eval.release_gates \
--candidate eval/out/candidate_report.json \
--baseline-store eval/baselines/last_green.json \
--milestone v1.6 --policy hipaa_safe_harbor \
--output release-gate-report.json
Exit codes: 0 RELEASABLE, 1 QUARANTINED, 2 evaluation error before a
report. CI should treat 1 and 2 as failures.
Wire it into GitHub Actions
# .github/workflows/deid-gate.yml
name: de-id leakage gate
on: [pull_request]
jobs:
gate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- run: uv pip install --system -e ".[hf]"
- name: Run de-id leakage gate
run: uv run pytest tests/eval/test_deid_leakage_gate.py -q
# The job fails (red) automatically if pytest exits nonzero.
Workflow
- Curate a synthetic held-out PHI set and commit it (offsets + labels, no
real patient text). Use
building-gold-corpus. It must be disjoint from any calibration/training data. - Pick the floor from policy. Don't hardcode a magic number you invented —
align to the gate's published floors (
G1A_V16_RECALL_FLOORetc. inopenmed.eval.release_gates) and the active policy profile. - Run the suite → gate the report (pytest fixture above).
- Assert two invariants:
critical_leakage_count == 0and per-label recall ≥ floor. Optionally assertdecision == RELEASABLEfor the full G1a–G8 check. - Make it required. Mark the job a required status check so a red gate blocks merge — a passing-but-not-required gate protects nothing.
- On failure, the harness CLI can open/refresh a tracking issue
(
--issue-on-failure) so the regression is visible, not silently retried.
Hand-off to / from OpenMed
- From
evaluating-with-leakage-gates: this skill is the CI wrapper around the sameReleaseGate.evaluate(...)call — reuse its gate semantics. - From
building-gold-corpus: supplies the synthetic held-out fixtures the gate runs against. - To
authoring-model-cards: a green gate'sGateReportis the
الأسئلة الشائعة
هل تستخدم بيانات مرضى حقيقية؟
لا. يستخدم الفحص مجموعة اصطناعية محجوزة محفوظة في المستودع.
هل هي نفس مهارة التقييم؟
لا. تشرح مهارة التقييم البوابات، أما هذه فتدمجها في CI حتى يفشل البناء.
أي أنظمة CI تناسبها؟
تغطي الإرشادات اختبارات pytest وخطوات سطر الأوامر، بما فيها GitHub Actions.
التفاصيل
الوصف الأصلي من المؤلف
Add a CI gate that fails the build when an OpenMed de-identification model's recall on a held-out PHI set drops below threshold or any critical identifier leaks. Use when the user wants a pytest test or CLI step that exits nonzero on de-id regression, wants to wire OpenMed's leakage-first release gates into GitHub Actions / CI, needs a recall floor plus zero-leakage assertion against a synthetic held-out set, or wants to block merges that weaken de-identification. Trigger on \"CI gate\", \"fail the build\", \"regression test\", \"de-id recall threshold\", \"block the merge\", \"exit nonzero\",
repo: maziyarpanahi/openmed
الشعبية
- نجوم GitHub
- 5.8k
- الترتيب
- #14705
- الترخيص
- Apache-2.0
- آخر تحديث
- 2/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يفحص النصوص السريرية التي أُزيلت هويتها بحثًا عن معرّفات متبقية، مثل أرقام الضمان الاجتماعي وأرقام البطاقات والبريد الإلكتروني والتواريخ، ويوقف النشر إذا بقي أي منها.
مهارات مشابهة
test-driven-development
311kيعلّم وكيلك كتابة اختبار فاشل أولًا، ثم رؤيته يفشل، ثم كتابة أصغر شيفرة تنجحه، قبل بناء أي ميزة أو إصلاح.
verification-before-completion
311kيعلّم وكيلك تشغيل فحوصات حقيقية وقراءة نتائجها قبل أن يقول إن المهمة أو الإصلاح أو البناء مكتمل أو ناجح.
migrate-to-shoehorn
310kيستبدل تأكيدات النوع الخطرة في ملفات الاختبار بمكتبة shoehorn، حتى تتمكن الاختبارات من استخدام بيانات جزئية وتجتاز فحوص الأنواع.