Closed lexvand closed 3 years ago
@Derryrover Hi Tom,
Could you review this PR: https://github.com/nens/lizard-catalogue/pull/234? This PR also fixes the bug in https://github.com/nens/lizard-catalogue/issues/231.
Kr, Hoan
@hoanphungt Looks good ready to merge!
@hoanphungt @Derryrover
Hey Hoan and Tom :)
Nice that you now get feedback when the start time was after the end time. :) When the start time is before the end time, the portal shows the same timespan.
I noticed 4 things. Let me know if that is as designed or whether it becomes part of this ticket or a next ticket.
Kind regards, Madeleine
When there is no start time, the export timeseries button is greyed out. I was wondering...
@Derryrover @hoanphungt
Hey guys, I also found this. Is this what is supposed to happen?
Kind regards, Madeleine
I am not sure if export timeseries worked previously. I tried to export timeseries with the export timeseries for an asset that has values (checked this on the lizard staging client). But there are no values when I download the timeseries via the catalogue (De Bilt 06260).
Example below:
@GeOdin Regarding your bullet number 5, there is no values when you export the timeseries which is the correct behaviour. It happened because of your period filter. From 01/01/2019 to 31/01/2019, there is no timeseries with data during this period as you can also see in the map, there is no locations on the map. If you change the start date to 01/01/2016 for example, then you will see values in the spreadsheet.
@GeOdin
Hi Madeleine,
Thanks for your findings. I made this PR: https://github.com/nens/lizard-catalogue/pull/240 to address these issues and made another staging release to test the fixes. Regarding these issues, I addressed them as follows:
This is because in the portal only the date is taken into account, not the time, so the time input doesn't matter but only the date. The format that I used to open the timeseries in the portal is MMM,DD,YYYY-MMM,DD,YYYY
, so for example: Jan,20,2020-Jan,21,2020
.
@lexvand Do you think this is sufficient?
In the PR, I made a quick fix for it so they become invalid in this case (but not when you enter an integer with less than 6 number). I used moment library and for integer with less than 6 number, it can be translated to a date value.
size int matters for grey out timeseries button: as mentioned earlier, the moment library can translate integer with less than 6 number to a date value
Consistency in error feedback:
I improved the error feedback and disabled button by:
Could you have a look again on staging to see if the fixes are good enough?
Kind regards Hoan
@hoanphungt
Hey Hoan :)
Thank you for your improvements. It looks good!
Kind regards, Madeleine
I'm afraid the filter can't work correctly based on only AND filtering in the API. I made a drawing to illustrate the issue.
These 4 periods should result in a match with the given timeseries object. Currently we only support number 4, which is quite an unlikely use case. The logic would require an OR statement to make different combinations of correct filters comparing tsstart with filter_start and filter_end and comparing tsend with filter_start and filter_end.
We need another filter in the API to support this feature, which does an intersect. It requires more logic in the backend. A quick fix to make it more useful in the meantime is to flip the signs, meaning:
timeseries__start__lte=2019-01-01T00:00:00Z×eries__end__gte=2021-01-27T00:00:00Z
instead of timeseries__start__gte=2019-01-01T00:00:00Z×eries__end__lt=2021-01-27T00:00:00Z
@hoanphungt Could you fix that?
@hoanphungt Discussed with Tom en he had experience with this type of queries and it is possible to do it this way. It should become:
timeseries__start__lte=2021-01-27T00:00:00Z×eries__end__gte=2019-01-01T00:00:00Z
instead of timeseries__start__gte=2019-01-01T00:00:00Z×eries__end__lt=2021-01-27T00:00:00Z
@lexvand @Derryrover There will be 2 cases though:
timeseries__start__gte=2019-01-01T00:00:00Z
. Should I also flip the sign in this case using the current moment as start? So for example:timeseries__start__lte=2021-01-29T11:24:00Z×eries__end__gte=2019-01-01T00:00:00Z
timeseries__start__lte=2021-01-27T00:00:00Z×eries__end__gte=2019-01-01T00:00:00Z
Btw, I can't figure what lt
and gte
in this case mean and why did you change the position of lt
and gte
in the above query? :)
EDIT: I got the answer for the 2nd question. Only the 1st question left.
@hoanphungt
Hey Hoan :)
Could it be that lt stands for where the value of the field is less than (i.e. <) the specified value? https://docs.mongodb.com/manual/reference/operator/query/lt/
Could it be that gte stands for where the value of the field is greater than or equal to (i.e. >=) a specified value (e.g. value.)? https://docs.mongodb.com/manual/reference/operator/query/gte/
Kind regards, Madeleine
@GeOdin
Ah nice! Yes, it seems the correct explanation of those terms. Also, lte
means less than or equal to
as well.
In this case, I think my 2nd question is already answered. Only my 1st question left whether I should also flip the sign if only start date is filled in using the current moment.
@lexvand Seems like for case number 1, only start date is filled in, if I flip the sign and use the current moment as start date like this query:
It would return more results than the old query:
So I will also flip the sign in this case. One more question, the time passed in the query here should also be converted to UTC time, is it correct? Currently, it added the local time to the query. I am going to convert it to UTC before adding it to the query.
@hoanphungt Case 1: If only start is filled in the query becomes: timeseriesendgte={filled in start}. Case 2: If only end is filled in the query becomes: timeseriesstartlte={filled in end}. Case 3: If both are filled in the query becomes: timeseriesstartlte={filled in end}×eriesendgte={filled in start}.
May sound counterintuitive, but the logic is correct.
Ok, sounds good!
@Derryrover Hi Tom
Could you review this PR: https://github.com/nens/lizard-catalogue/issues/251?
Steps to test:
Kr, Hoan
Looks good you can merge !
@hoanphungt Not yet on staging, right? Moved it to this new pipeline (see description for purpose of pipeline).
EDIT: While working on this ticket. Also have a look at this bug: https://github.com/nens/lizard-catalogue/issues/231
Design: https://xd.adobe.com/view/2ca9bb91-e3f0-45c8-bc17-a0f15a4dfefc-79fa/screen/dfa6c937-94a2-46ee-b452-6392908e42b2
Next to a filter on observation type we would like to add a filter on period. Based on the defined period the locations on the map should appear or disappear when they have data within that period.
Based on the selected locations the start and end within step 3 should be updated according to: