docs: update session handover — D2-D5 complete, EU PDF issue documented
Session achieved: structural metadata end-to-end (D2-D4), overlap bug fix, HTML stripping with charset detection, 430/436 docs re-ingested. Remaining: ~40 EU Official Journal PDFs need HTML from EUR-Lex (broken multi-column PDF extraction), 3 missing EDPB PDFs, 1 corrupt PDF. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,99 +1,127 @@
|
||||
# Session-Uebergabe: Pipeline-Gesamtplan
|
||||
# Session-Uebergabe: Strukturelles Chunking + Re-Ingestion
|
||||
|
||||
**Datum:** 2026-05-01
|
||||
**Uebergeben von:** Pipeline-Session (26.04 - 01.05.2026, ~6 Tage)
|
||||
**Datum:** 2026-05-02
|
||||
**Uebergeben von:** Pipeline-Session (01.05 - 02.05.2026)
|
||||
|
||||
## Was wurde erledigt
|
||||
|
||||
| Block | Was | Status |
|
||||
|-------|-----|--------|
|
||||
| **Pass 0b** | 173.471 atomare Controls generiert | ✅ $750 API |
|
||||
| **Dedup** | 173k → 151.675 unique (21.796 Duplikate) | ✅ ~30h Mac Mini |
|
||||
| **Block A** | v1 Tag, Dependencies (15.291), Healthcheck, Textkorrektur | ✅ |
|
||||
| **Block B** | Review-Verify (67k Paare, 43.527 DUPLIKAT) | ✅ $17 Haiku |
|
||||
| **Block C** | Adversarial Tests (30 Cases), Regression Harness (371 Tests) | ✅ |
|
||||
| **Block D1** | Strukturelles Chunking Endpoint (Metadaten-Extraktion) | ✅ deployed |
|
||||
| **D2** | RAG-Service speichert section/section_title/paragraph/paragraph_num/page in Qdrant | ✅ |
|
||||
| **D3** | Control Generator liest strukturelle Metadaten, page in source_citation | ✅ |
|
||||
| **D4** | BGB § 312k Validierung — Overlap-Bug gefunden + gefixt | ✅ |
|
||||
| **D5** | 430/436 Dokumente re-ingestiert mit neuem Chunking | ✅ |
|
||||
| **HTML-Fix** | HTML-Stripping + Charset-Erkennung (ISO-8859-1) | ✅ |
|
||||
| **pdfplumber** | Als PDF-Backend hinzugefuegt, PDF_EXTRACTION_BACKEND=auto | ✅ |
|
||||
|
||||
## Was als naechstes zu tun ist
|
||||
## Ergebnisse der Re-Ingestion
|
||||
|
||||
### Block D2-D6: Strukturelles Chunking fertigstellen
|
||||
| Dokumenttyp | Section-Rate | Anmerkung |
|
||||
|-------------|-------------|-----------|
|
||||
| **DE Gesetze (TXT)** | **95-100%** | Exzellent |
|
||||
| **HTML (gesetze-im-internet.de)** | **97.6%** | War 0%, nach Fix perfekt |
|
||||
| **EDPB/DSK Leitlinien (PDF)** | **80-98%** | Gut |
|
||||
| **EU-Amtsblatt-PDFs (AI Act, CRA, NIS2, DSGVO)** | **13-35%** | OFFEN — siehe unten |
|
||||
| **Tech-Specs (JSON, MD)** | **0%** | Erwartet, keine §/Artikel |
|
||||
|
||||
D1 (Embedding-Service Metadaten) ist deployed. Naechste Schritte:
|
||||
**Gesamt: 69.888 Chunks in 6 Collections, 430 von 436 Dokumenten.**
|
||||
|
||||
1. **D2: RAG Upload erweitern** (`rag-service/api/documents.py`)
|
||||
- Neue Payload-Felder in Qdrant speichern: section, section_title, paragraph, page
|
||||
- `chunks_with_metadata` vom Embedding-Service nutzen
|
||||
## Offene Probleme
|
||||
|
||||
2. **D3: Control Generator anpassen** (`control-pipeline/services/control_generator.py`)
|
||||
- Strukturelle Metadaten aus Qdrant-Payload bevorzugen
|
||||
- source_citation um Seitenzahl erweitern
|
||||
### 1. EU-Amtsblatt-PDFs (~40 Dokumente, 13-35% Section-Rate)
|
||||
|
||||
3. **D4: Test mit BGB § 312**
|
||||
- 1 Dokument mit neuem Chunking hochladen
|
||||
- Pruefen ob § 312k eigenen Chunk hat
|
||||
**Ursache:** EU Official Journal PDFs verwenden mehrspaltige Layouts. Sowohl pypdf als auch pdfplumber extrahieren gebrochene Woerter (`"Ar tik el"` statt `"Artikel"`). Kein PDF-Extractor loest das zuverlaessig.
|
||||
|
||||
4. **D5-D6: Alle 297 Quellen re-ingestieren** (grosser Aufwand)
|
||||
**Empfohlene Loesung:** EU-Verordnungen als HTML von EUR-Lex herunterladen statt PDF. EUR-Lex bietet alle Verordnungen als sauberes HTML. Unser HTML-Stripping + Legal Chunker funktioniert perfekt dafuer.
|
||||
|
||||
### Block E: Gesetze aktualisieren + ingestieren
|
||||
**Betroffene Dokumente (Beispiele):**
|
||||
- ai_act_2024_1689.pdf (33%) → HTML von EUR-Lex
|
||||
- cra_2024_2847.pdf (34%) → HTML von EUR-Lex
|
||||
- nis2_2022_2555.pdf (13%) → HTML von EUR-Lex
|
||||
- dsgvo_2016_679.pdf (0%) → HTML von EUR-Lex
|
||||
- amlr_2024_1624.pdf (12%) → HTML von EUR-Lex
|
||||
- Alle Dateien mit `_20XX_XXXX.pdf` Pattern im bp_compliance_ce Collection
|
||||
|
||||
Siehe Plan: BGB aktualisieren, fehlende Gesetze, Urteils-Control-Packs.
|
||||
**WICHTIG:** 16 Urteile muessen MANUELL heruntergeladen werden (WebFetch funktioniert nicht).
|
||||
Download-Liste: `legal-sources/urteile/DOWNLOAD_LIST.md`
|
||||
### 2. 3 komplett fehlende PDFs
|
||||
|
||||
### Block F: Hardcoded Knowledge Migration
|
||||
Diese wurden NIE erfolgreich in Qdrant gespeichert:
|
||||
- `edpb_controller_processor_07_2020.pdf` — KEINE CHUNKS
|
||||
- `edpb_gl_7_2020.pdf` — KEINE CHUNKS
|
||||
- `edpb_rtbf_05_2019.pdf` — KEINE CHUNKS
|
||||
|
||||
6 Dateien im Compliance-Backend mit hartkodiertem Rechtswissen.
|
||||
Instruktionsdatei: `breakpilot-compliance/zeroclaw/INSTRUCTION-hardcoded-knowledge-migration.md`
|
||||
**Ursache:** Timeout bei Upload (selbst mit 3600s). Die PDFs sind gross und die Embedding-Generierung dauert zu lange.
|
||||
|
||||
### Block G-pre: Master Control Konsolidierung
|
||||
**Loesung:** Manuell aufteilen (Split in Abschnitte) oder als kleinere Teile hochladen.
|
||||
|
||||
151k → 15-25k Master-Gruppen durch Clustering.
|
||||
### 3. 1 korrupte PDF
|
||||
|
||||
- `dsk_kpnr_3.pdf` — 500 Internal Server Error bei Extraktion
|
||||
|
||||
## Commits dieser Session
|
||||
|
||||
```
|
||||
93099b2 feat(pipeline): structural metadata end-to-end (Blocks D2-D4)
|
||||
ddad58f fix(rag): strip HTML tags before chunking + D5 re-ingestion scripts
|
||||
a459636 fix(rag): HTML charset detection + opening block tag newlines
|
||||
75dda9a feat(embedding): add pdfplumber backend for multi-column PDF extraction
|
||||
41183ff fix(docker): set PDF_EXTRACTION_BACKEND to auto (was pymupdf)
|
||||
```
|
||||
|
||||
## Kritische Dateien
|
||||
|
||||
| Datei | Repo | Aenderung |
|
||||
|-------|------|-----------|
|
||||
| `embedding-service/main.py` | core | D1 FERTIG — Metadaten-Extraktion |
|
||||
| `rag-service/api/documents.py` | core | D2 — Payload-Felder in Qdrant |
|
||||
| `control-pipeline/services/control_generator.py` | core | D3 — Metadaten nutzen |
|
||||
| `control-pipeline/services/batch_dedup_runner.py` | core | Checkpoint-Logik (fertig) |
|
||||
| `control-pipeline/services/dependency_engine.py` | core | Dependency Engine (fertig) |
|
||||
| `control-pipeline/services/dependency_generator.py` | core | Auto-Generation (fertig) |
|
||||
| Datei | Aenderung |
|
||||
|-------|-----------|
|
||||
| `embedding-service/main.py` | Overlap-Bug-Fix, pdfplumber-Backend |
|
||||
| `rag-service/api/documents.py` | D2 Payload-Felder + HTML-Erkennung |
|
||||
| `rag-service/html_utils.py` | HTML-Stripping + Charset-Erkennung (NEU) |
|
||||
| `rag-service/embedding_client.py` | ChunkResult Dataclass (D2) |
|
||||
| `control-pipeline/services/rag_client.py` | page-Feld in RAGSearchResult (D3) |
|
||||
| `control-pipeline/services/control_generator.py` | section-Prioritaet + page (D3) |
|
||||
| `control-pipeline/scripts/reingest_d5.py` | Re-Ingestion Script (NEU) |
|
||||
| `control-pipeline/scripts/reingest_d5_config.py` | Config + Helpers (NEU) |
|
||||
| `docker-compose.yml` | PDF_EXTRACTION_BACKEND=auto |
|
||||
|
||||
## Naechste Schritte (Block E)
|
||||
|
||||
### E1: EU-Verordnungen als HTML von EUR-Lex ersetzen
|
||||
1. Liste aller EU-Amtsblatt-PDFs mit <50% Section-Rate erstellen
|
||||
2. EUR-Lex HTML-Versionen herunterladen (CELEX-Nummern sind in den Qdrant-Payloads)
|
||||
3. Alte PDF-Chunks loeschen, HTML-Versionen hochladen
|
||||
4. Qualitaetspruefung → erwartete Section-Rate >90%
|
||||
|
||||
### E2: 3 fehlende EDPB-PDFs aufteilen + hochladen
|
||||
|
||||
### E3: Fehlende Gesetze ingestieren (BGB aktuell, ArbZG, MuSchG, etc.)
|
||||
Siehe Masterplan Block E in `jazzy-snacking-creek.md`
|
||||
|
||||
## DB-Stand
|
||||
|
||||
| Tabelle | Lokal (Mac Mini) | Production (Hetzner) |
|
||||
|---------|-----------------|---------------------|
|
||||
| canonical_controls | 291.402 | 291.402 (aber ohne Block B Duplikate) |
|
||||
| obligation_candidates | 234.538 | 234.538 |
|
||||
| control_dependencies | 15.294 | 15.294 |
|
||||
| Pass 0b Drafts | 151.675 | ~162.387 (Block B fehlt) |
|
||||
|
||||
**Production Sync noetig** nach Abschluss aller Bloecke.
|
||||
|
||||
## Memory-Dateien (WICHTIG — lesen!)
|
||||
|
||||
Alle unter `/Users/benjaminadmin/.claude/projects/-Users-benjaminadmin-Projekte-breakpilot-core/memory/`:
|
||||
|
||||
- `MEMORY.md` — Index aller Memories
|
||||
- `feedback_batch_api_safety.md` — NIEMALS curl-Retry fuer Batch-Submits
|
||||
- `feedback_no_hardcoded_knowledge.md` — Kein hartkodiertes Rechtswissen
|
||||
- `feedback_legal_source_licensing.md` — Rule 1/2/3 Lizenzpruefung
|
||||
- `project_structural_chunking.md` — Architektur-Entscheidung
|
||||
- `project_missing_legal_sources.md` — Fehlende Gesetze + 20 Urteile
|
||||
- `project_rag_version_audit.md` — 297 Quellen, BGB veraltet
|
||||
- `project_delta_pipeline.md` — Diff-Strategie fuer Gesetzesupates
|
||||
- `project_test_strategy.md` — 4-Ebenen Teststrategie
|
||||
- `project_compliance_execution_layer.md` — Moat-Strategie
|
||||
|
||||
## Plan-Datei
|
||||
|
||||
`/Users/benjaminadmin/.claude/plans/jazzy-snacking-creek.md` — Vollstaendiger Plan mit Bloecken A-G.
|
||||
| Collection | Chunks | Dokumente |
|
||||
|-----------|--------|-----------|
|
||||
| bp_compliance_ce | ~18.000 | ~60 |
|
||||
| bp_compliance_gesetze | ~31.500 | ~98 |
|
||||
| bp_compliance_datenschutz | ~15.000 | ~107 |
|
||||
| bp_dsfa_corpus | ~3.500 | ~30 |
|
||||
| bp_legal_templates | ~2.000 | ~100 |
|
||||
| **Gesamt** | **~70.000** | **~430** |
|
||||
|
||||
## Tests
|
||||
|
||||
```bash
|
||||
cd /Users/benjaminadmin/Projekte/breakpilot-core
|
||||
# Embedding-Service (58 Tests)
|
||||
cd embedding-service && python3 -m pytest test_chunking.py test_d4_bgb.py -v
|
||||
|
||||
# RAG-Service (32 Tests)
|
||||
cd rag-service && PYTHONPATH=. python3 -m pytest tests/ -v
|
||||
|
||||
# Control-Pipeline (387 Tests)
|
||||
PYTHONPATH=control-pipeline python3 -m pytest control-pipeline/tests/ -v
|
||||
# Ergebnis: 371 passed, 33 skipped
|
||||
```
|
||||
|
||||
## Memory-Dateien (lesen!)
|
||||
|
||||
Alle unter `/Users/benjaminadmin/.claude/projects/-Users-benjaminadmin-Projekte-breakpilot-core/memory/`:
|
||||
- `MEMORY.md` — Index
|
||||
- `project_structural_chunking.md` — Architektur-Entscheidung
|
||||
- `feedback_legal_source_licensing.md` — Rule 1/2/3
|
||||
- `project_control_pipeline_masterplan.md` — Gesamtplan A-G
|
||||
|
||||
Reference in New Issue
Block a user