The labeling scripts in scripts/ (validate, ids, precedents); the index stays in .index/

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-11-16 13:20:31 +01:00
1 parent 4688d8ab9e
commit f34616ae38
6 files changed
+22 -22

No files matched your search

+3 -3
View File
@@ -2,9 +2,9 @@
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"permissions": {
"allow": [
"Bash(python3 validate.py:*)",
"Bash(python3 ids.py:*)",
"Bash(python3 precedents.py:*)",
"Bash(python3 scripts/validate.py:*)",
"Bash(python3 scripts/ids.py:*)",
"Bash(python3 scripts/precedents.py:*)",
"Bash(docker start ollama-bge-m3)"
],
"deny": [
+2 -2
View File
@@ -4,8 +4,8 @@ labeling: the AIMsight displacement labels and the knowledge to place them, in a
- **The labels**: `manual/<STATION>.jsonl` (the expert, for him alone), `auto/<STATION>.jsonl` (the agents, reviewed by `review`), one per line, `{"id", "start", "end", "family", "description", ...}`. The Diagnostic-App analyses: `auto/analyses/<STATION>_<start>_<end>/`.
- **The knowledge**, one source per kind (`README.md`), maintained by hand: `families.md` (the families, their boundaries, the catalogue of phenomena), `labeling-rules.md` (bounds, a single event, description, stated cause), `reading-rules.md` (what the data mean), `stations.md` (the installations); the cases are the labels, through `precedents.py`; what the data are: `tools/DATA.md`. A piece of knowledge lives in one of them only.
- **The tools**, standard library: `python3 validate.py [STATION | file.jsonl]` (the rules), `python3 ids.py [STATION]` (the stable id of new labels), `python3 precedents.py "<text>" [--exclude STATION START END] [--family F] [--k N]` (the RAG; it starts the Ollama container `ollama-bge-m3` by itself if it does not answer; `--check` without it).
- **Verify**: `python3 validate.py` (today 19 expected errors: the labels submitted by the app without `review`) and `python3 precedents.py --check`.
- **The tools**, standard library: `python3 scripts/validate.py [STATION | file.jsonl]` (the rules), `python3 scripts/ids.py [STATION]` (the stable id of new labels), `python3 scripts/precedents.py "<text>" [--exclude STATION START END] [--family F] [--k N]` (the RAG; it starts the Ollama container `ollama-bge-m3` by itself if it does not answer; `--check` without it).
- **Verify**: `python3 scripts/validate.py` (today 19 expected errors: the labels submitted by the app without `review`) and `python3 scripts/precedents.py --check`.
Rules:
- **`manual/` is the expert's, for him alone**: no agent and no process reads or writes there; the whole project (analyst, precedents, benchmark, optimization) uses only `auto/`.
+3 -3
View File
@@ -14,10 +14,10 @@ The AIMsight displacement labels and all the domain knowledge to place them, in
| What the data mean: measurement chain, gaps, reading rules, false friends | `reading-rules.md` |
| The installation of each station | `stations.md` |
| What the data are: files, columns, image quality, images | `tools/DATA.md` (tools repository) |
- `validate.py` (the labels against the rules), `ids.py` (the stable id of each).
- `precedents.py`: the RAG of the labels. The labels of `auto/` closest in meaning to a text, with their provenance (reviewed or not); `--exclude STATION START END` leaves out the analyzed range. bge-m3 model of the Ollama container `ollama-bge-m3` (started by the script itself if it does not answer; port 11435); the `.index/` index, outside git, updates itself at every call (only new or modified labels go through the model; ~8 min to redo everything on CPU).
- `scripts/`: `validate.py` (the labels against the rules), `ids.py` (the stable id of each).
- `scripts/precedents.py`: the RAG of the labels. The labels of `auto/` closest in meaning to a text, with their provenance (reviewed or not); `--exclude STATION START END` leaves out the analyzed range. bge-m3 model of the Ollama container `ollama-bge-m3` (started by the script itself if it does not answer; port 11435); the `.index/` index, outside git, updates itself at every call (only new or modified labels go through the model; ~8 min to redo everything on CPU).
Diagnostic-App and Optimizer reach it through a link `labeling -> ~/labeling`, ignored by git: Diagnostic-App reads and writes there (labels, analyses), Optimizer only reads; commits are made here. `validate.py` and `ids.py` run from here or through the link (`python3 labeling/validate.py`). Descriptions are written in English from now on.
Diagnostic-App and Optimizer reach it through a link `labeling -> ~/labeling`, ignored by git: Diagnostic-App reads and writes there (labels, analyses), Optimizer only reads; commits are made here. The scripts run from here (`python3 scripts/validate.py`) or through the link (`python3 labeling/scripts/validate.py`). Descriptions are written in English from now on.
History taken from Support-Agent (the `labeling/` folder, up to commit 48a3092), then the state of Diagnostic-App on 2026-11-13 (462ba9e): the archives of the etiqueteur and of the reviews (`auto/etiqueteur/`, `auto/revue/`, `auto/revue-croisee/`) and the old `labeling.py` tool remain in the history.
+3 -3
View File
@@ -1,7 +1,7 @@
"""Stable identifier of the automatic labels (D-131): `<STATION>-<n>`, given once, never changed nor reused.
python3 labeling/ids.py # gives an id to the labels that have none, every station of labeling/auto/
python3 labeling/ids.py NORDEND # one station
python3 labeling/scripts/ids.py # gives an id to the labels that have none, every station of labeling/auto/
python3 labeling/scripts/ids.py NORDEND # one station
A label keeps its id when it is changed; an added label receives the next one of its station.
The id is always the first field of the line. The rest does not change (order of the lines, other fields). Standard library.
@@ -11,7 +11,7 @@ import json
import os
import sys
AUTO = os.path.join(os.path.dirname(os.path.abspath(__file__)), "auto") # ~/labeling/auto, or through the labeling/ link
AUTO = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "auto") # ~/labeling/auto, or through the labeling/ link
def id_first(e):
+5 -5
View File
@@ -4,10 +4,10 @@ uses it.
The analyst describes what it sees on its range; the tool returns the labels already written that speak of it most, all
stations, with their provenance (reviewed, not reviewed): it is up to the analyst to judge whether they fit its case.
python3 labeling/precedents.py "the targets jump together when a reference is rejected intermittently"
python3 labeling/precedents.py "<text>" --exclude NORDEND 2026-11-04T21:12Z 2026-11-07T14:12Z --family Obstruction --k 5
python3 labeling/precedents.py --index # only updates the index
python3 labeling/precedents.py --check # checks the logic, without Ollama
python3 labeling/scripts/precedents.py "the targets jump together when a reference is rejected intermittently"
python3 labeling/scripts/precedents.py "<text>" --exclude NORDEND 2026-11-04T21:12Z 2026-11-07T14:12Z --family Obstruction --k 5
python3 labeling/scripts/precedents.py --index # only updates the index
python3 labeling/scripts/precedents.py --check # checks the logic, without Ollama
The index (.index/, out of git) keeps the vector of each text: at each call, only the new or changed labels go through
the model. Model: bge-m3 served by Ollama, the ollama-bge-m3 container, which the tool starts by itself if it does not
@@ -26,7 +26,7 @@ import urllib.request
from datetime import datetime
from pathlib import Path
HERE = Path(__file__).resolve().parent
HERE = Path(__file__).resolve().parent.parent # the labeling root: auto/ and .index/
URL = os.environ.get("OLLAMA_URL", "http://10.0.2.140:11435") # the port published by the ollama-bge-m3 container
MODEL = os.environ.get("RAG_MODEL", "bge-m3:567m")
CONTAINER = "ollama-bge-m3" # started by the tool if it does not answer
+6 -6
View File
@@ -1,11 +1,11 @@
"""Validation of the automatic labels (labeling/auto/*.jsonl) against the rules of labeling/labeling-rules.md.
python3 labeling/validate.py # every station
python3 labeling/validate.py NORDEND # one station
python3 labeling/validate.py <folder>/labels.jsonl # a proposed file, before it is submitted (no `review` required)
python3 labeling/scripts/validate.py # every station
python3 labeling/scripts/validate.py NORDEND # one station
python3 labeling/scripts/validate.py <folder>/labels.jsonl # a proposed file, before it is submitted (no `review` required)
Errors (to fix): unreadable JSON, missing field, unknown family, malformed date, start >= end,
label without `review` or without `id` (`python3 labeling/ids.py`), id not first in the line, duplicate id, exact duplicate,
label without `review` or without `id` (`python3 labeling/scripts/ids.py`), id not first in the line, duplicate id, exact duplicate,
numeric value, local time, "probably not a movement". "Nothing to worry about" is right only with an established cause: to
judge by reading, not by script.
Flagged (to look at): overlaps of two labels of the same family on the same station.
@@ -16,7 +16,7 @@ import os
import re
import sys
AUTO = os.path.join(os.path.dirname(os.path.abspath(__file__)), "auto") # ~/labeling/auto, or through the labeling/ link
AUTO = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "auto") # ~/labeling/auto, or through the labeling/ link
FAMILIES = {"Visibility", "Obstruction", "Thermal displacement", "Displacement", "Target issue", "No data"}
DATE = re.compile(r"^\d{4}-\d\d-\d\dT\d\d:\d\dZ$")
@@ -44,7 +44,7 @@ for st in stations:
errors.append(f"{where} missing field: {sorted(missing)}")
if "id" in e:
if next(iter(e)) != "id":
errors.append(f"{where} id not first in the line (`python3 labeling/ids.py`)")
errors.append(f"{where} id not first in the line (`python3 labeling/scripts/ids.py`)")
if e["id"] in ids:
errors.append(f"{where} duplicate id: {e['id']}")
ids.add(e["id"])