Case studyCustom LLM and document AI
Engineering drawings to SAP-ready bills of material
By Sagar DavaraPublished
DeliveredIn short
Mirai Minds built a document AI system for an Indian public-sector refinery that turns engineering drawings into SAP-ready material-master data. Gemini finds the bill of materials on PDF, scanned or CAD drawings and extracts every row. An engineer reviews each row beside the drawing and exports a 16-column SAP upload sheet. Built over ten months; handed over in 2026.
Results
Results
16
SAP material-master fields per extracted row
Source · Delivered export specification, 2026
≈370
SAP picklist values enforced in the review screen
Source · Delivered system specification, 2026
The system
How it works
How it flows
- 01 Drawing: PDF, scan, DWG or DXF → Fast Gemini pass extracts BoM rows
- 02 Fast Gemini pass extracts BoM rows → Engineer reviews every row
- 03 Engineer reviews every row → Premium model re-run with a hint
- 04 Engineer reviews every row → SAP picklist validation
- 05 Premium model re-run with a hint → SAP picklist validation
- 06 SAP picklist validation → 16-column SAP upload sheet
The story
The problem
Equipment drawings, parts lists and bills of quantities reach the refinery as PDFs, scans, TIFFs and DWG or DXF CAD files, often with hundreds of line items each. Every item had to be keyed into SAP with the right material-master fields: material group, valuation class, MRP type, purchasing group, profit center and more. Skilled engineers were doing clerical work, and a single wrong field meant a bad record in procurement.
What we built
A closed web application where an engineer uploads a drawing of up to 500 MB and gets back an editable, SAP-ready table.
- Extraction. Gemini locates the bill-of-materials table on the drawing and extracts every row, plus the drawing number, item numbers and maker. Roughly 200 lines of engineering rules steer it: keep the reading order, never drop a row, preserve gaps in part numbering, and shorten names with a dictionary for more than 20 component types so text fits SAP's length limits. When the parts list omits a part number, the model reads the callouts on the drawing itself.
- Review. A split-pane workspace shows the drawing next to the extracted table. Only the fields a reviewer touches change, and conflicting edits are rejected rather than merged. A reviewer can re-run extraction on the premium model with a plain-English hint, or compose SAP short and long texts from drag-and-drop variables.
- SAP output. Cascading validation encodes about 370 SAP picklist values; choosing a material type narrows valuation class to the legal values. Every picklist also has an "Other" option, validated on the server. One click builds the 16-column upload sheet in the browser.
How it works in production
Progress streams to every open browser tab over Server-Sent Events: queued, downloading, extracting, persisting, completed. Large uploads are staged for 24 hours and promoted to permanent storage without a second upload. If the model returns malformed output, the parser's error goes back to the model for a retry, and each stage fails on its own with a precise message. Accounts are created by administrators only; there is no public sign-up, and deleted records can be recovered.
We built it over ten months, from September 2025 to July 2026, refining the extraction rules on the refinery's real drawings, and handed it to the client's IT partner. The same pattern of extraction, human review and system-ready output fits invoices, datasheets and inspection reports; see custom LLM and document AI and our manufacturing work.
What we'd change
- Log reviewer corrections as accuracy data from day one. Corrections are the best measure of extraction quality. With them logged per field from the start, we could publish field-level accuracy here; we can't yet.
- Plan direct SAP integration early. The Excel upload sheet was the right first step, but creating records through SAP interfaces removes a manual hop, and the design is easier with it in mind.
- Connect corporate sign-on sooner. Wider rollout across the organization needs single sign-on, and it is cheaper to add before users arrive than after.
Stack
What it runs on
- AI
- Google Gemini (fast and premium models)
- Backend
- FastAPI (async)MySQL 8.4AlembicAmazon S3
- Frontend
- Vue 3ViteTailwind CSS 4PrimeVue
- Delivery
- Server-Sent EventsJWT with role-based accessFirebase Hosting