Skip to main content

Extract geotechnical data from PDF reports and output DIGGS XML

Project description

Geotech Report Extraction

Extract geotechnical borehole data from PDF reports or Azure Document Intelligence JSON exports and output DIGGS 2.6 XML.

PyPI version License: MIT

Features

  • Parse borehole logs from geotechnical reports (Langan, Schnabel, and generic formats)
  • Extract soil layers, SPT blow counts, groundwater levels, and lab test results
  • Azure Document Intelligence (DI) JSON input for cloud/serverless workflows
  • Palantir Foundry integration with ready-to-use Spark transforms
  • XGBoost page classifier for automatic boring log identification
  • Template-based appendix cover page detection and report structure analysis
  • Optional vision-based extraction using Anthropic Claude or GPT-4o via Palantir Funhouse
  • Output DIGGS 2.6 XML for interoperability
  • Geospatial utilities for coordinate conversion and boring location mapping

Installation

pip install geotech-report-extraction

Core dependencies include XGBoost, scikit-learn, and pandas for ML-based page classification.

Optional extras

# PDF parsing (PyMuPDF)
pip install geotech-report-extraction[pdf]

# OCR support (Tesseract)
pip install geotech-report-extraction[ocr]

# Vision LLM extraction (Anthropic Claude)
pip install geotech-report-extraction[vision]

# Geospatial utilities (coordinate conversion, mapping)
pip install geotech-report-extraction[geo]

# Everything
pip install geotech-report-extraction[all]

Quick Start

From PDF

from geotech_report_extraction import extract_report

result = extract_report("report.pdf")

# With vision LLM
result = extract_report("report.pdf", use_vision=True, vision_api_key="sk-...")

From Azure Document Intelligence JSON

from geotech_report_extraction.di_reader import extract_from_di_json

result = extract_from_di_json("report_di.json")

# Or with a pre-parsed dict
result = extract_from_di_json(di_data_dict, file_label="my_report")

Palantir Foundry

See foundry_transforms/boring_log_pipeline.py for a three-stage Spark pipeline:

  1. Flatten raw DI JSON files into a per-page tabular dataset
  2. Identify boring log pages and group by boring ID
  3. Extract samples, soil layers, and water levels per boring

Report Structure Analysis

After page classification, the appendix cover page analyzer identifies report structure:

from geotech_report_extraction.report_structure import analyze_report_structure

# pages: list of dicts with 'text' and 'predicted_class' keys
structure = analyze_report_structure(pages)

for section in structure.sections:
    print(f"Appendix {section.letter}: {section.title} ({section.appendix_type})")
    print(f"  Pages {section.start_page}{section.end_page}")

The analyzer builds a per-report template from classifier-predicted covers, then uses it to confirm predictions and find missed covers. Works across firm formats (Schnabel structured headers, Langan minimal covers).

CLI

geotech-extract report.pdf -o output.xml

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geotech_report_extraction-0.4.1.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geotech_report_extraction-0.4.1-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

Details for the file geotech_report_extraction-0.4.1.tar.gz.

File metadata

File hashes

Hashes for geotech_report_extraction-0.4.1.tar.gz
Algorithm Hash digest
SHA256 0b188a1cd09294465c4d40e55dde3148d1ebebdbd31e684c04b61cc7434046a4
MD5 c4972fc9acc6672e9c4641f21fa8d89d
BLAKE2b-256 4254eb173e9804f9446e25a928832c6c2c3f881b0a1e1b35bb6f67581e7b75f2

See more details on using hashes here.

File details

Details for the file geotech_report_extraction-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for geotech_report_extraction-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b512985cdf6bc9c4b6779dd8dcc7e195c3cb7d78b4cfcdd1a43e2c5fe580a455
MD5 24457b8e46ae86ab7fe36a47da70d68b
BLAKE2b-256 b3d7504ce881b92fcb98c6fe7eaf35d630b95e5282c39077fdd02c59791f1102

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page