From 8ff58a426b8672dfe9b89306e17c7314f4f19d1a Mon Sep 17 00:00:00 2001
From: Stijn Vermeeren <stijn.vermeeren@swisstopo.ch>
Date: Fri, 22 Nov 2024 10:07:38 +0100
Subject: [PATCH] LGVISIUM-102: rename
 AToBIntervalExtractor.from_material_description_lines() + add example to docs

---
 src/stratigraphy/depth/a_to_b_interval_extractor.py | 13 +++++++++++--
 .../sidebar/layer_identifier_sidebar.py             |  2 +-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/stratigraphy/depth/a_to_b_interval_extractor.py b/src/stratigraphy/depth/a_to_b_interval_extractor.py
index 63b57c2..08d3de7 100644
--- a/src/stratigraphy/depth/a_to_b_interval_extractor.py
+++ b/src/stratigraphy/depth/a_to_b_interval_extractor.py
@@ -15,14 +15,23 @@ class AToBIntervalExtractor:
     """Methods for finding AToBInterval instances (e.g. "0.5m - 1.8m") in a text."""
 
     @classmethod
-    def from_lines(cls, lines: list[TextLine]) -> AToBInterval | None:
-        """Extract depth interval from text lines.
+    def from_material_description_lines(cls, lines: list[TextLine]) -> AToBInterval | None:
+        """Extract depth interval from text lines from a material description.
 
         For borehole profiles in the Deriaz layout, the depth interval is usually found in the text of the material
         description. Often, these text descriptions contain a further separation into multiple sub layers.
         These sub layers have their own depth intervals. This function extracts the overall depth interval,
         spanning across all mentioned sub layers.
 
+        For example (from GeoQuat 12306):
+            1) REMBLAIS HETEROGENES
+               0.00 - 0.08 m : RevĂȘtement bitumineux
+               0.08- 0.30 m : Grave d'infrastructure
+               0.30 - 1.40 m : Grave dans importante matrice de sable
+                               moyen, brun beige, pulvérulent.
+        From this material description, this method will extract a single depth interval that starts at 0m and ends
+        at 1.40m.
+
         Args:
             lines (list[TextLine]): The lines to extract the depth interval from.
 
diff --git a/src/stratigraphy/sidebar/layer_identifier_sidebar.py b/src/stratigraphy/sidebar/layer_identifier_sidebar.py
index 6f04571..4ac4dc0 100644
--- a/src/stratigraphy/sidebar/layer_identifier_sidebar.py
+++ b/src/stratigraphy/sidebar/layer_identifier_sidebar.py
@@ -70,7 +70,7 @@ def identify_groups(
         result = []
         for block in blocks:
             depth_intervals = []
-            depth_interval = AToBIntervalExtractor.from_lines(block.lines)
+            depth_interval = AToBIntervalExtractor.from_material_description_lines(block.lines)
             if depth_interval:
                 depth_intervals.append(depth_interval)
             result.append(IntervalBlockGroup(depth_intervals=depth_intervals, blocks=[block]))