Agent skill

Bridging Presidio And Spacy

by maziyarpanahi in maziyarpanahi/openmed

Combine OpenMed clinical NLP with Microsoft Presidio, spaCy, or LangChain through OpenMed's built-in interop adapter registry (openmed.interop).

Apache-2.0Auto-check passedAI & LLM Engineering

Install Bridging Presidio And Spacy

skills CLI
$ npx skills add maziyarpanahi/openmed --skill bridging-presidio-and-spacy -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install maziyarpanahi/openmed bridging-presidio-and-spacy --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/maziyarpanahi/openmed.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/bridging-presidio-and-spacy .claude/skills/bridging-presidio-and-spacy && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
bridging-presidio-and-spacy
GitHub stars
5.5k
Token cost
~2.2k tokens
SKILL.md length
586 words
Files
1
Skills in repo
74
Repo updated
First seen
Licence
Apache-2.0

At a glance

Combine OpenMed clinical NLP with Microsoft Presidio, spaCy, or LangChain through OpenMed's built-in interop adapter registry (openmed.interop).

  • The user wants to add Presidio recognizers
  • SKILL.md covers When to use, The lazy adapter registry…, Presidio bridge (verified… and spaCy bridge (verified factory), plus 4 more sections
  • Calls pip
  • Embed OpenMed PII detection in a spaCy pipeline

What it does

Bridging Presidio And Spacy is an agent skill from maziyarpanahi/openmed. Combine OpenMed clinical NLP with Microsoft Presidio, spaCy, or LangChain through OpenMed's built-in interop adapter registry (openmed.interop). Covers the lazy adapter registry (availableadapters, getadapter, adapterspec), the presidio/spacy/langchain pip extras, and the verified callables — Presidio tocanonical/fromcanonical/mergewithopenmed, the spaCy openmeddeid pipeline factory, and the LangChain createredactionrunnable. Use when the user wants to add Presidio recognizers, embed OpenMed PII detection in a…

Its SKILL.md is about 2.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in AI & LLM Engineering, covering Building AI agents and Natural language processing. It works with LangChain. The repository describes itself as: 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… The licence is Apache-2.0.

When your agent uses it

  • The user wants to add Presidio recognizers
  • Embed OpenMed PII detection in a spaCy pipeline
  • Use OpenMed de-identification as a LangChain runnable

Example prompts

  • “/bridging-presidio-and-spacy”

Requirements

  • Python 3

What it can do on your machine

Read from SKILL.md and the folder at commit 34d7b8c. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • pip

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • microsoft.github.io
    • spacy.io
    • python.langchain.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Bridging Presidio And Spacy loads about 2.2k tokens when it runs. Until then it costs about 167 tokens; SKILL.md has 586 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~167
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from maziyarpanahi/openmed at commit 34d7b8c, republished under its Apache-2.0 licence (© maziyarpanahi). 586 words, ~2,166 tokens.

Download SKILL.mdSave it as .claude/skills/bridging-presidio-and-spacy/SKILL.md (or your agent's skills folder).
name
bridging-presidio-and-spacy
description
Combine OpenMed clinical NLP with Microsoft Presidio, spaCy, or LangChain through OpenMed's built-in interop adapter registry (openmed.interop). Covers the lazy adapter registry (available_adapters, get_adapter, adapter_spec), the presidio/spacy/langchain pip extras, and the verified callables — Presidio to_canonical/from_canonical/merge_with_openmed, the spaCy openmed_deid pipeline factory, and the LangChain create_redaction_runnable. Use when the user wants to add Presidio recognizers, embed OpenMed PII detection in a spaCy pipeline, or use OpenMed de-identification as a LangChain runnable. Pairs adjacent to the OpenMed PII skills.
license
Apache-2.0
metadata.project
OpenMed
metadata.category
fhir-interop
metadata.pairs
adjacent
metadata.version
1.0

Bridging Presidio, spaCy & LangChain

OpenMed interoperates with the dominant PII/NLP ecosystems through a single, lazy adapter registry: openmed.interop. Adapters live behind explicit imports, so importing openmed never drags in Presidio, spaCy, or LangChain — each is an optional extra you install only when you need that bridge.

When to use

Reach for a bridge when:

  • you already run Microsoft Presidio and want OpenMed's clinical PII recall on top (or to feed OpenMed spans back into Presidio's anonymizer);
  • you have a spaCy pipeline and want OpenMed PII spans on the Doc;
  • you build LangChain chains and want to redact PHI before text reaches an LLM (the on-device guardrail in front of a cloud model);
  • you need OpenMed's de-identification reachable from an existing framework instead of rewriting the pipeline around openmed.deidentify.

The lazy adapter registry (verified)

python
import openmed.interop as interop

interop.available_adapters()
# ('cda', 'hl7v2', 'langchain', 'presidio', 'spacy')

spec = interop.adapter_spec("presidio")
# AdapterSpec(name='presidio', module='openmed.interop.presidio',
#             extra='presidio', description='Presidio RecognizerResult adapter')

mod = interop.get_adapter("presidio")        # imports openmed.interop.presidio
# Attribute access also works lazily:
openmed.interop.presidio                      # same module, imported on first touch

available_adapters() and adapter_spec() never import the adapter module, so they are safe to call for discovery even without the extra installed. get_adapter(name) (and attribute access) triggers the import — and the adapter's own optional dependency.

Install only the extra you need:

bash
pip install "openmed[presidio]"     # Presidio RecognizerResult adapter
pip install "openmed[spacy]"        # spaCy openmed_deid component
pip install "openmed[langchain]"    # LangChain redaction runnable
# cda and hl7v2 adapters ship in core (no extra) — see their own skills

Presidio bridge (verified callables)

Module openmed.interop.presidio converts between Presidio RecognizerResults and OpenMed canonical PIIEntitys, and merges both detectors through OpenMed's semantic-unit merger.

python
from openmed.interop.presidio import (
    to_canonical,        # RecognizerResult(s) -> [PIIEntity]
    from_canonical,      # [PIIEntity] -> [RecognizerResult]  (needs presidio extra)
    merge_with_openmed,  # combine OpenMed + Presidio spans, resolve overlaps
    PresidioAdapterConfig,
)
import openmed

text = "Dr. Smith called patient at 617-555-0123 on 2024-03-02."

# Presidio gives you RecognizerResults; OpenMed gives PIIEntities.
openmed_spans = openmed.extract_pii(text).entities
presidio_results = analyzer.analyze(text=text, language="en")   # your Presidio analyzer

merged = merge_with_openmed(
    openmed_spans, presidio_results, text=text,
    config=PresidioAdapterConfig(preserve_presidio_labels=True),
)
# -> de-duplicated [PIIEntity]; overlaps resolved by score, length, OpenMed-origin

Why merge instead of union: merge_with_openmed runs both detectors' spans through merge_entities_with_semantic_units, so overlapping/adjacent detections collapse into one correct span (e.g. PHONE from Presidio vs a partial OpenMed hit) rather than producing double redactions. Label mapping is built in (Presidio PHONE_NUMBER ↔ OpenMed PHONE, US_SSN ↔ SSN, etc.).

To push OpenMed spans into Presidio's anonymizer, convert back:

python
results = from_canonical(openmed_spans)        # [RecognizerResult]
anonymized = anonymizer.anonymize(text=text, analyzer_results=results)

spaCy bridge (verified factory)

Module openmed.interop.spacy_component registers a spaCy pipeline factory named openmed_deid. Add it to a pipeline and OpenMed PII spans land on the Doc.

python
import spacy
import openmed.interop.spacy_component   # registers the @Language.factory

nlp = spacy.blank("en")
nlp.add_pipe("openmed_deid", config={
    "confidence_threshold": 0.5,
    "lang": "en",
    "target": "openmed_pii",     # doc.spans key
    "merge_ents": False,         # set True to also write doc.ents
    "alignment_mode": "expand",  # char->token alignment: strict|contract|expand
})

doc = nlp("Patient John Doe, MRN 12345, seen today.")
for span in doc.spans["openmed_pii"]:
    print(span.label_, span.text)
# raw char-offset spans also available on doc._.openmed_pii

merge_ents=True writes the spans into doc.ents, resolving overlaps with spaCy's filter_spans. Use OpenMedDeidComponent / OpenMedDeidConfig directly if you construct the component outside add_pipe.

LangChain bridge (verified runnable)

Module openmed.interop.langchain exposes a Runnable-shaped redactor you drop in front of an LLM step so PHI never leaves the device.

python
from openmed.interop.langchain import (
    create_redaction_runnable, LangChainRedactionConfig,
)

redactor = create_redaction_runnable(
    config=LangChainRedactionConfig(method="mask", policy="hipaa_safe_harbor"),
    input_key="text",        # redact this key in a dict payload (optional)
    output_key="text",
)

chain = redactor | prompt | llm          # redact -> prompt -> model
chain.invoke({"text": "John Doe, MRN 12345, has type 2 diabetes."})

The transform redacts strings, LangChain Documents (page_content), lists, tuples, and mapping payloads. Use create_redaction_transform(...) for the dependency-light object (no langchain-core needed) and .as_runnable() when you want the RunnableLambda. LangChainRedactionConfig forwards the full openmed.deidentify surface (method, policy, confidence_threshold, keep_year, consistent, lang, ...).

Show full SKILL.md (224 more words)Show less

Hand-off to / from OpenMed

  • Into OpenMed: Presidio RecognizerResults and (implicitly) spaCy text become OpenMed PIIEntitys via the adapters; from there use the normal OpenMed de-id/audit/policy skills.
  • Out of OpenMed: from_canonical → Presidio anonymizer; the spaCy component → downstream spaCy components; the LangChain runnable → any chain.
  • The canonical object everywhere is openmed.core.pii.PIIEntity (text, label, confidence, start, end, entity_type, metadata).

Edge cases & gotchas

  • Discovery is free; import is not. Call available_adapters() / adapter_spec() to probe without installing the extra. Touching the module (get_adapter/attribute access) raises a clear ImportError telling you the extra to install if it is missing.
  • Offsets must match the same text. merge_with_openmed and the spaCy alignment both assume all spans index the same string. De-identify or normalise once, up front; do not mix offsets from pre- and post-normalised text.
  • alignment_mode="expand" (spaCy default here) snaps char spans out to token boundaries; use "strict" if you need exact char alignment and accept dropped spans that do not align.
  • LangChain redaction is a guardrail, not a guarantee. Gate de-id quality with openmed.eval leakage gates (evaluating-with-leakage-gates) before trusting it in front of a cloud LLM.
  • Local-first holds across bridges. OpenMed inference stays on-device; only your downstream LLM/cloud step (if any) leaves the machine — which is exactly why you redact first.

Standards & references

© maziyarpanahi, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/bridging-presidio-and-spacy of maziyarpanahi/openmed.

Open the folder on GitHubat commit 34d7b8c

Compare with similar skills

Bridging Presidio And Spacy next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Bridging Presidio And Spacy compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Bridging Presidio And Spacy this skillmaziyarpanahi/openmed5.5k—~2.2kAutomated safety check: PassApache-2.0
Agentsop Dspyagentsope/SkillAlchemy436—~7kAutomated safety check: PassMIT
Awesome Chatgpt Searchtaishi-i/awesome-ChatGPT-repositories3.3k—~3.8kAutomated safety check: PassCC0-1.0
LLM Developmentmeleantonio/ChernyCode516—~499Automated safety check: PassNone
Sentence Transformers EmbeddingsOrchestra-Research/AI-Research-SKILLs13k2 repos~1.6kAutomated safety check: PassMIT
Tool CreatorAgentTeam-TaichuAI/ScienceClaw671—~4.7kAutomated safety check: PassNone

Similar skills

  • Agentsop Dspy

    agentsope/SkillAlchemy

    Operating SOP for DSPy (Stanford NLP) — the declarative framework for "programming, not prompting" language models.

    436 GitHub stars~7k tokensUpdated 2 days ago
    AI & LLM EngineeringAuto-check passed
  • Awesome Chatgpt Search

    taishi-i/awesome-ChatGPT-repositories

    Search 2500+ curated ChatGPT and LLM open-source repositories.

    3.3k GitHub stars~3.8k tokensUpdated 2 days ago
    AI & LLM EngineeringAuto-check passed
  • LLM Development

    meleantonio/ChernyCode

    LLM and ML development best practices with LangChain and transformers.

    516 GitHub stars~499 tokensUpdated 1 mo ago
    AI & LLM EngineeringAuto-check passed
  • Sentence Transformers Embeddings

    Orchestra-Research/AI-Research-SKILLs

    Generates text embeddings locally with the sentence-transformers library for RAG, semantic search, clustering and similarity, with model picks for general, multilingual and legal text.

    13k GitHub starsUsed in 2 repos~1.6k tokens
    AI & LLM EngineeringAuto-check passed
  • Tool Creator

    AgentTeam-TaichuAI/ScienceClaw

    Create new tools or upgrade existing tools for the agent. An agent skill from AgentTeam-TaichuAI/ScienceClaw.

    671 GitHub stars~4.7k tokensUpdated 5 mo ago
    AI & LLM EngineeringAuto-check passed
  • Langchain Architecture

    HermeticOrmus/LibreUIUX-Claude-Code

    Design LLM applications using the LangChain framework with agents, memory, and tool integration patterns.

    112 GitHub starsUsed in 10 repos~2.5k tokens
    AI & LLM EngineeringAuto-check passed

More from maziyarpanahi/openmed

All 74 skills in this repo
  • Checks OpenMed de-identified clinical text against the 18 HIPAA Safe Harbor identifier categories and reports gaps and residual re-identification risk.

    5.5k GitHub stars~1.7k tokensUpdated today
    Auto-check passed
  • OpenMed Model Card Writer

    maziyarpanahi/openmed

    Fills in a model card for an OpenMed clinical NER or de-identification model from its evaluation reports: intended use, metrics, subgroups and limitations.

    5.5k GitHub stars~1.8k tokensUpdated today
    Auto-check passed
  • Walks a data pipeline against the HIPAA Privacy and Security Rule checklist and produces a gap report before it processes patient data.

    5.5k GitHub stars~2k tokensUpdated today
    Auto-check passed
  • ICD-10 Coding Assistant

    maziyarpanahi/openmed

    Suggests candidate ICD-10-CM diagnosis and ICD-10-PCS procedure codes for clinical text extracted by OpenMed, with rationale for a certified coder to review.

    5.5k GitHub stars~2k tokensUpdated today
    Auto-check passed
  • OpenMed ETL to OMOP CDM

    maziyarpanahi/openmed

    Maps OpenMed-extracted, terminology-coded conditions, drugs and measurements into OMOP CDM v5.4 tables for OHDSI and ATLAS analytics.

    5.5k GitHub stars~1.9k tokensUpdated today
    Auto-check passed
  • Extracting SDOH and Z-Codes

    maziyarpanahi/openmed

    Finds social risks such as housing instability or food insecurity in clinical notes and proposes matching ICD-10-CM Z-codes for a coder to confirm.

    5.5k GitHub stars~1.9k tokensUpdated today
    Auto-check passed

Works with

Questions about Bridging Presidio And Spacy

What does Bridging Presidio And Spacy do?

Combine OpenMed clinical NLP with Microsoft Presidio, spaCy, or LangChain through OpenMed's built-in interop adapter registry (openmed.interop). Bridging Presidio And Spacy is an agent skill from maziyarpanahi/openmed.interop).

When should I use Bridging Presidio And Spacy?

Bridging Presidio And Spacy fits situations like: the user wants to add Presidio recognizers; embed OpenMed PII detection in a spaCy pipeline; use OpenMed de-identification as a LangChain runnable.

How do I install Bridging Presidio And Spacy in Claude Code?

Run `npx skills add maziyarpanahi/openmed --skill bridging-presidio-and-spacy -a claude-code`. Or copy the skill folder (skills/bridging-presidio-and-spacy in maziyarpanahi/openmed) into .claude/skills/bridging-presidio-and-spacy in your project. Claude Code loads it when a task matches its description.

How do I install Bridging Presidio And Spacy in Codex?

Run `npx skills add maziyarpanahi/openmed --skill bridging-presidio-and-spacy -a codex`. Or copy the skill folder (skills/bridging-presidio-and-spacy in maziyarpanahi/openmed) into .agents/skills/bridging-presidio-and-spacy in your project. Codex loads it when a task matches its description.

Can I use Bridging Presidio And Spacy in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add maziyarpanahi/openmed --skill bridging-presidio-and-spacy -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/bridging-presidio-and-spacy, .gemini/skills/bridging-presidio-and-spacy, .github/skills/bridging-presidio-and-spacy and .opencode/skills/bridging-presidio-and-spacy in your project.

What does Bridging Presidio And Spacy need to run?

Going by SKILL.md and its folder, Bridging Presidio And Spacy needs the command-line tools its instructions call (pip). Our summary lists: Python 3.

Does Bridging Presidio And Spacy access the network?

SKILL.md names 3 domains. As links in the text: microsoft.github.io, spacy.io and python.langchain.com. This is read from the text; nothing was executed.

Is Bridging Presidio And Spacy safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Bridging Presidio And Spacy use?

Bridging Presidio And Spacy is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Bridging Presidio And Spacy use?

About 2.2k tokens (SKILL.md is roughly 8.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Bridging Presidio And Spacy?

Skills that share tags, products or a category with Bridging Presidio And Spacy: Agentsop Dspy (agentsope/SkillAlchemy, 436 stars), Awesome Chatgpt Search (taishi-i/awesome-ChatGPT-repositories, 3.3k stars), LLM Development (meleantonio/ChernyCode, 516 stars) and Sentence Transformers Embeddings (Orchestra-Research/AI-Research-SKILLs, 13k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Bridging Presidio And Spacy?

maziyarpanahi (a GitHub user) maintains it in maziyarpanahi/openmed, which has 5,506 GitHub stars. The repository holds 74 skills in this directory. The repository was last updated on October 11, 2026.

Source: maziyarpanahi/openmed on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.