Neqsim document intelligence extraction

From equinor/neqsim · View interactive version

Neqsim document intelligence extraction is an AI agent skill from the GitHub repository equinor/neqsim. Classify mixed engineering documents and images, route native text/table, OCR, and vision extraction, and produce source-traceable evidence packages with confidence and human-review gates. USE WHEN: a NeqSim task receives PDFs, scans, Word/Excel files, drawings, charts, photographs, or multiple conf

How to use this skill

Skill file

Document Intelligence Extraction

Use this skill as the intake layer for documents and images supplied to NeqSim tasks. It makes extraction automatic where tools are available without treating OCR or model output as verified engineering data.

When to Use

Inputs

Outputs

Engineering Method

The skill uses a staged, loss-minimizing method: preserve native structure, add OCR only when

the text layer is absent or weak, use vision when spatial meaning matters, and reconcile all

methods into evidence rather than free-form prose. Its Python package implements deterministic

classification, routing, provenance validation, review gates, quality scoring, and conflict

detection. Runtime adapters perform format parsing, OCR, and multimodal inference. This is an

engineering-data governance workflow, not a validated physical model or a substitute for

document control.

Extraction Workflow

  1. Inventory files recursively and preserve original names, hashes, and relative paths.
  2. Classify by actual format where possible, not filename alone. Reject encrypted, corrupt, unexpectedly executable, or unsupported content for manual triage.
  3. Prefer structured/native extraction first:
  1. For low-yield/scanned PDFs, render pages and run OCR with word coordinates. Keep OCR text separate from native text.
  2. Use multimodal vision for drawings, P&IDs, charts, photographs, symbols, topology, annotations, and spatial relationships. OCR alone cannot establish these semantics.
  3. Reconcile native text, OCR, tables, and vision. Do not overwrite disagreements; emit a conflict requiring review.
  4. Normalize values and units while preserving the exact original value, text, and unit.
  5. Gate every safety-critical, ambiguous, or confidence-below-0.85 fact as needs_review.
  6. Hand the evidence package to a document-type skill for engineering interpretation, then to the relevant NeqSim model.

Token-Efficient Reading (`markdown_normalize`)

Engineering sources are long, and feeding raw parser output to a model wastes context. The

optional markdown_normalize step produces a compact Markdown rendition of a source so the

model can read, orient, and locate the relevant sections cheaply. A converter such as

MarkItDown (pip install 'markitdown[docx,pptx,xlsx,pdf]')

is a suitable adapter.

It is a reading aid, not an extraction method. Construct it as follows:

step on that region only.

pages into one string, so page boundaries are lost and a page citation taken from it would be

fabricated. Cite pages from native_text, native_tables, or ocr.

hidden rows, or unit headers. Markdown flattening discards all four; use structured_tables.

metadata plus optional model-vision captioning. OCR stays with neqsim-pdf-ocr.

but they send the document off the machine. Treat that as an enterprise-governed route, not a

community default.

Where it pays off most: Word and PowerPoint documents, HTML, CSV/JSON/XML, EPUB, and text-heavy

PDFs such as standards, reports, and specifications that must be read in full before the fields

worth extracting are known.

Python Usage Pattern

from document_intelligence_extraction import DocumentIntelligenceExtractor, EvidenceFact

extractor = DocumentIntelligenceExtractor()
plan = extractor.plan("equipment_datasheet.pdf", embedded_text_chars=420)

fact = EvidenceFact(
    field="design_pressure",
    value=150.0,
    unit="bara",
    original_text="Design pressure: 150 bar(a)",
    page=2,
    locator="table:Design Conditions,row:Pressure",
    method="native_tables",
    confidence=0.98,
    safety_critical=True,
)
result = extractor.package(plan, "equipment_datasheet", [fact])
payload = result.to_dict()

The package does not embed one OCR or AI vendor. A harness executes each planned operation using available parsers, OCR engines, and multimodal tools, then creates EvidenceFact objects.

Evidence Contract

Every fact must include:

File-level metadata should additionally preserve content hash, document title/number, revision, date, language, page/sheet count, and extraction-tool versions.

Validation Checklist

Common Mistakes

| Symptom | Cause | Fix |

| --- | --- | --- |

| A scanned PDF appears empty | Only the embedded text layer was read | Render pages, OCR them, and retain coordinates |

| P&ID tags are found but topology is wrong | OCR was used without visual reasoning | Use vision plus a specialized P&ID topology skill |

| Spreadsheet units disappear | The sheet was flattened to CSV too early | Read cells, headers, merged ranges, and formulas natively |

| Conflicting design values are silently replaced | Sources were merged by field name | Use find_conflicts and require review |

| A plausible number enters a simulation | Provenance/review gates were skipped | Reject facts without original text and page/locator |

| A cited page number does not contain the value | A page was inferred from a Markdown rendition | Take the page from native_text, native_tables, or ocr |

| A scanned PDF converts to a near-empty Markdown file | markdown_normalize has no OCR of its own | Run the OCR step and chain to neqsim-pdf-ocr |

Limitations

Cooperation and Handoffs

Related NeqSim Functionality

The skill supplies governed inputs to NeqSim workflows such as ProcessSystem.fromJsonAndRun, SimulationValidator.validate, process equipment sizing, PVT simulations, and MCP tools including runProcess, runPVT, runPipeline, and validateInput. It performs no thermodynamic calculation itself.

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.