earthobservations / wetterdienst

Open weather data for humans.
https://wetterdienst.readthedocs.io/
MIT License
349 stars 54 forks source link

Where to implement wetterdienst-browser? #347

Closed meteoDaniel closed 3 years ago

meteoDaniel commented 3 years ago

Dear all,

I have built a data browser for the wetterdienst weather station data. Before starting a pull request, I would like to know where It should be placed. In this project? or In a separate project?

Best regards

Bildschirmfoto vom 2021-02-08 07-18-39

amotl commented 3 years ago

Hi Daniel,

thanks a stack for this very nice contribution. Looking forward with big appreciations!

I am leaning towards the "monorepo" style of development and would favor to put the UI into this repository itself. So, we will not have to maintain two separate repositories and will be able to integrate software tests for the user interface into the test harness of Wetterdienst itself in order to be able to keep them coherent when applying changes to one or another (HTTP API vs. Web UI).

So, I believe that would fit:

a) Put package.json (and an eventual webpack.config.json) into the root folder. b) Put the HTML/JavaScript/CSS sources into a toplevel folder called ui.

After that, we will make the JS-bundling part of the build machinery and ephemerally put the bundle into a folder within the wetterdienst Python namespace to make the Python package ship the ready-made UI bundle in order to make a FastAPI endpoint ship it to the browser.

In that manner, users will be able to invoke the UI without further ado.

pip install wetterdienst
wetterdienst service
open http://localhost:7890/

I will be happy to take care about these bundling and packaging details in order to relieve this burden from your end. Just go ahead and submit a patch with the sources if you are ready.

With kind regards, Andreas.

P.S.: @jwillmer will probably also like this, see #342.

jwillmer commented 3 years ago

Wow, looks great @meteoDaniel ! How do you define the range in the UI? I see you can select history data in your screenshot and a time resolution. Does that mean it will display all history data (in the defined resolution) or can you set a date range?

@amotl thx for mentioning ;)

meteoDaniel commented 3 years ago

@amotl thanks a lot for the breef update. The interface is fully written in python, at least plotly and dash are required. ;)

@jwillmer Actually there is no "Range" parameter. Per default all data in the file will be shown. You can select a range by mark it with your mouse. E.g. like this: https://plotly.com/python/line-charts/

amotl commented 3 years ago

The interface is fully written in python, at least plotly and dash are required. ;)

I see. So, it will use the wetterdienst package as a direct dependency and provide its own HTTP API or does it use the already established FastAPI endpoints of Wetterdienst? I am curious!

If you like, just upload it right away to a repository called wetterdienst-browser (or wetterdienst-ui?) as you suggested already and then we will check together if we will follow the "monorepo" path I suggested or if we rather keep it separate?

I appreciate your efforts going forward on this already very much, so you might be keen on leaving the long-term maintenance to us and also the freedom how this would fit best most efficiently? Integrating it into Wetterdienst itself would be most convenient because - as said - it would reduce maintenance overhead of having to care for different repositories.

The most appropriate place - if it's really Python code only - would probably be the wetterdienst.service package namespace. However, this is currently occupied with the bare service.py file. So we should move that into a subfolder first.

Let me know what you think about this.

Edit: Here you are [1]. We might delete that repository again after integrating both code bases into each other.

[1] https://github.com/earthobservations/wetterdienst-ui

meteoDaniel commented 3 years ago

@amotl I have made a first draft. I hope you like it. Under issues I have listed features I am willing to implement within the next weeks.

Note: Testing is difficult for GUI's. I am working on that.

amotl commented 3 years ago

Hi Daniel,

thanks a stack. If I can find some time, I also might be able to approach your work to improve it on some ends (no promises, though). How data is served to the browser there [1] is very interesting. I always wanted to use Dash and it is nice to see such a real-world example building on top of the Wetterdienst package. Great stuff, I like it!

With kind regards, Andreas.

P.S.:

Note: Testing is difficult for GUI's. I am working on that.

Sure, no worries. When approaching that, you might want to look at the test suite of Dash itself [2], where they probably have appropriate and clever helpers to support that job.

[1] https://github.com/earthobservations/wetterdienst-ui/blob/master/ui/app.py [2] https://github.com/plotly/dash/tree/dev/tests/integration

gutzbenj commented 3 years ago

The ui has now found its way into the main repo where further improvements should be placed and aligned with latest changes in the API. Once again thanks to @meteoDaniel for this nice contribution!

amotl commented 3 years ago

Dear Daniel,

I have been meaning to catch up with you to thank you again for your excellent contribution of the web-based user interface on behalf of Wetterdienst UI, but time flies. So, here we go -- big kudos to you!

We integrated it into Wetterdienst itself through #398 and renamed it to Wetterdienst Explorer the other day. The patch has been accompanied by respective tests which will help us to employ continuous maintenance of the whole code base in order to prevent both pieces getting out of sync. I hope you like it.

With https://github.com/earthobservations/wetterdienst-ui/commit/faffa31, I just added a corresponding note and archived the former repository.

With kind regards, Andreas.