From 62552c725fded155e455e55877f5b8b305fbec3b Mon Sep 17 00:00:00 2001
From: Diana Collazos <diana.collazoscortes@wur.nl>
Date: Thu, 21 Nov 2024 09:57:17 +0000
Subject: [PATCH] improve script according to LuisC guidance

---
 README.md | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/README.md b/README.md
index 1c4820c..d5f56ec 100644
--- a/README.md
+++ b/README.md
@@ -1301,20 +1301,22 @@ query MyQuery($first: Int, $offset: Int) {
   ) {
     latitude
     longitude
-    layers(first: $first, filter: { sandValuesExist: true }, offset: $offset) {
-      sandValues(first: 6) {
-        profileId
-        profileCode
-        layerId
-        datasetId
-        continent
-        region
-        countryName
+    profileId
+    profileCode
+    continent
+    region
+    countryName
+    datasetCode
+    # most profiles have max 6 layers
+    # few special cases reach 50 layers
+    layers(first: 50, filter: { sandValuesExist: true }) {
+      layerId
+      upperDepth
+      lowerDepth
+      licence
+      sandValues(first: 1) { # retriving only average value
         date
-        upperDepth
-        lowerDepth
         valueAvg
-        licence
         methodOptions
       }
     }
-- 
GitLab