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>
57 lines
9.2 KiB
Markdown
57 lines
9.2 KiB
Markdown
# AGENTS.md
|
||
|
||
Volve-DIA: a public benchmark and baselines for drilling-context recognition, NPT/trouble-interval identification and evidence-grounded question answering over the Volve daily drilling reports (DDR) and WITSML real-time data. One author; target a Q2 journal (Geoenergy Science and Engineering first). Direction chosen on 29/10/2026 (`docs/danh-gia-huong-NCKH-2026-10-29.md`, local only).
|
||
|
||
Read first: `docs/plan.md` (plan, gates, decisions; §1 data facts, §6 roadmap, §10 forbidden claims, §12 decision log), `README.md` (setup, scripts, logging), `docs/danh-gia-huong-NCKH-2026-10-29.md` (why this direction, competitors, references; local only, not in git), `docs/technical_overview.md` (a lecture for newcomers: drilling, DDR, leakage, tasks, labels, OCR, evaluation, code map). Progress page: `report.html`. These docs are in Vietnamese.
|
||
|
||
## Status (29/10/2026)
|
||
|
||
- **P0 (infrastructure) done and committed** (first commit on `main`, 29/10/2026). The project folder is `/home/jovyan/lamlvh/Volve-DIA` (renamed from `Scientific` on 29/10/2026); pushed to remote `origin` `https://gitea.vts-ai.space/lamlvh/Volve-DIA`, which is **public**. `scripts/run_p0.sh` runs scripts 00–05 and the tests in about 3.3 min (run 20261029-105934_p0: all ok, 40 tests pass).
|
||
- **Data:** `data/Volve` is a symlink to `ML-Porosity/data/Volve`. The three subtrees read here (`Well_technical_data`, `Reports`, `WITSML Realtime drilling data`, about 20 GB) are hashed in `data_manifest/volve_dia.json`.
|
||
- **DDR XML parsed** (`02`): 1,759 reports, 26 wellbores, 23,447 activities (480 `fail`), 17 tables in `outputs/ddr/volve_ddr.duckdb`. The counts are locked in `EXPECTED` and the source checks are in `outputs/ddr/summary.json` (plan §1.2).
|
||
- Gaps found while writing the technical overview (plan §1.2, §12 item 9): `diaHole` is NULL in 990 reports, 260 of them with drilling activities (2,618 rows, 24 wellbores); `ropCurrent` is a sentinel everywhere, so ROP comes from `distDrill`, `bits.bitRun_ropAv` (88 values, 80 reports) or WITSML.
|
||
- **Three versions of every report:** each DDR exists as XML (the source), publisher HTML and a PDF rendered from the HTML (3,066 pages, born-digital).
|
||
- Render QC (`03`, 272,544 items): the HTML prints exactly what the XML holds, except two flags. *Tight well* and *HPHT* are 0 in every XML but "Y" in all 1,759 HTML reports, a publisher render bug. Take them from the XML only.
|
||
- **OCR parser:** chandra on the shared vLLM service (`configs/ocr.yaml`). The request and prompt are a byte copy of vopec-chatbot's (prompt hash-checked).
|
||
- Pilot done: one report per wellbore, 26 reports, 47 pages, all ok; 6.2 s/page wall with 4 workers.
|
||
- OCR QC (`05`) against the HTML: content CER 2.50%, WER 5.57%, exact rate 0.923 over 5,835 items. Operations cells: exact 0.859, CER 3.12%.
|
||
- Error types (hallucinated units, autocorrected source typos, merged or split columns, shifted depth values) are in plan §1.3. The parser repairs and QC rules that produced these numbers are in plan §12 item 6.
|
||
- **Full OCR not started.** All 1,759 reports (3,066 pages, about 5.3 h) are waiting because the OCR service has returned 503 since the pilot. The platform page says the environment is not running (pod does not exist). The service is shared and its pod is not ours, so ask the user to restart it.
|
||
- Nothing is running.
|
||
|
||
## Next
|
||
|
||
Roadmap and gates: `docs/plan.md` §6. Month 1 (M1) = data, labels, protocol.
|
||
|
||
1. **Full DDR OCR once the service answers:**
|
||
`setsid nohup scripts/runlog.sh -n ocr_full -- scripts/04_ocr.py --all > /dev/null 2>&1 &`
|
||
While the service is down, the script stops before sending any page ("OCR service not available: HTTP 503", exit 1), so starting it is also the check. It resumes from the page cache, keeps 4 workers, and stops by itself if 8 pages in a row fail. Then run `scripts/runlog.sh scripts/05_ocr_qc.py` on all 1,759 reports and update plan §1.3 and `report.html`.
|
||
2. **WITSML parser** (time logs, 68 channels at about 3 s; bhaRun, message, trajectory, mudLog) into DuckDB with the TADI sentinels and filters (plan §4.1). Check whether WITSML `15/9-F-15 S` is DDR `15/9-F-15`, and find the source folder of the formation tops (both [XM], plan §1.1, §4.1).
|
||
3. **Code → label mapping** (`configs/labels.yaml`, public): T1 phase from hole size, T2 NPT and cause group from `stateDetailActivity` + `proprietaryCode` + `state`, T3 MD intervals on a 10 m grid. T1 needs a fill rule for the 260 drilling days without `diaHole` (plan §4.3). Check `15_9_19_A_1980_01_01` (a 1980 date; no activities).
|
||
4. **T4 question templates** with SQL answers on DuckDB and cited row ids.
|
||
5. **Trial blind self-audit** of 100 activity rows (codes masked; estimates label agreement and time per row) and a draft of the evaluation protocol (`configs/protocol_v1.yaml`), which must decide whether GroupKFold groups by wellbore or by well (26 wellbores in 11 wells; sidetracks share the upper hole; plan §4.5 [XM]). Blind audit 1 (about 300 rows, stratified by wellbore and class) follows in M2, and the protocol is locked by SHA-256 at gate G1, **before any model run** (plan §4.4, §6, §12 item 1).
|
||
6. Read PetroAgents, Bassey 2026 and EAGE 2026101276 in full; download DrillScribe, the Anatoly5ms repo and the OMAE 2024 stuck-pipe set (plan §12 item 1).
|
||
|
||
## Conventions
|
||
|
||
- **Ground truth:** every label and every T4 answer comes from the XML (and WITSML), by code, with provenance. HTML and PDF are renders: never take a label from them. People only *validate* labels (blind audit, independent label sets, calibrated judge); they never create them.
|
||
- **No leakage:** activity codes (`proprietaryCode`, `stateDetailActivity`, `state`) are masked in model inputs for T2 and T3. T3 uses only features from before the event. Splits are by wellbore (GroupKFold); nothing is chosen on test wellbores. Report results with and without the masked codes.
|
||
- **Locked protocols:** the evaluation protocol is locked by SHA-256 before the first model run. Never edit a locked protocol or relax a threshold. New decisions go into a new protocol with a recorded deviation. Report results as they come out, including failures.
|
||
- **OCR service:** the URL lives only in the untracked `.env` (`VOLVE_DIA_OCR_URL`; template `.env.example`). Read it only through `volve_dia.ocr.service_url()`. Never put it on a command line (`runlog` records the command in `logs/index.csv`), in a committed file, or in output shown to the user. The service is shared with vopec-chatbot: keep `workers: 4`. The model, prompt hash, dpi, max_tokens and temperature form the page-cache key, so changing one re-reads every page.
|
||
- **Git:** work on `main`. Do not create branches unless the user explicitly asks. Commit only when the user asks. End commit messages with a co-author line for the agent.
|
||
- **Language:** code, figures, paper text and commit messages in academic English. `README.md`, `docs/plan.md`, `docs/technical_overview.md`, `report.html` and explanations to the user in Vietnamese.
|
||
- **Decisions:** decide from evidence and proceed.
|
||
- **Keep docs in sync (every task):** whenever a run starts, finishes, fails or is stopped, or a result, decision, script or file changes, update in the same turn every file that states it: `report.html` (task status, results, decisions, log), `docs/plan.md` (§0, §1, §6, §12), `AGENTS.md` (Status, Next) and where relevant `README.md` (scripts, run commands) and `docs/technical_overview.md` (results story, code map). Before ending the turn, grep these files for older statements about the same item (for example "not started", old counts or dates) and correct them, so no two files disagree.
|
||
- **Shared server:** never touch other users' jobs. Set `OMP_NUM_THREADS`, `MKL_NUM_THREADS` and `OPENBLAS_NUM_THREADS` explicitly when running by hand (the machine default is 40); `run_p0.sh` sets them to 4.
|
||
- **Long runs:** detach multi-hour runs with `setsid nohup ... > /dev/null 2>&1 &` so they survive the agent session, and wrap them with `scripts/runlog.sh` (the log is in `logs/runs/`). `04_ocr.py` resumes from the page cache.
|
||
- **Licence and confidentiality:** Volve is CC BY-NC-SA 4.0 (Equinor and the Volve licence partners): release derived labels and code under the same licence, non-commercial, with attribution. `docs/NCKH_Ban TD.DOCX` is an internal PVEP document: never commit or publish it. `docs/danh-gia-huong-NCKH-2026-10-29.md` quotes it, so it is gitignored and stays local. The remote is public: before every push, check that no committed file quotes the internal proposal.
|
||
- **Code style:** lines of at most 120 characters; scripts are numbered `scripts/NN_name.py`; tests that need the data carry the `data` marker.
|
||
|
||
## Not in git (other machines)
|
||
|
||
`data/` (the Volve symlink), `outputs/`, `logs/runs/`, `.env`, `docs/*.DOCX`, `docs/*.pdf`, `docs/danh-gia-huong-NCKH-2026-10-29.md` and the `.venv` are gitignored. Check the data with `scripts/00_data_manifest.py --check` and regenerate `outputs/` with `scripts/run_p0.sh`, except the OCR page cache `outputs/ocr/pages/`: it holds hours of GPU time, so copy it rather than reading the pages again.
|
||
|
||
## Skills
|
||
|
||
Agent skills live in `.agents/skills/` (sources in `skills-lock.json`): scikit-learn, pymc, statistical-analysis, scientific-visualization, scientific-writing, scientific-critical-thinking, literature-review, citation-management, academic-humanizer, mlflow.
|