This is an automated email from the ASF dual-hosted git repository.

skperez pushed a commit to branch feature/SDAP-407
in repository https://gitbox.apache.org/repos/asf/incubator-sdap-nexus.git

commit d05e2780d08bdad72bcef4fb71224b07d1d818ff
Author: skorper <[email protected]>
AuthorDate: Mon Oct 24 14:44:32 2022 -0700

    Store depth in database along with results
---
 analysis/webservice/algorithms/doms/DomsInitialization.py |  1 +
 analysis/webservice/algorithms/doms/ResultsStorage.py     | 13 +++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/analysis/webservice/algorithms/doms/DomsInitialization.py 
b/analysis/webservice/algorithms/doms/DomsInitialization.py
index d1ed5a5..591c5f6 100644
--- a/analysis/webservice/algorithms/doms/DomsInitialization.py
+++ b/analysis/webservice/algorithms/doms/DomsInitialization.py
@@ -164,6 +164,7 @@ class DomsInitializer:
               platform text,
               device text,
               measurement_values map<text, decimal>,
+              depth decimal,
               PRIMARY KEY (execution_id, is_primary, id)
             );
         """
diff --git a/analysis/webservice/algorithms/doms/ResultsStorage.py 
b/analysis/webservice/algorithms/doms/ResultsStorage.py
index a228737..f0a18eb 100644
--- a/analysis/webservice/algorithms/doms/ResultsStorage.py
+++ b/analysis/webservice/algorithms/doms/ResultsStorage.py
@@ -156,9 +156,9 @@ class ResultsStorage(AbstractResultsContainer):
 
         cql = """
            INSERT INTO doms_data
-                (id, execution_id, value_id, primary_value_id, x, y, 
source_dataset, measurement_time, platform, device, measurement_values, 
is_primary)
+                (id, execution_id, value_id, primary_value_id, x, y, 
source_dataset, measurement_time, platform, device, measurement_values, 
is_primary, depth)
            VALUES
-                (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
+                (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
         """
         insertStatement = self._session.prepare(cql)
         batch = BatchStatement()
@@ -189,9 +189,9 @@ class ResultsStorage(AbstractResultsContainer):
             result["platform"] if "platform" in result else None,
             result["device"] if "device" in result else None,
             dataMap,
-            1 if primaryId is None else 0
-        )
-                  )
+            1 if primaryId is None else 0,
+            result["depth"]
+        ))
 
         n = 0
         if "matches" in result:
@@ -283,7 +283,8 @@ class ResultsRetrieval(AbstractResultsContainer):
                 "source": row.source_dataset,
                 "device": row.device,
                 "platform": row.platform,
-                "time": row.measurement_time.replace(tzinfo=UTC)
+                "time": row.measurement_time.replace(tzinfo=UTC),
+                "depth": row.depth
             }
         for key in row.measurement_values:
             value = float(row.measurement_values[key])

Reply via email to