1- Competency Queries
2- ==================
3-
4- Flatmap rendered connectivity
5- -----------------------------
6-
7- 1. All connectivity related Postgres tables have a ``source `` column.
8- 2. This column could hold a map UUID instead of a SCKAN release tag.
9- 3. Then rendered connectivity can be easily held in Postgres for published maps.
10- 4. Need a utility to load knowledge from published maps.
11- 5. This could also update a new ``published-flatmaps `` table with the map’s knowledge source, taxon, and biological sex.
12-
1+ Competency Queries via a Flatmap Server
2+ =======================================
133
144Query descriptions
155------------------
166
17- A JSON file, ``competency.json ``::
7+ A server's configuration will include a file that specifies what queries are available, along with
8+ information to assist a frontend UI in obtaining user input and to present result sets back to the user.
9+
10+ ::
1811
1912 {
2013 "queries": [
2114 {
2215 "id": "QUERY_ID",
2316 "label": "A short label",
2417 "description": "What this query is all about...",
25- "sql": "SQL query with placeholders for parameters",
18+ "sql": "SQL query with named placeholders for parameters, e.g. ... WHERE col=%(PARAM_ID)s ",
2619 "parameters": [
2720 {
2821 "id": "PARAM_ID",
@@ -59,12 +52,16 @@ A JSON file, ``competency.json``::
5952 ]
6053 }
6154
55+
56+
6257Server endpoints
6358----------------
6459
65- * ``GET competency/queries `` will return the above JSON.
60+ There will be two new server endpoints:
61+
62+ 1. ``GET competency/queries `` will return the above JSON.
6663
67- * ``POST competency/query/ `` with JSON data in the form::
64+ 2. ``POST competency/query/ `` will expect JSON data in the form::
6865
6966 {
7067 "id": "QUERY_ID",
@@ -81,18 +78,18 @@ Server endpoints
8178 }
8279
8380
84- will return as JSON ::
81+ and returns ::
8582
8683 {
8784 "id": "QUERY_ID",
88- "results": [
89- {
90- "id ": "RESULT_ID",
91- "value": "Result value"
92- } ,
93- {
94- .
95- .
96- }
97- ]
85+ "results": {
86+ "keys": ["RESULT_ID", ...],
87+ "values ": [
88+ ["First result row, RESULT_ID value", ...],
89+ ["Second result row, RESULT_ID value", ...] ,
90+ .
91+ .
92+ .
93+ ]
94+ }
9895 }
0 commit comments