Skip to content

Commit 0273af3

Browse files
committed
Add notes about running a competency query service.
1 parent 050595f commit 0273af3

1 file changed

Lines changed: 98 additions & 0 deletions

File tree

docs/compency.rst

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
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+
13+
14+
Query descriptions
15+
------------------
16+
17+
A JSON file, ``competency.json``::
18+
19+
{
20+
"queries": [
21+
{
22+
"id": "QUERY_ID",
23+
"label": "A short label",
24+
"description": "What this query is all about...",
25+
"sql": "SQL query with placeholders for parameters",
26+
"parameters": [
27+
{
28+
"id": "PARAM_ID",
29+
"label": "Human readable label",
30+
"type": "number", ## "string", "boolean", "choice"
31+
"choices": { ## Only when type is "choice"
32+
"id": "CHOICE_ID",
33+
"label": "Human readable label"
34+
}
35+
},
36+
{
37+
.
38+
.
39+
}
40+
],
41+
"results": [
42+
{
43+
"id": "RESULT_ID",
44+
"label": "Human readable label",
45+
"type": "number" ## "string", "boolean"
46+
},
47+
{
48+
.
49+
.
50+
}
51+
52+
]
53+
},
54+
{
55+
.
56+
.
57+
.
58+
}
59+
]
60+
}
61+
62+
Server endpoints
63+
----------------
64+
65+
* ``GET competency/queries`` will return the above JSON.
66+
67+
* ``POST competency/query/`` with JSON data in the form::
68+
69+
{
70+
"id": "QUERY_ID",
71+
"parameters": [
72+
{
73+
"id": "PARAM_ID",
74+
"value": "Parameter value"
75+
},
76+
{
77+
.
78+
.
79+
}
80+
]
81+
}
82+
83+
84+
will return as JSON::
85+
86+
{
87+
"id": "QUERY_ID",
88+
"results": [
89+
{
90+
"id": "RESULT_ID",
91+
"value": "Result value"
92+
},
93+
{
94+
.
95+
.
96+
}
97+
]
98+
}

0 commit comments

Comments
 (0)