irceline / aq-mobile-be

App for consulting air quality data in Belgium using the ionic framework for Android and iOS
Apache License 2.0
7 stars 8 forks source link

changing feedback location is not working #260

Closed opeeters closed 3 years ago

opeeters commented 3 years ago

When a user changes the feedback location, the feedback is submitted with the lat/long of the original configured location. Verified in the back-end DB..

Also, it would be good to trigger a purge of the locally cached tiles of the feedback_day and feedback_total when a user goes to "Display Feedback" after submission, since sometimes no icon is displayed because a user already has some cached tiles in the client side cache from a previous call to these layers.

janschulte commented 3 years ago

The first point with the changes feedback location ist fixed with the last commit.

I evaluated the feedback layer loading, the caching is disabled and while testing it in the browser, the layer tiles are allways be loaded again from the WMS server.

opeeters commented 3 years ago

Thanks for the fix for the first part.

Is the pouchDB caching layer not on device only? I thought the mechanism was first check is tile is present in the pouchDB, if not, fire request. Maybe the observed behaviour is related to something different. Server side there is a Varnish cache and a geowebcache (gwc). The tiles are not called from gwc (no tile=true parameter being added to the call) and I also refreshed Varnish.

janschulte commented 3 years ago

No not only on device, see here:

PouchDB is an open-source JavaScript database inspired by Apache CouchDB that is designed to run well within the browser.

Maybe we should ask us again, if a WMS is here the best solution. Because we display here layers with rendered Features on the map a better solution would be to work with a WFS. I saw that you have a running WFS with the Features for Feedback today and total here: https://geo.irceline.be/belair/wfs?service=WFS&request=GetCapabilities

Should I give it a try?

janschulte commented 3 years ago

Here is the cache disabled for the daily feedback layer: https://github.com/irceline/aq-mobile-be/blob/52n-v2-upgrade/src/app/v2/components/feedback-stats/feedback-stats-map/feedback-stats-map.component.ts#L54

opeeters commented 3 years ago

WFS (as CSV or GeoJSON) is certainly a better option than WMS for this, I fully agree. For a GDPR perspective we might have to deactivate WFS on these layers before publication. I was waiting for feedback from colleagues, but I guess they are subdued with the one or other form of corona-fatigue :-) We could maybe anonymise the feedback location some other way? Let's discuss.

janschulte commented 3 years ago

Maybe it's a an option to randomize the sended feedback location on client side in a little range? Then the accurate position is only known in the client. Then we can use the WFS instead of the WMS...

For example the client randomizes the digits after the second decimal place, see here for the precision: https://en.wikipedia.org/wiki/Decimal_degrees

opeeters commented 3 years ago

Do you mean sending only the randomised feedback location? E.g. to neighbourhood, street level? But that only the user will see the exact location of their own feedback? If we add the uuid transmitted during submission to the WFS output you could filter with this (this might be an additional privacy issue). But maybe this would be taking it too far. I'm just a bit worried that the randomisation would come across as buggy.

janschulte commented 3 years ago

Do you mean sending only the randomised feedback location? E.g. to neighbourhood, street level? But that only the user will see the exact location of their own feedback?

Yes, that was my intention.

If we add the uuid transmitted during submission to the WFS output you could filter with this (this might be an additional privacy issue). But maybe this would be taking it too far. I'm just a bit worried that the randomisation would come across as buggy.

If we use a WMS with the exact feedback positions, every wms consumer can also see the location on the map, is this a great difference to my suggestion to work with a WFS. Are you not able to remove the transmitted UUID regarding every feedback before you publish the feature in a WFS?

janschulte commented 3 years ago

But if WFS is not an option, we can go with the WMS...

opeeters commented 3 years ago

With a WMS tile you have considerably less precision depending on the size of the icon being used or we could adapt the stylesheet in such a way that it's difficult to identify the exact location of an individual feedback.

No, the current WFS-prototype is not transmitting the uuid (see https://geo.irceline.be/belair/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=belair:feedback_total&outputFormat=application/json). How would you be able to identify a feedback item being sent back by the WFS call for the location of the user? The DB also hold a sequenced feedback_id. We could have the php-script return this feedback_id upon successfully registration of the feedback to the client. I just added feedback_id to the WFS return.

janschulte commented 3 years ago

No, the current WFS-prototype is not transmitting the uuid (see https://geo.irceline.be/belair/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=belair:feedback_total&outputFormat=application/json). How would you be able to identify a feedback item being sent back by the WFS call for the location of the user?

Until now I did not plan to identify the feedback item. As far as I understand to workflow is the following:

If I am wrong, maybe a short telco is the best way to discuss this process?!

opeeters commented 3 years ago

Well, correct, but you will also send a WFS-call to get the feedback of other users. This return will also include a modified location of the feedback which was send by the user who is viewing the data. Same feedback, two locations within close proximity. Displaying only the modified location would probably come across as the app just not getting it right. But let's try it out. We can maybe add a notice to the bottom of the map explaining that the location is sightly modified before submission, at random, to protect the privacy of users sending feedback.

janschulte commented 3 years ago

Great, I will do the implementation at the beginning of next week.

janschulte commented 3 years ago

Do you have the icons which you are use in the wms layer? I render them to the corresponding feedback_code. You can add them somewhere in the assets folder...

opeeters commented 3 years ago

I used these icons: 0 - assets/images/icons/inline.svg 1 - assets/images/icons/not_inline.svg 2 - assets/images/icons/woodburn.svg 3 - assets/images/icons/traffic.svg 4 - assets/images/icons/agriculture.svg 5 - assets/images/icons/industry.svg

see 7e9188c

janschulte commented 3 years ago

Thanks, I implemented the WFS version now: 5735a6a25c5e92b2264a7360aa3794d35f2c0b86

opeeters commented 3 years ago

Steps to reproduce