annotating-variants
Annotates VCF variants and normalizes HGVS nomenclature with public, license-free annotators (Ensembl VEP REST,…
Audit an OpenMed NER or de-identification model for performance disparities across demographic subgroups (sex, age band, race/ethnicity when available) using openmed.eval.fairness_report. Use when the user wants per-subgroup recall and leakage, wants to check whether
Claude Code
$ npx -y skills add maziyarpanahi/openmed --skill auditing-subgroup-fairness --agent claude-code
Codex
$ npx skills add maziyarpanahi/openmed --skill auditing-subgroup-fairness -a codex -y
Cursor
$ npx skills add maziyarpanahi/openmed --skill auditing-subgroup-fairness -a cursor -y
Gemini CLI
$ npx skills add maziyarpanahi/openmed --skill auditing-subgroup-fairness -a gemini-cli -y
GitHub Copilot
$ npx skills add maziyarpanahi/openmed --skill auditing-subgroup-fairness -a github-copilot -y
OpenCode
$ npx skills add maziyarpanahi/openmed --skill auditing-subgroup-fairness -a opencode -y
Windsurf
$ npx skills add maziyarpanahi/openmed --skill auditing-subgroup-fairness -a windsurf -y
name: auditing-subgroup-fairness description: "Audit an OpenMed NER or de-identification model for performance disparities across demographic subgroups (sex, age band, race/ethnicity when available) using openmed.eval.fairness_report. Use when the user wants per-subgroup recall and leakage, wants to check whether de-identification under-protects a group, wants to surface a documentation gap where subgroup data is missing, or needs equalized-odds-style disparity numbers for a clinical model. Trigger on \"fairness\", \"subgroup\", \"bias audit\", \"disparity\", \"equalized odds\", \"under-protected group\", \"per-group recall\", or \"STANDING Together\" for an OpenMed model." license: Apache-2.0 metadata: project: OpenMed category: evaluation-quality pairs: adjacent version: "1.0"
An aggregate pass can hide a group the model fails. For de-identification that failure has a name: **under-protection** — PHI that leaks more often for one demographic group than another. `openmed.eval.fairness_report` slices leakage and recall by gold-span group so disparities surface before deployment, not after a breach.
For each surrogate group `fairness_report` returns:
(the de-id harm metric).
Group membership comes from a `group` tag in each gold span's `metadata` (keys `group`, `demographic_group`, or `surrogate_group`); ungrouped spans fall into `unspecified`.
from openmed.eval import fairness_report
# Gold fixtures must tag spans with a surrogate group, e.g.
# {"start": 4, "end": 12, "label": "PERSON", "metadata": {"group": "female"}}
fair = fairness_report(
"OpenMed/Privacy-PII-Detection",
"golden", # named suite, or pass a list of fixtures
device="cpu",
)
print("leakage disparity:", fair.leakage_disparity)
print("worst group :", fair.worst_group, fair.worst_group_leakage)
for group, m in sorted(fair.per_group.items()):
print(f" {group:14s} recall={m.recall:.3f} leakage={m.leakage_rate:.4f}")
# Under-protection alarm: any group leaking more than the rest.
LEAKAGE_GAP_LIMIT = 0.0 # leakage-first: ideally zero leakage everywhere
assert fair.leakage_disparity <= LEAKAGE_GAP_LIMIT or fair.worst_group_leakage == 0`FairnessReport.to_dict()` is JSON-ready and PHI-free — drop it straight into a model card.
1. **Tag the gold corpus by group.** Add a synthetic `group` to each PHI span's `metadata` (sex, age band, race/ethnicity surrogate). Use synthetic surrogates, not real protected attributes (see `building-gold-corpus`). 2. **Run `fairness_report`** on the model + suite. 3. **Read leakage first, recall second.** For de-id, a group with higher leakage is under-protected — that is the headline finding. 4. **Compute the disparity** (`leakage_disparity`) and locate `worst_group`. Equalized-odds framing: equal true-positive (recall) *and* equal leakage across groups. 5. **Document the gap.** If race/ethnicity surrogates are absent, report that the audit could not cover them — most clinical NLP studies omit race entirely, so silence is the default failure mode, not equity. 6. **Feed it forward.** Put per-group numbers and the gap into the model card and the governance review.
should be paired with this audit — overall pass, subgroup fail is exactly the trap this catches.
quantitative-analysis / subgroup section.
group).
recall but higher leakage is still failed.
record race/ethnicity, so most fairness audits silently can't measure it. Report the absence explicitly — don't let missing data read as parity.
your gold isn't tagged; fix the corpus before trusting the disparity.
`total_chars`) alongside rates; a 1-of-2 leak isn't a 50% population rate.
fixtures; use fabricated group labels for slicing.
still failure — check absolute leakage, not just the gap.
documentation: https://www.datadiversity.org/
(equalized odds): https://arxiv.org/abs/1610.02413
https://doi.org/10.1146/annurev-biodatasci-092820-114757
(`fairness_report`, `FairnessReport`, `FairnessGroupMetrics`).
Local-first healthcare AI: clinical NER and HIPAA PII de-identification on hardware you control. 2,200+ medical models, 35 model-backed PII languages, and Python, MLX, Android and browser runtimes. Apache-2.0 SDK.
Annotates VCF variants and normalizes HGVS nomenclature with public, license-free annotators (Ensembl VEP REST,…
Choose the first OpenMed workflow skill for an intake, privacy, extraction, exchange, or verification request using deterministic…
Package multiple FHIR R4 resources produced from OpenMed output into a single valid transaction Bundle ready to POST to an EHR,…
Adversarially scan already-de-identified clinical text for residual identifiers and emit a leakage report that blocks release on…
Produce a signed, reproducible, no-PHI audit trail for an OpenMed de-identification run via deidentify(audit=True). Use when the…
Generates and verifies 21 CFR Part 11-style audit trails — who/what/when, electronic signatures, and tamper-evidence — for…
Use for authorized security assessment of REST, GraphQL, WebSocket, or SOAP APIs, including discovery, authentication,…
Extract and decrypt Windows DPAPI-protected secrets (Credential Manager, browser logins/cookies, Wi-Fi credentials, KeePass keys)…
Clean and finalize authorized natural-language text intended for readers by auditing suspicious invisible Unicode and rewriting…