Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle STA v1.0 services #4

Open
rduivenvoorde opened this issue Jun 29, 2023 · 1 comment
Open

Handle STA v1.0 services #4

rduivenvoorde opened this issue Jun 29, 2023 · 1 comment

Comments

@rduivenvoorde
Copy link

In NL there is a public v1.0 STA service. It is based on: https://github.com/gost/server.

Because I thought to be able to make the plugin maybe backwards compatible I tried to debug and fix stuff. But I fail to debug the Python/Javascript bridges.

The URL: https://api-samenmeten.rivm.nl/v1.0/Locations

On https://github.com/AirBreak-UIA/SensorThingsAPI_QGIS-plugin/blob/main/providers/provider_frost.py#L289
I changed

query.addQueryItem('$orderby', '@iot.id+asc')

to

            # RD: not sure, but GOST 1.0 does not return values if using @iot.id+asc, so this COULD be a GOST only hack:
            if 'v1.0' in url.path():
                query.addQueryItem('$orderby', 'id+asc')
            else:
                query.addQueryItem('$orderby', '@iot.id+asc')

to be able to at least see the locations.

But, though there is a link to Observations in Sensor:
https://api-samenmeten.rivm.nl/v1.0/Datastreams(7343)/Sensor

The 'Open Measurements dialog' button in the table is never available.

Crux seems to be this line: https://github.com/AirBreak-UIA/SensorThingsAPI_QGIS-plugin/blob/main/html/templates/js/location.js#L215

As there is (apparently, not sure if this is GOST specific, or v1.0 specific) never a phenomenonTime field in the Datastream object:
https://api-samenmeten.rivm.nl/v1.0/Datastreams(7343)

By disabling that check, I'm able to at least get the button, but after that I'm stuck, as I fail to be able to debug/step through the javascript/jinja2 template code (using Pycharm Professional, here with 'Python Debug Server' debugging.

So I'm wondering what is an easy way to debug this.

Note: my hope is to show this plugin to the owner of the service and convince them to move to Frost/newer STA versions...

Any hints appreciated.

@rduivenvoorde
Copy link
Author

rduivenvoorde commented Jun 29, 2023

Ah my colleague Matteo just pointed to QWebSettings.DeveloperExtrasEnabled so you can make the Debug view availble for QWebView...
Which I find here: https://github.com/AirBreak-UIA/SensorThingsAPI_QGIS-plugin/blob/main/sensor_things_browser.py#L259

So I should 'just' make sure PLG_DEBUG == True :-)

See: https://github.com/AirBreak-UIA/SensorThingsAPI_QGIS-plugin/blob/main/__init__.py#L8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant