Set up the data, parsing and quality-control layer for a public benchmark on the Volve daily drilling reports (DDR) and WITSML real-time data. - Data manifest with SHA-256 hashes of the three Volve subtrees in use. - DDR XML parser into DuckDB (1,759 reports, 26 wellbores, 23,447 activities, 17 tables) with locked expected counts. - Render QC of the publisher HTML against the XML (272,544 items). - OCR client for the shared chandra vLLM service, with a page cache keyed on model, prompt hash, dpi, max_tokens and temperature, and OCR QC against the HTML on a 26-report pilot. - Run logging (scripts/runlog.sh, logs/index.csv), the P0 runner and 40 tests. - Research plan, technical overview and progress page (in Vietnamese). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
58 lines
1.9 KiB
Python
58 lines
1.9 KiB
Python
"""Project paths. No absolute paths: everything is resolved from the repository root or from the
|
|
environment variables VOLVE_DIA_VOLVE_ROOT / VOLVE_DIA_OUTPUTS, which may also be set in `.env`."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
REPO_ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
def load_env(path: Path | None = None) -> None:
|
|
"""Read KEY=VALUE lines of `.env` into os.environ. Variables already set in the environment win."""
|
|
path = path or REPO_ROOT / ".env"
|
|
if not path.is_file():
|
|
return
|
|
for line in path.read_text(encoding="utf-8").splitlines():
|
|
line = line.strip()
|
|
if not line or line.startswith("#") or "=" not in line:
|
|
continue
|
|
key, value = line.split("=", 1)
|
|
os.environ.setdefault(key.strip(), value.strip().strip("'\""))
|
|
|
|
|
|
def volve_root() -> Path:
|
|
"""Volve directory downloaded from the Data Village (Well_technical_data/, WITSML Realtime drilling data/, ...)."""
|
|
env = os.environ.get("VOLVE_DIA_VOLVE_ROOT")
|
|
return Path(env) if env else REPO_ROOT / "data" / "Volve"
|
|
|
|
|
|
def well_technical_dir() -> Path:
|
|
return volve_root() / "Well_technical_data"
|
|
|
|
|
|
def ddr_xml_dir() -> Path:
|
|
"""1,759 WITSML 1.4 drillReport files: the ground truth of every label."""
|
|
return well_technical_dir() / "Daily Drilling Report - XML Version"
|
|
|
|
|
|
def ddr_html_dir() -> Path:
|
|
"""The same reports rendered to HTML by the publisher (what the PDF version prints)."""
|
|
return well_technical_dir() / "Daily Drilling Report - HTML Version"
|
|
|
|
|
|
def ddr_pdf_dir() -> Path:
|
|
return well_technical_dir() / "Daily Drilling report - PDF Version"
|
|
|
|
|
|
def witsml_dir() -> Path:
|
|
return volve_root() / "WITSML Realtime drilling data"
|
|
|
|
|
|
def outputs_dir() -> Path:
|
|
env = os.environ.get("VOLVE_DIA_OUTPUTS")
|
|
p = Path(env) if env else REPO_ROOT / "outputs"
|
|
p.mkdir(parents=True, exist_ok=True)
|
|
return p
|