Add M1: OCR hub import, WITSML, labels T1-T3, T4 questions, trial raters, draft protocol
- OCR: match the colleague's full-set Dataset Hub export to the DDRs by content (3,059/3,066 pages) and QC it against the HTML (CER 2.40%, exact 0.9181). - WITSML parser and formation tops: 21 DDR wellbores with time logs, 1,384 reports; WITSML 15/9-F-15 S is DDR 15/9-F-15. - Deterministic labels T1-T3 (configs/labels.yaml), 1,662 T4 questions with SQL, pandas and raw-XML answers in full agreement. - Trial label validation by three blind LLM raters (not an author or expert audit) and rater agreement script; draft protocol_v1 (not locked): split by well. - Literature notes and BibTeX; docs, report and run_m1.sh synchronised. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
325
configs/labels.yaml
Normal file
325
configs/labels.yaml
Normal file
@@ -0,0 +1,325 @@
|
||||
# Volve-DIA deterministic labels T1-T3: the public mapping from the DDR XML tables to labels.
|
||||
#
|
||||
# Every label is produced by code (volve_dia/labels.py, scripts/07_labels.py) from the tables that
|
||||
# scripts/02_parse_ddr.py builds from the WITSML drillReport XML files. No person and no language model creates a
|
||||
# label; HTML, PDF and OCR text are never a label source. People only validate (blind audit).
|
||||
#
|
||||
# Counts ("n") are activity rows in the 1,759 reports. scripts/07_labels.py fails if a count here differs from the
|
||||
# data, so this file cannot drift from the source. Lines marked "judgement:" are choices that the data do not
|
||||
# force; each carries its rationale. Choices that belong to the evaluation protocol (locked at gate G1) are NOT
|
||||
# made here: the candidates are produced side by side (see `t2.npt_definitions`, `op_class` vs `op_group`,
|
||||
# `cause_group` vs `cause_fine`).
|
||||
version: 1
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
# Reports that carry no label
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
reports:
|
||||
# A report is a placeholder when it has no activity and its period ends more than `placeholder_days_before_spud`
|
||||
# days before the spud date (dTimSpud) of its own wellbore. One report qualifies: 15_9_19_A_1980_01_01 (period
|
||||
# 1979-12-31 to 1980-01-01, spud 1997-07-25, sum24Hr and forecast24Hr "None", five survey stations dated
|
||||
# 1980-01-01, created 2018-05-03). It is a container for tie-in survey stations with a default date, not a
|
||||
# drilling day: status `placeholder_date`, excluded from the wellbore timeline and from T1-T3.
|
||||
placeholder_days_before_spud: 365
|
||||
# Eight further reports have no activity but a real date. They keep their report-day section label (T1) because
|
||||
# the report header is present; they have no operation label and contribute no row to T2 and T3. Status
|
||||
# `no_activities`. They stay in the timeline so that forward fill passes through them.
|
||||
keep_reports_without_activities: true
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
# T1: hole section and phase (report-day), operation class (activity)
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
t1:
|
||||
# Source column: reports.diaHole (inches). The `phase` column of activities is the rig type ("fixed",
|
||||
# "wire line"), not a drilling phase, and is not used.
|
||||
# All hole sizes that occur in the data (n = reports with that diaHole; 990 reports have none):
|
||||
# 36 -> 60, 26 -> 99, 17.5 -> 154, 12.25 -> 185, 9.875 -> 1, 8.5 -> 239, 6 -> 31.
|
||||
# `section` is the label string; `phase` is the nominal name of the casing string that the hole is drilled for.
|
||||
# judgement: phase names follow the size only. Four wells (F-4, F-5, F-7, F-9) have no 26" hole and drill 17.5"
|
||||
# directly below the 30" conductor, so "intermediate" is a nominal name there.
|
||||
hole_sizes:
|
||||
36.0: {n: 60, section: "36", phase: conductor} # 36" hole, 30" conductor
|
||||
26.0: {n: 99, section: "26", phase: surface} # 26" hole, 20" casing
|
||||
17.5: {n: 154, section: "17.5", phase: intermediate} # 17 1/2" hole, 13 3/8" or 14" casing
|
||||
12.25: {n: 185, section: "12.25", phase: production} # 12 1/4" hole, 9 5/8" or 10 3/4" casing
|
||||
9.875: {n: 1, section: "9.875", phase: pilot} # 9 7/8" pilot hole of 15/9-19 S, later opened to 36"/26"
|
||||
8.5: {n: 239, section: "8.5", phase: reservoir} # 8 1/2" hole, 7" liner or open hole
|
||||
6.0: {n: 31, section: "6", phase: reservoir} # 6" hole of 15/9-19 BT2 below the 7" liner
|
||||
# judgement: 6" keeps its own `section` but shares `phase: reservoir` with 8.5": it occurs in one wellbore, so a
|
||||
# separate phase could never be both trained and tested under a split by wellbore.
|
||||
# A report with reports.diaPilot set (19 reports: 18 of 15/9-F-12 at 8.5", 1 of 15/9-19 S at 9.875") drills a
|
||||
# pilot hole that is opened up afterwards. Its `section` is the pilot size as published; its `phase` is `pilot`,
|
||||
# whatever the size. judgement: an 8.5" pilot at 258-1353 m is not the reservoir section.
|
||||
pilot_phase: pilot
|
||||
|
||||
# Fill rule for reports without diaHole (990 reports: the placeholder and 989 others, 260 of them with
|
||||
# drilling-group activities). Candidates are evaluated by scripts/07_labels.py on the 769 reports with a known
|
||||
# diaHole: the value is masked and each rule tries to recover it (outputs/labels/fill_eval.parquet, summary.json
|
||||
# -> t1.fill_evaluation). Masking schemes: `single` (one report at a time), `tail_half` / `head_half` (the last /
|
||||
# first half of a run of equal diaHole), `whole_run` (a complete run).
|
||||
# Where the real gaps lie (all 989 / the 260 drilling days): after the last known section of the wellbore 936 /
|
||||
# 228, between two runs of the same size 21 / 16, between runs of different sizes 15 / 11 (casing and riser days
|
||||
# of 15/9-F-15 C after its 12.25" section), before the first known section 17 / 5. The gaps are tails of
|
||||
# sections: the header stops carrying diaHole once the last section reaches TD.
|
||||
fill:
|
||||
# judgement: forward fill = the hole section most recently opened in this wellbore. It is the convention the
|
||||
# source follows for intermediate sections (casing and cementing days after section TD keep the diaHole of that
|
||||
# section) and it needs only diaHole and the report order. Evidence (summary.json -> t1.fill_evaluation):
|
||||
# - `tail_half`, the scheme shaped like the real gaps: ffill 1.0000 (by construction: the head of the run stays
|
||||
# visible), hole_start 0.8489, bit_ffill 0.6291, csg_last 0.4615, depth_range 0.4533, casing_program 0.3599;
|
||||
# - `single`: ffill 0.9051 (every miss is the first report of a new section); hole_start is higher (0.9558)
|
||||
# but answers only 25 of the 989 real gaps, because the header opens a new record at section TD;
|
||||
# - on the real gaps ffill agrees with the hole size named in the text on 7 of 8 reports and with the bit
|
||||
# record of the report on 23 of 30 (the bit record agrees with a known diaHole on 65 of 75 reports).
|
||||
# Known limit: on the last reports of a wellbore the kick-off of the next sidetrack may already be under way in
|
||||
# a larger hole (4 of the 7 bit disagreements); the label stays the last section of the reporting wellbore.
|
||||
rule: ffill
|
||||
# Reports before the first known diaHole of a wellbore (rig move, pre-spud preparation; 17 reports, 5 with
|
||||
# drilling-group activities; 10 of them in 15/9-19 S) cannot be forward filled. judgement: they take the first
|
||||
# section of the wellbore (the section being prepared; the text names that size on 3 of 3 reports that name
|
||||
# one) and are marked `filled_by: bfill_leading`, so the protocol can drop them.
|
||||
leading: bfill
|
||||
# Rules that were evaluated (volve_dia.labels.FILL_RULES). `text` reads the hole size from sum24Hr and the
|
||||
# drilling-group comments; it is a cross-check only and never a label source, because that text is model input.
|
||||
candidates: [ffill, bfill, nearest, hole_start, csg_last, depth_range, bit_report, bit_ffill, casing_program, text]
|
||||
# casing_program: outer diameter of the last casing (casings.od at the shoe nearest to reports.mdCsgLast,
|
||||
# within `casing_shoe_tolerance_m`, same well) -> size of the next hole. Standard bit/casing pairs.
|
||||
casing_shoe_tolerance_m: 15.0
|
||||
casing_od_to_next_hole: {30.0: 26.0, 20.0: 17.5, 14.0: 12.25, 13.375: 12.25, 10.75: 8.5, 9.625: 8.5,
|
||||
7.625: 6.0, 7.0: 6.0, 6.625: 6.0}
|
||||
# Provenance columns of every filled report: filled_by, fill_source_report_id, fill_gap_reports, fill_gap_days.
|
||||
# A report-day is in scope `drilling_day` when it has at least one drilling-group activity, else `other_day`
|
||||
# (completion, workover, plug and abandonment, rig move): on those days the section is the last one drilled, far
|
||||
# in the past for a 2016 abandonment. Whether `other_day` reports are scored is a protocol choice. The eight
|
||||
# reports without activities have scope `no_activities`, the placeholder `excluded`.
|
||||
|
||||
# Hook for a section label from WITSML (not built here; another parser fills outputs/witsml/). When a table
|
||||
# with the columns (wellbore, start_utc, end_utc, section_in) is passed to labels.attach_witsml_section, the
|
||||
# report-day table gains `section_witsml` and `section_agree`; without it both columns are NULL.
|
||||
witsml_section: {enabled: false, table: null}
|
||||
|
||||
# Day-level operation: the op_group and the op_class with the most activity hours in the report (ties: the
|
||||
# alphabetically first), with their share of the reported hours.
|
||||
|
||||
# Operation class of an activity = `op_class` of its proprietaryCode in `codes` below.
|
||||
# judgement: the sub-code decides the class wherever it names an operation, across main groups
|
||||
# ("drilling -- trip", "plug abandon -- trip" and "formation evaluation -- trip" are all `trip`). The main group
|
||||
# is kept as the coarser label `op_group` (7 classes), the raw sub-code as `op_sub` (41 values), so the protocol
|
||||
# can choose the level and merge rare classes.
|
||||
op_classes:
|
||||
drill_ream: "making or enlarging hole: drill, ream, hole open (ream 97 and hole open 6 are too few
|
||||
to stand alone and are the same bit-on-bottom work)"
|
||||
trip: "tripping, in any main group"
|
||||
casing_cement: "running and cementing casing or liner (the single code `drilling -- casing`)"
|
||||
circulate: "circulating and conditioning, including circulating for geological samples (11)"
|
||||
bop_wellhead: "BOP and wellhead work: `bop/wellhead equipment` and `bop activities`"
|
||||
formation_evaluation: "measurements of the well and the formation: log, rft/fit, core, drill stem test, survey,
|
||||
pressure detection (flow checks, 24)"
|
||||
completion: "completion string, sand control, SCSSSV test, stimulate (1 row)"
|
||||
perforate: "perforating, in completion, workover and plug-and-abandon"
|
||||
wireline: "wire line work"
|
||||
plug_abandon: "plug-and-abandon operations: cement plug, mechanical plug, squeeze, cut, mill, equipment
|
||||
recovery"
|
||||
rig_move: "skid, anchor, transit, position"
|
||||
rig_up_down: "rig up/down outside interruptions"
|
||||
wait: "`wait` sub-code outside the interruption group (79 rows: waiting on cement, on the
|
||||
production department, industrial action, muster)"
|
||||
other: "`other` sub-code of every non-interruption group. judgement: the comments of
|
||||
`plug abandon -- other` (2,332) and `drilling -- other` (572) are the same auxiliary rig
|
||||
work (handling equipment, cleaning, pressure tests), so one class is learnable from text;
|
||||
`op_group` still separates them"
|
||||
interruption: "all ten interruption codes. The code does not say which operation was interrupted, so
|
||||
this class repeats NPT definition (a) of T2; the protocol may leave it out of T1"
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
# The 64 proprietaryCodes: n, T1 operation class, T2 cause group
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
# `cause` is used only on NPT rows. `detail` means: the code names no cause, take it from stateDetailActivity
|
||||
# (t2.cause_from_detail). Non-interruption codes are NPT only under definition (b) and always use `detail`.
|
||||
codes:
|
||||
# drilling: 9137 rows, 12 codes
|
||||
"drilling -- casing": {n: 3204, op_class: casing_cement, cause: detail}
|
||||
"drilling -- drill": {n: 1822, op_class: drill_ream, cause: detail}
|
||||
"drilling -- trip": {n: 1430, op_class: trip, cause: detail}
|
||||
"drilling -- bop/wellhead equipment": {n: 1252, op_class: bop_wellhead, cause: detail}
|
||||
"drilling -- other": {n: 572, op_class: other, cause: detail}
|
||||
"drilling -- circulating conditioning": {n: 357, op_class: circulate, cause: detail}
|
||||
"drilling -- bop activities": {n: 226, op_class: bop_wellhead, cause: detail}
|
||||
"drilling -- survey": {n: 115, op_class: formation_evaluation, cause: detail}
|
||||
"drilling -- ream": {n: 97, op_class: drill_ream, cause: detail}
|
||||
"drilling -- wait": {n: 32, op_class: wait, cause: detail}
|
||||
"drilling -- pressure detection": {n: 24, op_class: formation_evaluation, cause: detail}
|
||||
"drilling -- hole open": {n: 6, op_class: drill_ream, cause: detail}
|
||||
# formation evaluation: 732 rows, 10 codes
|
||||
"formation evaluation -- log": {n: 206, op_class: formation_evaluation, cause: detail}
|
||||
"formation evaluation -- rig up/down": {n: 143, op_class: rig_up_down, cause: detail}
|
||||
"formation evaluation -- trip": {n: 109, op_class: trip, cause: detail}
|
||||
"formation evaluation -- drill stem test": {n: 86, op_class: formation_evaluation, cause: detail}
|
||||
"formation evaluation -- circulating conditioning": {n: 73, op_class: circulate, cause: detail}
|
||||
"formation evaluation -- rft/fit": {n: 69, op_class: formation_evaluation, cause: detail}
|
||||
"formation evaluation -- core": {n: 20, op_class: formation_evaluation, cause: detail}
|
||||
"formation evaluation -- circulation samples": {n: 11, op_class: circulate, cause: detail}
|
||||
"formation evaluation -- other": {n: 10, op_class: other, cause: detail}
|
||||
"formation evaluation -- wait": {n: 5, op_class: wait, cause: detail}
|
||||
# completion: 2944 rows, 9 codes
|
||||
"completion -- bop/wellhead equipment": {n: 930, op_class: bop_wellhead, cause: detail}
|
||||
"completion -- circulating conditioning": {n: 647, op_class: circulate, cause: detail}
|
||||
"completion -- perforate": {n: 469, op_class: perforate, cause: detail}
|
||||
"completion -- completion string": {n: 406, op_class: completion, cause: detail}
|
||||
"completion -- other": {n: 298, op_class: other, cause: detail}
|
||||
"completion -- test scsssv": {n: 71, op_class: completion, cause: detail}
|
||||
"completion -- wire line": {n: 65, op_class: wireline, cause: detail}
|
||||
"completion -- sand control": {n: 57, op_class: completion, cause: detail}
|
||||
"completion -- stimulate": {n: 1, op_class: completion, cause: detail}
|
||||
# workover: 2221 rows, 8 codes
|
||||
"workover -- wire line": {n: 868, op_class: wireline, cause: detail}
|
||||
"workover -- rig up/down": {n: 429, op_class: rig_up_down, cause: detail}
|
||||
"workover -- perforate": {n: 347, op_class: perforate, cause: detail}
|
||||
"workover -- other": {n: 326, op_class: other, cause: detail}
|
||||
"workover -- bop/wellhead equipment": {n: 104, op_class: bop_wellhead, cause: detail}
|
||||
"workover -- completion string": {n: 94, op_class: completion, cause: detail}
|
||||
"workover -- test scsssv": {n: 28, op_class: completion, cause: detail}
|
||||
"workover -- wait": {n: 25, op_class: wait, cause: detail}
|
||||
# plug abandon: 4595 rows, 11 codes
|
||||
"plug abandon -- other": {n: 2332, op_class: other, cause: detail}
|
||||
"plug abandon -- cement plug": {n: 558, op_class: plug_abandon, cause: detail}
|
||||
"plug abandon -- cut": {n: 421, op_class: plug_abandon, cause: detail}
|
||||
"plug abandon -- trip": {n: 407, op_class: trip, cause: detail}
|
||||
"plug abandon -- equipment recovery": {n: 248, op_class: plug_abandon, cause: detail}
|
||||
"plug abandon -- mill": {n: 238, op_class: plug_abandon, cause: detail}
|
||||
"plug abandon -- mechanical plug": {n: 156, op_class: plug_abandon, cause: detail}
|
||||
"plug abandon -- perforate": {n: 113, op_class: perforate, cause: detail}
|
||||
"plug abandon -- circulating conditioning": {n: 97, op_class: circulate, cause: detail}
|
||||
"plug abandon -- wait": {n: 17, op_class: wait, cause: detail}
|
||||
"plug abandon -- squeeze": {n: 8, op_class: plug_abandon, cause: detail}
|
||||
# moving: 241 rows, 4 codes
|
||||
"moving -- skid": {n: 166, op_class: rig_move, cause: detail}
|
||||
"moving -- anchor": {n: 32, op_class: rig_move, cause: detail}
|
||||
"moving -- transit": {n: 27, op_class: rig_move, cause: detail}
|
||||
"moving -- position": {n: 16, op_class: rig_move, cause: detail}
|
||||
# interruption: 3577 rows, 10 codes
|
||||
"interruption -- other": {n: 1202, op_class: interruption, cause: detail}
|
||||
"interruption -- repair": {n: 806, op_class: interruption, cause: equipment}
|
||||
"interruption -- waiting on weather": {n: 445, op_class: interruption, cause: weather}
|
||||
"interruption -- maintain": {n: 310, op_class: interruption, cause: equipment}
|
||||
"interruption -- fish": {n: 246, op_class: interruption, cause: stuck_fishing}
|
||||
"interruption -- wait": {n: 229, op_class: interruption, cause: waiting}
|
||||
"interruption -- sidetrack": {n: 202, op_class: interruption, cause: sidetrack}
|
||||
"interruption -- lost circulation": {n: 75, op_class: interruption, cause: lost_circulation}
|
||||
"interruption -- rig up/down": {n: 33, op_class: interruption, cause: detail}
|
||||
"interruption -- well control": {n: 29, op_class: interruption, cause: well_control}
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
# T2: NPT (two candidate definitions) and cause group, per activity
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
t2:
|
||||
# Both definitions are produced as columns; the protocol picks one before any model run.
|
||||
# a interruption_only : code_main == "interruption" (3,577 rows)
|
||||
# b union : a OR state == "fail" OR stateDetailActivity != "success" (4,286 rows)
|
||||
npt_definitions:
|
||||
a: {name: interruption_only, n: 3577}
|
||||
b: {name: union, n: 4286}
|
||||
# state: ok 22,967, fail 480. Only `fail` is evidence of NPT.
|
||||
state: {ok: {n: 22967, npt: false}, fail: {n: 480, npt: true}}
|
||||
# stateDetailActivity -> cause group (used where the code names no cause).
|
||||
cause_from_detail:
|
||||
success: {n: 20802, cause: null} # no cause named -> `default_cause`
|
||||
equipment failure: {n: 1975, cause: equipment}
|
||||
operation failed: {n: 456, cause: operation_failed}
|
||||
stuck equipment: {n: 109, cause: stuck_fishing}
|
||||
circulation loss: {n: 92, cause: lost_circulation}
|
||||
mud loss: {n: 12, cause: lost_circulation} # judgement: 12 rows; mud lost downhole or at surface is
|
||||
# one loss class at this sample size
|
||||
injury: {n: 1, cause: hse} # one row; reported, never a class of its own
|
||||
# NPT row with neither a cause in the code nor in stateDetailActivity (interruption -- other with "success",
|
||||
# state == fail with "success").
|
||||
default_cause: unspecified
|
||||
# judgement (precedence): for interruption rows the sub-code wins over stateDetailActivity, because the sub-code
|
||||
# states what the lost time was booked to, while stateDetailActivity describes the outcome of the single row.
|
||||
# The two name different groups in 192 rows: in 134 the detail is the generic "operation failed", in 22 it is
|
||||
# "equipment failure" under a sidetrack, fish or weather code, and in 36 it is a specific downhole cause (well
|
||||
# control + circulation loss 23, repair + mud loss 6, sidetrack + circulation loss 3 / mud loss 1 / stuck
|
||||
# equipment 1, waiting on weather + circulation loss 2). Both candidates are kept as `cause_from_code` and
|
||||
# `cause_from_detail`, with `cause_conflict`, so the protocol can reverse the order.
|
||||
precedence: [code, detail, default]
|
||||
cause_groups:
|
||||
equipment: "rig or downhole equipment failure, repair and maintenance (interruption -- repair, --
|
||||
maintain; stateDetailActivity equipment failure). judgement: `maintain` rows are mostly
|
||||
repairs of the top drive and pipe-handling systems (163 of 310 carry equipment failure);
|
||||
`cause_fine` keeps repair and maintain apart"
|
||||
weather: "waiting on weather"
|
||||
waiting: "waiting other than on weather (interruption -- wait)"
|
||||
stuck_fishing: "stuck pipe or tool and fishing"
|
||||
lost_circulation: "lost circulation and mud loss"
|
||||
well_control: "well control (29 rows in 3 wellbores; flagged rare)"
|
||||
sidetrack: "technical sidetrack booked as interruption (202 rows in 3 wellbores of well 15/9-19; whole
|
||||
re-drilled intervals, including rows whose text is ordinary drilling)"
|
||||
operation_failed: "operation failed, no more specific cause"
|
||||
hse: "injury (1 row)"
|
||||
unspecified: "NPT without a named cause"
|
||||
# `cause_fine` = the interruption sub-code where the code names the cause (repair, maintain, fish, ...), else the
|
||||
# stateDetailActivity value, else `unspecified`.
|
||||
# Auxiliary flag, not an NPT definition: `wait_code_outside_interruption` marks the 79 rows whose sub-code is
|
||||
# `wait` in a non-interruption group. The protocol may treat them as a third candidate.
|
||||
|
||||
# Masked model-input view (table t2_inputs): what a model may read for T2 and T3. These five columns never
|
||||
# appear in it; volve_dia.labels.t2_inputs raises if one does.
|
||||
masked_columns: [proprietaryCode, code_main, code_sub, state, stateDetailActivity]
|
||||
# Activity columns of the view. `phase` (rig type: fixed / wire line) is not an activity code and is exposed as
|
||||
# `rig_phase`; its NPT rate is reported in summary.json so the protocol can drop it.
|
||||
input_activity_columns: [act_id, report_id, wellbore, seq, start_utc, end_utc, duration_h, md, phase, comments]
|
||||
# Report columns of the view (text and header metadata). For T1 the hole-size columns (diaHole, mdDiaHoleStart)
|
||||
# and the sizes named in the text are the label and must be masked by the model code as well.
|
||||
# Left out on purpose, as protocol choices: daysAhead / daysBehind (schedule variance accumulates with NPT) and
|
||||
# the equip_failures table (a structured near-label; its overlap with equipment NPT is in summary.json ->
|
||||
# t2.equip_failures_table).
|
||||
input_report_columns: [file_date, reportNo, sum24Hr, forecast24Hr, md, tvd, distDrill, diaHole, mdDiaHoleStart,
|
||||
mdCsgLast, rigAlias_NPD_Name, operator, drillContractor]
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
# T3: trouble intervals in measured depth, per wellbore
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
t3:
|
||||
# Depth of an activity = activities.md, one value per row: the depth of the string at the end of the activity,
|
||||
# not a depth range and not necessarily the depth of the problem in the hole.
|
||||
# Depth classes: `zero` (md == 0: string at surface, or depth not entered), `above_mudline` (0 < md < mud line),
|
||||
# `in_hole` (md >= mud line). Only `in_hole` rows are located on the grid.
|
||||
# Mud line of a wellbore = median of (waterDepth + elevKelly) over its reports with elevKelly > 0
|
||||
# (145.9 m for the F wellbores, 145.0 m for 15/9-F-15 B, 106-110 m for 15/9-19).
|
||||
grid_m: 10.0 # cell k covers [k * grid_m, (k + 1) * grid_m) m MD
|
||||
# Cell universe of a wellbore: every cell from the mud line to the deepest in-hole activity depth or report md.
|
||||
# A cell is positive under definition a (b) when at least one in-hole NPT activity under a (b) lies in it.
|
||||
# Merge rule: positive cells of one wellbore whose indices differ by at most `merge_gap_cells` + 1 form one
|
||||
# interval [k_first * grid_m, (k_last + 1) * grid_m). Time is not used: an interval collects every NPT activity
|
||||
# at that depth, whenever it happened; `first_start_utc` gives the cut-off for pre-event features.
|
||||
# judgement: gap 0 (touching cells only) adds no assumption about the cells in between; summary.json reports the
|
||||
# interval counts for gaps 0, 1 and 2.
|
||||
merge_gap_cells: 0
|
||||
# Episodes (table t3_episodes) are the time view: maximal runs of NPT activities that follow each other in the
|
||||
# activity sequence of a wellbore, with at most `episode_max_gap_h` hours between the end of one and the start of
|
||||
# the next (a longer gap, e.g. a missing report, ends the episode).
|
||||
episode_max_gap_h: 24.0
|
||||
# `own_hole_top_md` of a wellbore = the smallest mdDiaHoleStart among its reports with a known diaHole. Cells
|
||||
# above it belong to the hole shared with the parent wellbore (sidetracks) and are flagged `in_own_hole: false`.
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
# Text lexicon: analysis only, never a label source
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
# How often the free text names the label (not leakage: the text is the legitimate input; the paper reports the
|
||||
# rates). Each entry is a list of Python regular expressions (joined with "|", case-insensitive), searched in
|
||||
# activities.comments and, separately, in comments + sum24Hr of the report. Also computed without a lexicon: how
|
||||
# often a comment contains its own sub-code literally (summary.json -> text.code_sub_literal).
|
||||
text_lexicon:
|
||||
npt: ['\bnpt\b', 'down ?time', 'interrupt', 'trouble ?sho', '\bfail', '\brepair', '\bwait', '\bwow\b',
|
||||
'stuck', '\bfish', '\bleak', 'malfunction', '\blost\b', '\bloss']
|
||||
weather: ['\bwow\b', 'wait\w* (on|for|due to) (the )?weather', '\bweather\b', '\bwind\b', '\bwaves?\b',
|
||||
'\bheave\b']
|
||||
waiting: ['\bwait', 'stand(ing|-| )?by\b', '\bstandby\b']
|
||||
equipment: ['\brepair', 'trouble ?sho', '\bfail', '\bleak', 'malfunction', '\bdamage', '\bbroke\b',
|
||||
'\bbroken\b', '\bfault', '\breplace', 'chang\w* out']
|
||||
stuck_fishing: ['\bstuck\b', '\bfish', 'free ?point', 'over ?shot', '\bjarr?(ed|ing)?\b', '\bjunk\b']
|
||||
lost_circulation: ['lost circulation', '\bloss(es)?\b', 'lost returns', 'no returns', '\blcm\b', '\blost \d']
|
||||
well_control: ['well control', '\bkick\b', '\binflux\b', '\bkill(ed|ing)?\b', 'shut[- ]?in']
|
||||
sidetrack: ['side ?track', 'kick(ed)? ?off', 'whipstock']
|
||||
operation_failed: ['\bfail', 'no success', 'unsuccess', 'without success', 'not able', 'unable', '\bneg(ative)?\b',
|
||||
'\battempt']
|
||||
13
configs/ocr_hub.yaml
Normal file
13
configs/ocr_hub.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
# OCR of the Volve PDF pages run outside this repository (chandra, by a colleague) and exported from the internal
|
||||
# Dataset Hub as COCO (one PNG per distinct page image + one annotations json). Download it into `dir` with the
|
||||
# dataset-hub CLI; the hub URL, dataset id and API key live only in .env (see README). Read by volve_dia/ocr_hub.py.
|
||||
dir: data/ocr_hub
|
||||
prefilter: 30 # images re-scored by token F1 after the hashed TF-IDF cosine
|
||||
top_k: 8 # text candidates per page passed to the image stage
|
||||
thumb_dpi: 50 # PDF page rendered at 50 DPI ...
|
||||
thumb_shrink: 2 # ... and the 200-DPI hub PNG shrunk by 2**2, so both are about 414 x 585 px
|
||||
min_corr: 0.9 # grey-level correlation a page needs with its best candidate image to be matched
|
||||
tie_eps: 0.01 # candidates within this of the best correlation are ties; the highest text F1 among them wins
|
||||
fallback_top_k: 8 # a DDR page with no text candidate >= min_corr: best images by coarse correlation, re-scored
|
||||
min_text_f1: 0.7 # a page with at least f1_min_tokens tokens in its text layer also needs this text F1 ...
|
||||
f1_min_tokens: 50 # ... (shorter pages: footer-only second pages, where F1 over a few tokens says little)
|
||||
250
configs/protocol_v1.yaml
Normal file
250
configs/protocol_v1.yaml
Normal file
@@ -0,0 +1,250 @@
|
||||
# Volve-DIA evaluation protocol v1 -- DRAFT, NOT LOCKED.
|
||||
#
|
||||
# This file is locked at gate G1 (M2, before the first model run) by writing its SHA-256 to protocol_v1.yaml.sha256.
|
||||
# After the lock it is never edited and no threshold is relaxed: a change becomes protocol_v2 with a recorded
|
||||
# deviation. Until the lock every item is a proposal that the label validation (M2) may still change; items under `open:`
|
||||
# are undecided. docs/plan.md sections 4.2-4.7 and 6 give the reasoning; the label numbers quoted here are from
|
||||
# outputs/labels/summary.json (configs/labels.yaml sha256 0b1f877f2f9c...) and outputs/t4/summary.json.
|
||||
protocol: volve-dia
|
||||
version: 1
|
||||
status: draft # draft -> locked (G1)
|
||||
drafted: 2026-11-17
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
# What the protocol is about: frozen inputs (hashes are filled in at the lock)
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
inputs:
|
||||
data_manifest: {file: data_manifest/volve_dia.json, sha256: null}
|
||||
labels_config: {file: configs/labels.yaml, sha256: null}
|
||||
t4_templates: {file: configs/t4_templates.yaml, sha256: null}
|
||||
label_tables: {dir: outputs/labels, summary_sha256: null}
|
||||
t4_questions: {dir: outputs/t4, summary_sha256: null}
|
||||
ground_truth: "DDR XML (scripts/02_parse_ddr.py) and WITSML (scripts/06_parse_witsml.py) only; HTML, PDF and OCR
|
||||
text are model inputs at most, never labels or answers"
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
# Splits
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
splits:
|
||||
# Evidence (17/11/2026, outputs/labels/analysis.md):
|
||||
# * the 26 DDR wellbores belong to 11 wells; sidetracks of one well follow each other in time, 16 report days are
|
||||
# shared by two wellbores of a well;
|
||||
# * verbatim comments of >= 40 characters recur in a sibling wellbore in 0.30% of cases and in another well in
|
||||
# 0.96%, so text duplication alone does not force a split by well;
|
||||
# * but siblings share the slot, the upper hole and the formations at the same depths: 191 of the 844 positive
|
||||
# T3 cells (definition a) lie above the wellbore's own hole top, i.e. in hole shared with the parent;
|
||||
# * the two public Volve repositories with grouped splits (Anatoly5ms: 11 wells; DrillScribe: 23 nameWell) both
|
||||
# keep sidetracks with their parent well.
|
||||
# Decision: group by WELL; the split by wellbore is a sensitivity analysis for the main baselines only.
|
||||
group: well # volve_dia.names.well_of
|
||||
sensitivity_group: wellbore
|
||||
# Decision (was open): leave-one-well-out. It needs no fold-assignment table (one less researcher choice), every
|
||||
# well is predicted exactly once, and scores are computed on the pooled out-of-fold predictions, so the unequal
|
||||
# fold sizes (15/9-19: 375 reports, 15/9-F-7: 39) do not weight the folds. GroupKFold(5) was the alternative; it
|
||||
# does not help the rare classes either, because their concentration is a property of the wells (see below).
|
||||
outer: leave_one_group_out # 11 folds on DDR-only tasks; on T3/T5 the wells with WITSML time logs
|
||||
inner: {method: group_k_fold, n_splits: 5, group: well} # all tuning inside the training wells of a fold
|
||||
scoring: pooled_out_of_fold # one prediction per item, from the fold that held its well out
|
||||
rule: "nothing (hyperparameter, prompt, threshold, class merge, few-shot example) is chosen on a test well"
|
||||
# Systems that are not trained per fold (prompted LLMs, retrieval pipelines) cannot tune inside a fold. Their
|
||||
# prompts, few-shot examples and thresholds are developed only on two development wells, fixed here by a rule:
|
||||
# the two wells with the fewest DDR reports. Every system, trained or not, is also scored on the other nine wells,
|
||||
# which is the table where prompted and trained systems are compared.
|
||||
development_wells: ["15/9-F-7", "15/9-F-9"] # 39 and 60 reports; T2 NPT (a) 54 + 161 rows; T4 54 + 102 questions
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
# Inputs a model may see (leakage control)
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
masking:
|
||||
masked_fields: [proprietaryCode, code_main, code_sub, state, stateDetailActivity]
|
||||
# Other report content that states the label outright is withheld from T2/T3 inputs as well.
|
||||
withheld_for_t2_t3:
|
||||
- equip_failures # names the failure; 67.6% of the 325 reports with rows have equipment NPT (b)
|
||||
- daysAhead # schedule variance accumulates with NPT
|
||||
- daysBehind
|
||||
# rig_phase (fixed / wire line) is not an activity code; NPT (a) rate 15.6% vs 12.9%. Kept as an input.
|
||||
input_view: "table t2_inputs (volve_dia.labels.t2_inputs raises if a masked column appears) plus the comments of
|
||||
the previous and next activity of the same report"
|
||||
modes:
|
||||
masked: primary # results in the main tables
|
||||
unmasked: leakage_ablation # same models with the codes in the input; reported side by side
|
||||
t3_causality: "features only from activities, reports and WITSML samples that end before the start of the
|
||||
predicted interval (t3_intervals.first_start_utc); checked by hand on a sample of windows"
|
||||
t1_hole_size: "diaHole, diaPilot, mdDiaHoleStart, bit size and casing size are withheld whenever the section is
|
||||
the target; sizes named in the text stay (they are the evidence a reader uses)"
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
# Class evaluability under the split by well (decided on label distributions only, never on model results)
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
class_evaluability:
|
||||
# A class can be learned and tested across wells only if several wells hold it. Rule: a class is scored on its
|
||||
# own only if at least `min_wells` wells hold at least `min_items_per_well` items of it in the scored label set.
|
||||
# Otherwise it is merged as listed in `merges`, or dropped from scoring and its items reported separately.
|
||||
min_items_per_well: 5
|
||||
min_wells: 3
|
||||
# Result of the rule on the current labels (recomputed on the frozen labels at G1; the lock records the final
|
||||
# table). Concentration: sidetrack 100% in well 15/9-19; lost_circulation 87% in 15/9-19; well_control 79% in
|
||||
# 15/9-F-15; section 6" and 9.875" only in 15/9-19.
|
||||
preview:
|
||||
t2_cause:
|
||||
fail: [sidetrack, lost_circulation, well_control, hse]
|
||||
# lost_circulation + well_control together still fail (>= 5 items in 2 wells: 15/9-19 73, 15/9-F-15 24), so
|
||||
# both join stuck_fishing in the usual "hole problem" group; stuck_fishing (passes on its own) keeps a
|
||||
# per-class F1 inside the merged class as a secondary number.
|
||||
merges:
|
||||
downhole: [stuck_fishing, lost_circulation, well_control]
|
||||
sidetrack: "dropped from the cause target (202 rows, one well; most comments read as ordinary drilling); kept
|
||||
as NPT in the binary target; the binary T2 score is also reported without these rows"
|
||||
hse: "1 row (definition b only); dropped from the cause target"
|
||||
t1_section:
|
||||
fail: ["6", "9.875"]
|
||||
merges: {"8.5_and_smaller": ["8.5", "6"]} # both map to phase `reservoir` in labels.yaml
|
||||
drop: ["9.875"] # 4 drilling days, one well; reported, not scored
|
||||
t1_op_class: {fail: [], note: "every non-interruption class holds >= 5 rows in >= 6 wells"}
|
||||
|
||||
class_merging:
|
||||
# G1 rule (plan section 6): a class with kappa < 0.6 against the blind LLM raters (median over raters), or with
|
||||
# fewer than 20 rated items,
|
||||
# is not reported as its own class: it is merged into its parent group or dropped, and the merge is recorded here.
|
||||
# Applied after class_evaluability.
|
||||
min_kappa: 0.6
|
||||
min_audit_items: 20
|
||||
merges: [] # filled at G1
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
# Tasks, labels and metrics
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
tasks:
|
||||
t1:
|
||||
section:
|
||||
unit: report_day
|
||||
scope: drilling_day # 932 days; other_day (818: completion, P&A, workover) is not scored, because
|
||||
# its section is the last one drilled, often years earlier
|
||||
primary_subset: published # 672 drilling days with diaHole in the XML
|
||||
secondary_subset: filled # 260 drilling days filled by labels.yaml t1.fill (ffill 255, bfill_leading 5);
|
||||
# scored and reported separately, never pooled into the headline number
|
||||
metrics: [macro_f1, per_class_f1]
|
||||
op_class:
|
||||
unit: activity
|
||||
classes: "labels.yaml op_class without `interruption` (that class repeats T2 definition a)"
|
||||
scope: "all activities that are not interruption rows (19,870)"
|
||||
metrics: [macro_f1, per_class_f1]
|
||||
secondary: op_group # 7 coarse groups, reported alongside
|
||||
t2:
|
||||
unit: activity
|
||||
targets: [npt, cause_group]
|
||||
npt_definition:
|
||||
candidates: {a: interruption_only, b: union} # 3,577 vs 4,286 rows
|
||||
# Pre-registered rule, decided on label validation, never on model results: the primary definition is the
|
||||
# candidate with the higher Cohen's kappa against the blind LLM raters (median over raters); on a tie (|delta kappa| < 0.02) `a`.
|
||||
choose_by: llm_rater_median_kappa
|
||||
primary: null # filled at G1
|
||||
# The 79 `wait` rows outside the interruption group are not NPT under a or b (1 of them is b through
|
||||
# state=fail); they are not a third candidate, and their rate in the audit is reported.
|
||||
cause_precedence: "code before stateDetailActivity (labels.yaml t2.precedence); the 192 conflicts are reported
|
||||
and the cause score is also given with the order reversed"
|
||||
metrics: [f1_npt, pr_auc_npt, macro_f1_cause, per_class_f1]
|
||||
reference_baselines: [majority, comment_length_only, text_lexicon] # DrillScribe: length alone F1 0.772;
|
||||
# lexicon: recall 0.33, precision 0.51
|
||||
t3:
|
||||
unit: md_bin # 10 m grid, labels.yaml t3
|
||||
wellbores: with_witsml # wellbores with DDR and WITSML time logs (outputs/witsml)
|
||||
# Only half of the NPT rows can be placed in depth (md == 0 in 9,116 of 23,447 rows): (a) 50.3% of NPT rows,
|
||||
# 44.6% of NPT hours. T3 therefore scores where trouble was recorded in depth, not all trouble.
|
||||
cell_universe: "own hole: from the wellbore's own hole top (smallest mdDiaHoleStart) to its deepest in-hole
|
||||
depth; cells above it (shared with the parent) are reported separately, not scored"
|
||||
metrics: [interval_iou, pr_auc_bin]
|
||||
t4:
|
||||
unit: question
|
||||
answers: sql # outputs/t4; pandas and raw-XML re-implementations agree on 1,662 / 1,662
|
||||
questions: {total: 1662, answerable: 1638, unanswerable: 24}
|
||||
metrics: [answer_accuracy_within_tolerance, citation_precision, citation_recall, fabricated_number_rate,
|
||||
wrong_wellbore_rate, abstention_on_unanswerable]
|
||||
averaging: "macro over the five families (lookup, aggregation, temporal_event, comparison, multi_hop) as the
|
||||
headline; micro and per-template numbers alongside"
|
||||
citation_level: "report level (cited report_id) for every question; row level only for the 1,493 questions
|
||||
with at most 50 evidence rows (169 have more)"
|
||||
tolerance: "per template in configs/t4_templates.yaml"
|
||||
input_modalities: "XML/SQL, HTML text, OCR text. The modality comparison (RQ5) uses only the 1,447 questions
|
||||
whose answer is printed in the render (printed_in_render); the 215 XML-only questions are
|
||||
scored for XML/SQL systems and reported apart"
|
||||
scopes: "pair questions (92) compare wellbores of one well and go with that well; the 10 field questions are
|
||||
scored on their own line and enter no per-well number"
|
||||
llm_judge: "only for free-text parts and only if gate G3 passes"
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
# Statistics
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
statistics:
|
||||
seeds: [0, 1, 2] # at least 3 for every stochastic model; deterministic models run once
|
||||
ci: {method: cluster_bootstrap, cluster: well, resamples: 2000, level: 0.95, seed: 20261117}
|
||||
comparisons: "paired on the same folds; paired cluster bootstrap of the score difference"
|
||||
report_all: "every run is reported, failures included"
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
# Label validation (plan section 4.4)
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
validation:
|
||||
trial_audit:
|
||||
rows: 100
|
||||
when: M1
|
||||
purpose: "pipeline check and a first agreement estimate; not used for G1"
|
||||
tool: "scripts/09_audit.py (sample: seed 20261117, zones a 35 / b_only 15 / none 50, stratified by class within
|
||||
the zone, spread over wells; score: kappa unweighted and weighted to the population)"
|
||||
# Decision of 17/11/2026 (plan section 12 item 20): no human rater is available, so label validation uses blind
|
||||
# LLM raters, not an author audit. The claim is "validated by blind LLM raters and cross-checks", never "audited
|
||||
# by the author" or "expert-labelled". Each rater is a different model family (Sonnet, Opus, Haiku in the trial;
|
||||
# M2 adds at least one open-weight model), sees only the masked view (no code, no label, no key), rates every
|
||||
# row alone with no keyword rules, and is never shown another rater's output. Reported: kappa of each rater
|
||||
# against the code labels, kappa between raters (Fleiss and pairwise), and the disagreements. A human rater, if
|
||||
# one becomes available, is added as a further rater and reported on its own line.
|
||||
llm_raters:
|
||||
trial: {rows: 100, when: M1, models: [sonnet, opus, haiku], files: "outputs/audit/trial_100/RATINGS_llm_*.csv"}
|
||||
audit_1: {rows: 300, when: M2, strata: [zone, cause_group, well], masked: true, min_raters: 3,
|
||||
second_pass_after_days: 14, note: "second pass = same model rerun, for rater self-consistency"}
|
||||
decision_statistic: median_over_raters
|
||||
caveat: "LLM raters share training data and conventions with the LLM baselines of M3-M4; agreement with the
|
||||
code labels is evidence of consistency with a text reading, not of expert correctness"
|
||||
# Third-party label sets (docs/literature_notes.md, 17/11/2026): none is an independent drilling-NPT label set.
|
||||
# DrillScribe episodes are runs of stateDetailActivity (rebuilt 1,758/1,758 from our activities), Bassey 2026
|
||||
# labels daily production data, the OMAE 2024 stuck-pipe set has no label column. They are used as follows and
|
||||
# never reported as independent agreement. The blind LLM raters and the cross-checks together carry the
|
||||
# label-validity claim; the absence of a human rater is stated as a limitation.
|
||||
cross_checks:
|
||||
drillscribe: "parser cross-check (episodes rebuilt from the XML) and a T2 reference number; not a label source"
|
||||
anatoly5ms_text_rules: "comment regex rules re-implemented with attribution; agreement with T3 reported as a
|
||||
partly code-independent check"
|
||||
omae_2024_stuck_pipe: "three case-level checks (F-4, F-9 A, F-1) of what the DDR records at the incident"
|
||||
bassey_2026: "not used for T2/T3 (production events); cited as a precedent for rule-built labels"
|
||||
kappa: cohen
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
# To do before the lock (M2)
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
before_lock:
|
||||
- "run the blind LLM-rater validation (300 rows, >= 3 raters) and its second pass; fill npt_definition.primary and class_merging.merges"
|
||||
- "recompute class_evaluability on the frozen labels and copy the final table here"
|
||||
- "fill the sha256 fields of `inputs`"
|
||||
- "fix the T3/T5 well list from outputs/witsml (wells with time logs) and check that every LOGO fold has
|
||||
positives in its training wells"
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
# Gates (plan section 6); thresholds fixed at the lock, only dates may move
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
gates:
|
||||
g1: "protocol locked (sha256) before any model run; class_evaluability and class_merging applied"
|
||||
g2: "all baselines and the masked/unmasked ablation on every task, >= 3 seeds, CI by well; results reported
|
||||
whatever their direction"
|
||||
g3: {llm_judge_min_kappa: 0.6, else: "T4 reports automatic metrics only"}
|
||||
g4: "the release package reruns from scratch; third-party label licences checked"
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
# WITSML feature rules (decision of 17/11/2026, plan section 12 item 21)
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
witsml_features:
|
||||
# Tables keep the published values (provenance); the feature stage treats these as missing. Evidence:
|
||||
# outputs/witsml/log_suspects.parquet (-999 on MWD_* channels 224,841 values; 99999 on ANNVEL_MMIN 279,676 of
|
||||
# 279,866; 9999 on time-counter channels; huge values on RETI, SPPA, TQA).
|
||||
treat_as_missing: {values: [-999, -99999, 99999, 9999], abs_greater_than: 1.0e15}
|
||||
depth_source: drill_depth # view over GenTime Depth/BITDEP and Schlumberger DMEA/DBTM; never time_log_dedup Depth
|
||||
formation_labels: Well_picks_Volve_v1.dat # DDR stratInfo only as a cross-check
|
||||
1225
configs/t4_templates.yaml
Normal file
1225
configs/t4_templates.yaml
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user