An AI-powered CLI tool for preliminary assessment of Standard Operating Procedures against the 21 CFR Part 820 Quality System Regulation. Generates color-coded PDF reports to support — not replace — qualified human review.
Important: This tool is for preliminary, first-pass gap analysis only. All findings must be validated and finalized by a qualified Regulatory Affairs or Quality Assurance professional before any action is taken.
Four reference SOPs are included in examples/, each with a full review output in validation/. Click any card to read the complete findings.
Cards link to full findings with evidence quotes, per-item status, and human reviewer notes. PDF reports are generated by running the CLI commands shown at the top of each file.
Medical device SOPs must conform to 21 CFR Part 820 (FDA Quality System Regulation) before they can be used in regulated manufacturing, inspection, or complaint-handling environments. Manual review is time-consuming and error-prone, especially for high-document-volume QMS environments (e.g., Acme IGS, OrthoNav Robotic Surgical System).
This tool uses Claude (claude-opus-4-8) as a senior FDA compliance specialist persona to:
- Parse a submitted SOP (
.txtor.docx) - Evaluate it against a tiered 21 CFR 820 checklist (universal + SOP-type-specific items)
- Rate each checklist item
PRESENT/INCOMPLETE/MISSING - Generate a professional color-coded PDF report with evidence quotes and actionable recommendations
The tool is designed to improve over time. By feeding existing approved and audited SOPs (e.g., cleared Acme IGS / OrthoNav documents) as training examples, reviewers can:
- Calibrate Claude's assessment against known-good documents
- Identify acceptable baseline language patterns for specific SOP types
- Establish what "PRESENT" looks like for your organization's QMS style guide
- Build institutional knowledge of review parameters directly into the prompt engineering layer
See examples/ for reference SOPs and validation/ for benchmark output reports.
| Feature | Detail |
|---|---|
| AI Review Engine | Claude evaluates each SOP section as a senior FDA compliance specialist |
| 21 CFR 820 Checklist | 11 universal items + type-specific additions per SOP category |
| Device Class Stringency | Class I / II / III adjusts review rigor and scoring thresholds |
| Color-coded PDF Report | Green (PRESENT) / Amber (INCOMPLETE) / Red (MISSING) with overall GMP readiness badge |
| Structured JSON Extraction | Claude returns structured data — no hallucinated prose, parseable output |
| Input Formats | .txt, .docx, and .pdf supported (text-based PDFs; scanned/image PDFs are not supported) |
| Extensible Checklists | Add organization-specific checklist items directly in sop_review.py |
| Type | Type-Specific Checklist Additions |
|---|---|
manufacturing |
Environmental Conditions, In-Process Inspection, NCR Procedure, Equipment Qualification |
calibration |
Calibration Interval, NIST Traceability, Out-of-Calibration Response, Label Requirements |
cleaning |
Cleaning Agent Specifications, Rinse/Residue Verification, NCR Procedure, Cleaning Schedule |
inspection |
Acceptance Criteria, Sampling Plan, Inspection Equipment, Disposition Authority |
complaint |
Complaint Intake/Acknowledgment, MDR Reportability, Root Cause Analysis, CAPA Linkage |
git clone https://github.com/LSaiko/sop-review-tool.git
cd sop-review-toolpython -m venv .venv
source .venv/bin/activate # macOS / Linux
.venv\Scripts\activate # Windows PowerShellpip install -r requirements.txtGet your key from console.anthropic.com.
# macOS / Linux
export ANTHROPIC_API_KEY="sk-ant-api03-..."
# Windows PowerShell
$env:ANTHROPIC_API_KEY = "sk-ant-api03-..."# Review the bundled sample SOP (intentional gaps for demo)
python sop_review.py \
--file sample_sop.txt \
--sop-type cleaning \
--device-class II \
--output demo_report.pdf
# Review a Acme OrthoNav-style inspection SOP (Class III)
python sop_review.py \
--file examples/acme_orthonav_inspection_sop.txt \
--sop-type inspection \
--device-class III \
--output orthonav_review_report.pdf
# Review a PDF SOP directly
python sop_review.py \
--file my_sop.pdf \
--sop-type manufacturing \
--device-class II \
--output my_sop_report.pdfPDF note: The tool uses
pdfplumberfor text extraction. Text-based (digitally created) PDFs work well. Scanned or image-only PDFs are not supported — convert them with OCR software first.
python sop_review.py --file PATH --device-class {I,II,III} --sop-type TYPE [--output PATH]
| Argument | Required | Values | Description |
|---|---|---|---|
--file |
Yes | path | SOP file (.txt, .docx, or .pdf) |
--device-class |
Yes | I II III |
FDA device class — adjusts review stringency |
--sop-type |
Yes | manufacturing calibration cleaning inspection complaint |
Loads the appropriate checklist |
--output |
No | path | PDF output path (default: ./sop_review_report.pdf) |
Each generated report contains:
- Header — date, SOP filename, device class, SOP type
- Overall GMP Readiness Badge —
READY FOR QA REVIEW/NEEDS REVISION/MAJOR GAPS - Summary Scorecard — pass/fail counts and pass-rate percentage at a glance
- Detailed Findings Table — every checklist item with:
- Status (color-coded)
- Evidence quote from the SOP
- Actionable recommendation (when not PRESENT)
- Footer — model attribution and quality-use disclaimer
U01Purpose StatementU02ScopeU03Responsibilities (21 CFR 820.20(b))U04ReferencesU05Definitions / Abbreviations (21 CFR 820.3)U06Materials and Equipment List (21 CFR 820.70(g))U07Safety Precautions / PPE Requirements (21 CFR 820.70(e))U08Step-by-Step ProcedureU09Documentation / Forms / Records (21 CFR 820.180)U10Revision History Table (21 CFR 820.40(b))U11Approval Signatures Block (21 CFR 820.40(a))
M01 Environmental Conditions · M02 In-Process Inspection · M03 NCR Procedure · M04 Equipment Qualification
C01 Calibration Interval · C02 NIST Traceability · C03 Out-of-Calibration Response · C04 Calibration Labels
CL01 Cleaning Agent Specs · CL02 Rinse/Residue Verification · CL03 NCR Procedure · CL04 Cleaning Schedule
I01 Acceptance Criteria · I02 Sampling Plan · I03 Inspection Equipment · I04 Disposition Authority
CP01 Complaint Intake · CP02 MDR Reportability · CP03 Root Cause Analysis · CP04 CAPA Linkage
sop-review-tool/
├── sop_review.py # Main CLI application
├── sample_sop.txt # Demo SOP with intentional gaps (cleaning, Class II)
├── requirements.txt # Python dependencies
├── README.md # This file
├── sop_review_report.pdf # Example PDF output from sample_sop.txt
│
├── examples/ # Reference SOPs for training and benchmarking
│ ├── acme_orthonav_inspection_sop.txt # OrthoNav RIO incoming inspection (Class III)
│ ├── acme_igs_optical_tracker_calibration_sop.txt # IGS OTC calibration (Class II)
│ ├── acme_orthonav_instrument_cleaning_sop.txt # OrthoNav instrument set cleaning (Class III)
│ └── acme_orthonav_igs_complaint_handling_sop.txt # OrthoNav/IGS complaint & MDR (Class III)
│
└── validation/
├── validation_report.md # Tool validation: methodology, test cases, results
├── acme_orthonav_review_output.md # Review output: OrthoNav inspection SOP (15/15 PRESENT)
├── igs_calibration_review_output.md # Review output: IGS calibration SOP (13/15, NEEDS REVISION)
├── orthonav_cleaning_review_output.md # Review output: OrthoNav cleaning SOP (12/15, NEEDS REVISION)
└── orthonav_igs_complaint_review_output.md # Review output: Complaint/MDR SOP (14/15, READY)
sop_review.py
├── read_sop_file() — .txt / .docx ingestion
├── build_checklist_text() — assembles prompt checklist (universal + type-specific)
├── call_claude() — Anthropic API call → structured JSON
├── parse_claude_response() — validates and parses Claude output
└── generate_pdf_report() — ReportLab PDF builder
├── _make_styles()
├── _scorecard_table()
└── _findings_table()
Model: claude-opus-4-8
System prompt: Senior FDA compliance specialist persona (15 years QMS experience)
Output format: Structured JSON with per-item status, evidence quote, and recommendation
PDF parsing: pdfplumber with layout-preserving text extraction (layout=True)
| Limitation | Detail |
|---|---|
| Preliminary only | Claude may miss context-dependent requirements. Human sign-off is always required. |
| Static checklist | The checklist reflects 21 CFR Part 820 as of 2024. FDA may issue new guidance at any time. |
| QMSR transition — action required | The FDA Quality Management System Regulation (QMSR, 21 CFR Part 820 as amended) took effect February 2, 2026 and aligns 21 CFR 820 with ISO 13485:2016. This tool's checklist is based on the pre-2026 QSR text. Users should verify all regulation citations against the current QMSR and supplement AI findings with a manual QMSR gap assessment until the checklist is updated. |
| English-language SOPs only | Multi-language documents are not tested. |
| Text-based PDFs only | Scanned / image-only PDFs will raise an error. Use OCR (e.g., Adobe Acrobat, Tesseract) to convert to searchable PDF before submitting. |
| No cross-document validation | Referenced SOPs and forms are not fetched or verified. |
This tool is intended to assist quality professionals in identifying potential gaps in SOP documentation during initial review. It does not constitute legal or regulatory advice and is not a substitute for review by a qualified Regulatory Affairs or Quality Assurance specialist.
All AI-generated findings must be validated against current FDA guidance, applicable standards, and your organization's document control procedures before any corrective action is taken.
MIT — free to use and adapt for portfolio, internal quality tooling, or commercial projects. See LICENSE for the full text.
All SOPs, device names ("Acme Surgical", "OrthoNav"), document numbers, and
review outputs in examples/ and validation/ are fictional, created
solely to demonstrate the tool. They do not represent any real company,
product, or controlled document, and are not affiliated with or endorsed by
any medical device manufacturer.