This project is a small PDF drawing validation tool for the QUADE Innoventure 2026 workflow.
The scripts check different pieces of information inside engineering drawing PDFs. Instead of manually going through every page, the scripts read the PDF, look for the required information, validate it, and generate a JSON report.
The current rules are:
Each rule has its own validation logic and produces a machine-readable JSON report.
R3 checks the sheet number on every page of the PDF.
The script:
PASS or FAIL.r3_report.json.If the PDF contains:
Page 1 → 3.1
Page 2 → 3.2
Page 3 → 3.3
the sheet numbers are unique, so the validation passes.
If the PDF contains:
Page 1 → 3.1
Page 2 → 3.2
Page 3 → 3.1
3.1 is duplicated, so the validation fails.
The current R3 implementation uses:
PyMuPDF
↓
PDF text extraction
↓
Regular expressions
↓
Bottom-to-top text search
↓
Sheet number validation
↓
Duplicate detection
↓
JSON report
Note: The current implementation searches the extracted text from bottom to top. It does not currently use the actual X/Y coordinates of the sheet number. It also contains some project-specific exclusion rules for equipment schedules.
R4 checks whether drawing views found on a PDF page have both:
The purpose is to make sure a drawing view is not missing either of these pieces of information.
For each PDF page, the script:
ARCH REF patterns such as 1/A2.11.PLANSECTIONDETAILELEVATIONVIEWPASS or FAIL.r4_report.json.The R4 code defines several drawing-ID patterns, including numeric IDs, labels such as View, Section, Detail, Plan, and Elevation, and IDs extracted from ARCH REF values. fileciteturn2file0L77-L90
The basic flow is:
PDF
↓
Extract page text
↓
Find possible Drawing IDs
↓
Find nearby titles
↓
Check ARCH REF patterns
↓
Check PLAN / SECTION / DETAIL / ELEVATION / VIEW labels
↓
Remove duplicate IDs
↓
Validate ID + Title
↓
PASS / FAIL
↓
JSON report
A valid drawing view might look conceptually like:
1
FLOOR PLAN
The script can identify:
Drawing ID → 1
Drawing Title → FLOOR PLAN
Status → PASS
If it finds:
2
but cannot find a title nearby, it reports:
Drawing ID → 2
Title → Missing
Status → FAIL
The R4 implementation explicitly marks a view with an ID but no title as FAIL, and also marks a title without an ID as FAIL. fileciteturn2file0L243-L273
R4 also checks for duplicate drawing IDs on the same page.
If the same ID occurs more than once, the page is marked as FAIL and the duplicate IDs are included in the result. fileciteturn2file0L247-L290
R6 checks the ARCH REF (Architectural Reference) information in the PDF.
The script goes through every page and tries to find and validate architectural references.
The extraction process is more flexible than R3 because it can use multiple methods, including OCR when needed.
PDF
↓
Extract normal PDF text
↓
Extract word-level text
↓
Use OCR when required
↓
Find ARCH REF
↓
Validate reference
↓
PASS / FAIL / REVIEW
↓
JSON report
The R6 validator uses PyMuPDF for PDF text extraction and can use Tesseract OCR for pages where normal text extraction is not sufficient.
The validation scripts are written in Python.
Used for:
Install:
pip install PyMuPDF
Imported in Python as:
import fitz
Python’s re module is used to find and validate patterns such as:
3.1
A-1
1-A
A.1
and architectural reference patterns.
The json module is used to generate the final reports.
Used for PDF file and path handling.
Used to add timestamps to the reports.
R6 can use Tesseract OCR as a fallback when normal PDF text extraction is not enough.
Install the Python packages:
pip install pytesseract Pillow
Tesseract OCR itself must also be installed separately on the system.
A typical project folder can look like this:
project/
│
├── r3_sheet_number_validation.py
├── r4_drawing_id_title_completeness.py
├── r6_architectural_reference_check.py
│
├── Testcase_1.pdf
├── Testcase_2.pdf
│
├── r3_report.json
├── r4_report.json
├── r6_report.json
│
└── README.md
python -m venv venv
venv\Scripts\activate
python3 -m venv venv
source venv/bin/activate
For R3 and R4:
pip install PyMuPDF
For R6:
pip install PyMuPDF pytesseract Pillow
python r3_sheet_number_validation.py
The script processes the PDF and creates:
r3_report.json
python r4_drawing_id_title_completeness.py
The script processes all pages and creates:
r4_report.json
python r6_architectural_reference_check.py
The script checks the architectural references and creates:
r6_report.json
Use the actual Python filenames from your project if they are different from the examples above.
The R4 report contains information such as:
A simplified result looks like:
{
"rule_id": "R4",
"rule_name": "Drawing ID and Title Completeness",
"file": "Testcase_1.pdf",
"total_pages": 3,
"overall_status": "PASS",
"summary": {
"passed": 3,
"failed": 0,
"review": 0
}
}
A simplified R3 report looks like:
{
"rule_id": "R3",
"rule_name": "Sheet Number Validation",
"file": "Testcase_2.pdf",
"total_pages": 3,
"overall_status": "PASS",
"duplicate_sheets": [],
"summary": {
"passed": 3,
"failed": 0,
"review": 0
}
}
The page-level results contain the extracted sheet number, validation status, message, confidence, and source information.
A simplified R6 report looks like:
{
"rule_id": "R6",
"rule_name": "Architectural Reference Check",
"file": "Testcase_1.pdf",
"total_pages": 3,
"overall_status": "PASS",
"summary": {
"total_checks": 3,
"passed": 3,
"failed": 0,
"review": 0
}
}
The required information was found and passed the validation rules.
The validation found a problem.
Examples:
The result could not be confidently classified.
R6 supports the REVIEW status. R4 keeps the REVIEW count in its report structure, although its current page-level logic mainly produces PASS and FAIL.
The scripts include confidence values with their validation results.
These are rule-based confidence scores. They are not machine-learning probabilities.
For example, R4 gives a high confidence when a drawing ID and title are both clearly detected:
ID + Title found → 95%
When a drawing ID is found but the title is missing, the confidence is lower:
ID found, title missing → 70%
These values are simply indicators of how confidently the rule classified the result.
The three rules can be viewed as one larger PDF validation process:
PDF Drawing
│
▼
Read every page
│
┌──────────────┼──────────────┐
│ │ │
▼ ▼ ▼
R3 R4 R6
Sheet Number Drawing ID ARCH REF
│ + Title │
│ │ │
▼ ▼ ▼
Extract Extract Extract
│ │ │
▼ ▼ ▼
Validate Validate Validate
│ │ │
▼ ▼ ▼
Duplicate Missing ID/ Reference
Check Title Check Check
│ │ │
└──────────────┼───────────────┘
▼
PASS / FAIL / REVIEW
│
▼
JSON Reports
R3 currently relies on PDF text extraction and regular expressions.
It does not use computer vision or an AI model.
The current implementation searches the extracted text from bottom to top. It does not directly use the physical X/Y coordinates of the sheet number.
There are also some project-specific rules for ignoring equipment-schedule-related values.
R4 is based on text extraction and pattern matching.
It looks for drawing IDs using several patterns and then searches nearby lines for a possible title. It also checks ARCH REF patterns and drawing labels such as PLAN, SECTION, DETAIL, ELEVATION, and VIEW. fileciteturn2file0L92-L100
The title validation rejects very short titles and titles containing words such as schedule, materials, hardware, notes, plumbing, and equipment. fileciteturn2file0L48-L60
R6 has a broader extraction strategy because it can use normal PDF text extraction, word-level extraction, and optional OCR.
This is useful for drawings where some pages are scanned or contain image-based text.
Make sure the PDF is in the folder where the script is being executed.
The scripts also contain fallback logic that looks for PDF files in the current directory.
Possible reasons:
Possible reasons:
Possible reasons:
Install:
pip install pytesseract Pillow
You also need to install the Tesseract OCR application separately and make sure it is available through the system PATH.
| Rule | What it checks | Main approach | Output |
|---|---|---|---|
| R3 | Sheet Number | PyMuPDF + Regex + duplicate check | r3_report.json |
| R4 | Drawing ID + Title | PyMuPDF + Regex + nearby-line matching | r4_report.json |
| R6 | ARCH REF | PyMuPDF + Regex + optional OCR | r6_report.json |
The project is a PDF validation pipeline for engineering drawings.
Each rule focuses on a different part of the drawing:
R3 → Is the Sheet Number valid and unique?
R4 → Does each Drawing View have an ID and Title?
R6 → Is the Architectural Reference valid?
The scripts process the PDF page by page and generate JSON reports that can be used by another application, automated testing system, or larger drawing-validation workflow.
The current implementation is rule-based and uses PDF text extraction, regular expressions, and OCR where required. It can be extended later with coordinate-based extraction, image processing, or computer-vision methods if the drawing layouts require them.