Python SDK for the BoreholeAI API — digitise borehole logs programmatically
Project description
BoreholeAI Python SDK
Python SDK for the BoreholeAI API. Digitise borehole logs programmatically — upload PDFs or images, get structured ground profiles, test data, and annotated PDFs.
Installation
pip install boreholeai
Quick Start
from boreholeai import BoreholeAI
client = BoreholeAI(api_key="bhai_your_api_key_here")
# Process a single borehole log
result = client.process_documents("BH01.pdf", output_dir="./results")
print(f"Pages processed: {result.num_pages}")
for f in result.files:
print(f" {f.filename}")
Folder Processing
Pass a directory path to process multiple files together. Results are merged into a single ground profile Excel, test data Excel, and AGS file, with one annotated PDF per input file.
result = client.process_documents("./borehole_logs/", output_dir="./results")
# Output:
# Borehole_ground_profile.xlsx (merged from all input files)
# Borehole_test_data.xlsx (merged from all input files)
# Borehole_ags4.ags (merged from all input files)
# BH01_annotated.pdf (one per input file)
# BH02_annotated.pdf
# BH03_annotated.pdf
Supported File Types
- PDF (
.pdf) - PNG (
.png) - JPEG (
.jpg,.jpeg) - TIFF (
.tif,.tiff) - WebP (
.webp)
API Key
Get your API key from the BoreholeAI dashboard.
# Pass directly
client = BoreholeAI(api_key="bhai_xxx")
# Or use for local development / testing
client = BoreholeAI(api_key="bhai_xxx", base_url="http://localhost:8000")
Error Handling
from boreholeai import BoreholeAI, InsufficientCreditsError, AuthenticationError
client = BoreholeAI(api_key="bhai_xxx")
try:
result = client.process_documents("borehole.pdf")
except AuthenticationError:
print("Invalid API key")
except InsufficientCreditsError:
print("Not enough credits — buy more at boreholeai.com")
Response
process_documents() returns a JobResult:
@dataclass
class JobResult:
job_id: str # Unique job identifier
status: str # "completed"
num_pages: int # Total pages processed
credits_used: int # Credits consumed
files: list[FileResult] # Downloaded result files
@dataclass
class FileResult:
filename: str # e.g. "Borehole_ground_profile.xlsx"
path: Path # Local path where file was saved
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file boreholeai-0.1.0.tar.gz.
File metadata
- Download URL: boreholeai-0.1.0.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5cfc8e0e8a7487a5ebc9eaa4224cfc278c05433310dbd802df44c59d214bd6f9
|
|
| MD5 |
6a8fce8b6351f2316293b0af32583731
|
|
| BLAKE2b-256 |
4034d6588b5d35fdc5bc9a6c7d90cbb205b6ee8ca5cfbd6361dd2c2895eee987
|
File details
Details for the file boreholeai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: boreholeai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80aa28bbd8a9038e4b4ff8eb64b3833d218433a76d3033dc6838708ecbfa7562
|
|
| MD5 |
4613cd8286c5441f210b5040b82aabf8
|
|
| BLAKE2b-256 |
4067254d12027e35fc875e47f4305b480d67e3df2a2e3696d4534d63a2fccc31
|