aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorPjotr Prins2023-08-23 14:23:44 +0200
committerPjotr Prins2023-08-23 14:23:44 +0200
commitafbbd86f316c2bfa70b86c1c51a4147a83f285ec (patch)
treecfcb6445da1f69e3a9a553424dc557dba57a8040 /web
parent9dff66430a956f7c8fe92a600bf36c4b1895f958 (diff)
downloadgn-guile-afbbd86f316c2bfa70b86c1c51a4147a83f285ec.tar.gz
Able to render group data
Diffstat (limited to 'web')
-rwxr-xr-xweb/webserver.scm12
1 files changed, 11 insertions, 1 deletions
diff --git a/web/webserver.scm b/web/webserver.scm
index 17f5716..a60f477 100755
--- a/web/webserver.scm
+++ b/web/webserver.scm
@@ -29,6 +29,7 @@
(web gn-uri)
(gn db sparql)
(gn data species)
+ (gn data group)
(web sxml)
(web view doc))
@@ -51,6 +52,14 @@
(,(mk-url "datasets")."Get a list of datasets")))))
+(define (get-id-data id)
+ "Get data based on identifier id. If it is a taxon return the taxon data,
+otherwise search for set/group data"
+ (let ([taxoninfo (get-expanded-taxon-data id)])
+ (if taxoninfo
+ taxoninfo
+ (cdr (get-group-data id)))))
+
;; ---- REST API web server handler
(define (not-found2 request)
@@ -104,7 +113,8 @@
(let ([names (get-species-shortnames (get-expanded-species))])
(match (string->list id)
[(name ... #\. #\m #\e #\t #\a #\. #\j #\s #\o #\n) (render-json (get-expanded-taxon-meta (list->string name)))]
- [(name ... #\. #\j #\s #\o #\n) (render-json (get-expanded-taxon-data (list->string name)))]
+ [(name ... #\. #\j #\s #\o #\n) (render-json
+ (get-id-data (list->string name)))]
[rest (render-json "NOP")])))
(_ (not-found (request-uri request)))
))