P&ID to Knowledge Graph
Turns vector or scanned P&ID/PFD PDFs into a process knowledge graph of equipment connectivity, instrument locations and control loops, exported as JSON, DuckDB, Markdown and validated DEXPI 2.0.1 XML.
Data & AnalyticsAdvanced★ 523⑂ 125AI score 9/10Last updated: Nov 26, 2026
What it does
- Classifies each PDF page (vector, outlined-text vector, raster scan, hybrid), then renders overview images and overlapping tiles sized for reliable reading.
- Has Claude do the visual work scripts can't: ISA 5.1 symbol recognition, pipe and signal line tracing, off-page connectors, confidence calibration — written out as one JSON file per sheet.
- Builds
graph.json, a queryablegraph.duckdb, a token-efficientsummary.mdfor LLM context, andgraph.dexpi.xmlthat is only emitted after passing the official XSD and DEXPI model check. - Enforces a QA loop over
qa_report.md: unresolved references, unconnected equipment, instruments with no measured point, OCR tags you may have missed, duplicate revisions.
Who it's for
- Process, instrumentation and control engineers working with plant drawings.
- Teams digitizing legacy documentation for digital twins, asset systems or internal AI assistants.
- EPC/design firms needing a DEXPI-compatible handover of drawing semantics.
Examples
- "Pages 47–60 of this permit PDF are the P&IDs — build me a knowledge graph." → probe, render, per-sheet extraction, QA loop, then a report with equipment/instrument/loop counts.
- "What's downstream of 660-TK-001?" →
kg_query.py <work>/kg downstream 660-TK-001 --equipment. - "Show me how loop FIC-0502 is wired and push the graph into Neo4j." → loop table from
summary.mdplusexport.py <work>/kg neo4j.
· · · Install guide · · ·
Try it now, no install
Paste this into Claude to use the skill without installing anything.
Read the instructions in this file and follow them to help me: https://raw.githubusercontent.com/ScottDuncanAI/PID-to-Knowledge-Graph/HEAD/skills/pid-to-kg/SKILL.md What I want: (describe your task here)
If Claude can't open the link, open it yourself and paste the contents instead.
↓ If it works for you, download the ZIP below and install it. Then it runs on its own — no pasting each time.
Install in the Claude app (no terminal)
- Download the ZIP with the button below.
- In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
- Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Install in Claude Code
Let Claude do it — paste this into Claude Code
Install the skill I found on AI Skill Mart. Copy the skills/pid-to-kg folder from the GitHub repo ScottDuncanAI/PID-to-Knowledge-Graph into my ~/.claude/skills/pid-to-kg/. When it's done, tell me in one line what this skill can do.
Install with a command instead
git clone https://github.com/ScottDuncanAI/PID-to-Knowledge-Graph.git /tmp/pid-kg && mkdir -p ~/.claude/skills && cp -r /tmp/pid-kg/skills/pid-to-kg ~/.claude/skills/⚠ This is a third-party skill. Check the source repository before installing.
- Confirm Python 3.10+ is installed (
python --version); if not, install it from python.org. - Clone the repository:
git clone https://github.com/ScottDuncanAI/PID-to-Knowledge-Graph.git - Copy the skill into Claude Code:
mkdir -p ~/.claude/skills && cp -r PID-to-Knowledge-Graph/skills/pid-to-kg ~/.claude/skills/ - Install dependencies (a virtualenv is recommended):
python -m venv .venv && source .venv/bin/activate && pip install -r ~/.claude/skills/pid-to-kg/scripts/requirements.txt - Optional: install an OCR engine so tag hints and rotation detection work; without it that step is skipped.
- Restart Claude Code, open the folder holding your drawings, and ask it to digitize the P&IDs. Keep one work directory per plant (
work/<plant>) so tags from different plants never merge, and have an engineer review the graph before any design, operations or safety use.
View source on GitHub ↗License: MIT