Closed wildintellect closed 3 years ago
In openEO, we use the array notation for a similar use case. It's easier to implement on the back-end side and seems a bit more versatile.
I'm wondering how that aligns with the CQL alignment? See #32
I agree that the array syntax is the simplest on the back-end, and that any other syntax for the api would need to be translated upon receipt before used. I think the reason I leaned towards the Freq option was to make it easy to do GET requests with a parameter instead of adding a non-standard body, or forcing the use of a POST.
It appears CQL would be pretty similar This actually looks really similar to how elasticsearch ended up.
CQL JSON: {
"or" : [
"during": {
"property": "updated",
"value": ["2016-12-21T00:00:00","2017-03-21T23:59:59.999"]
},
"during": {
"property": "updated",
"value": ["2017-12-21T00:00:00","2018-03-21T23:59:59.999"]
}
]
}
@cholmes I'm dropping this from the beta.2 milestone -- if we're going to do something beyond what CQL supports, it needs to have a lot more discussion and shouldn't block beta 2.
In the current iteration of CQL JSON within the "Simple CQL" conformance class, it would look like this.
Assume a queryable defined for variable term updated
.
{
"or" : [
{
"anyinteracts": [
{ "property": "updated" },
["2016-12-21T00:00:00Z","2017-03-21T23:59:59.999Z"]
},
{
"anyinteracts": [
{ "property": "updated" },
["2017-12-21T00:00:00Z","2018-03-21T23:59:59.999Z"]
}
]
}
I imagine a python api for this would look something like this, where by a user passes a list of 2-tuples of datetimes and then that gets converted to the correct JSON syntax:
import iso8601
dt1a = iso8601.parse_date("2016-12-21T00:00:00Z")
dt1b = iso8601.parse_date("2017-03-21T23:59:59.999Z")
dt2a = iso8601.parse_date("2017-12-21T00:00:00Z")
dt2b = iso8601.parse_date("2018-03-21T23:59:59.999Z")
query = Query()
query.updated = [(dt1a,dt1b), (dt2a, dt2b)]
Sounds good. May be ok to close it entirely. @wildintellect - we're adopting CQL, and it seems like it's expressive enough to capture what you want? And if not then we should raise this in the CQL issues (in features api ogc repo).
Many end users of STAC endpoints have requested the ability to query STAC records for a recurring interval. An easy example of this is often called seasonality; querying for records from Dec 21 to Mar 21, for years 2016 to 2019.
This ticket is to discuss the options and decide on a path forward for an API extension definition. Options developed with input from @sharkinsspatial @alukach @bitner
Options
There are many possible ways to implement. A few considered options:
time = ["2016-12-21T00:00:00/2017-03-21T23:59:59.999", "2017-12-21T00:00:00/2018-03-21T23:59:59.999", "2018-12-21T00:00:00/2019-03-21T23:59:59.999"]
periodrange = ["2016-12-21T00:00:00/2017-03-21T23:59:59.999"]
periodrange = ["2016-12-21T00:00:00/2017-03-21T23:59:59.999", "2017-12-21T00:00:00/2018-03-21T23:59:59.999", "2018-12-21T00:00:00/2019-03-21T23:59:59.999"]
Repeat every year, 3 times, within the duration
periodrange = "R3/2016-12-21T00:00:00/2019-03-21T23:59:59.999/FREQ=YR;INTR=1"
Another example showing intervals less than 1 year
Repeat every 6 months, 3 times, within the duration
periodrange = "R3/2016-12-21T00:00:00/2019-03-21T23:59:59.999/FREQ=MO;INTR=6"