During the initial phase of experimentation, I think it would be helpful to allow users to send us a raw JSON predicate string describing the occurrences they are selecting. This would allow users to capture complex rules without us having to re-invent the wheel.
The main columns taxon_key, geometry, annotation would still be required.
Example
Complex Rule:
Lions in North America that are not fossils or living specimens are Suspicious.
add a column to the rule table called raw_json_pred
add POST method to API that accepts the JSON payload and other information.
R package
rgbif has support for writing JSON predicates easily via occ_download_prep(). This code could be adapted for gbifan.
UI
For now, the UI could show the annotation (suspicious, native, ect), but ignore the raw_json_pred until we have a way to represent it in a acceptable way.
Issues
Since some of these columns have analogues in the predicate dsl, so it is possible to create rules that have conflicting values for taxon_key and geometry. However, this also allows users to express rules with, for example, multiple taxa selections that are not yet possible in the current framework.
GBIF has a powerful domain specific language (dsl) for describing selections of occurrences, the predicate functions. https://techdocs.gbif.org/en/openapi/v1/occurrence#/Occurrence%20downloads
During the initial phase of experimentation, I think it would be helpful to allow users to send us a raw JSON predicate string describing the occurrences they are selecting. This would allow users to capture complex rules without us having to re-invent the wheel.
The main columns
taxon_key
,geometry
,annotation
would still be required.Example
Complex Rule:
Lions in North America that are not fossils or living specimens are Suspicious
.taxon_key
: 5219404geometry
: WKT of North America&occurrence_status=present)annotation
:SUSPICIOUS
raw_json_pred
:backend
rule
table calledraw_json_pred
R package
rgbif has support for writing JSON predicates easily via
occ_download_prep()
. This code could be adapted for gbifan.UI
For now, the UI could show the
annotation
(suspicious, native, ect), but ignore theraw_json_pred
until we have a way to represent it in a acceptable way.Issues
Since some of these columns have analogues in the predicate dsl, so it is possible to create rules that have conflicting values for
taxon_key
andgeometry
. However, this also allows users to express rules with, for example, multiple taxa selections that are not yet possible in the current framework.