ryansurf / cli-surf

Get surf and ocean data from the command line interface
7 stars 10 forks source link

Streamlit adding surf #44

Open ryansurf opened 1 month ago

ryansurf commented 1 month ago

@K-dash

Messed around with streamlit and got it working! (still a little rough)

It can now take a surf spot as input, and display a map that shows the spot along with a line graph of surf heights/swell periods

I think streamlit is what this project needed. This is also a draft PR, let me know what you think

example.webm

Edit: Updating this PR. In this update I enabled the user to use the GPT and added an option to hide the map

Here is a demo of the new functionality:

demo.webm

Also, is it best practice for me to update the PR like I just did, or perhaps create another PR/branch? Unsure

github-actions[bot] commented 1 month ago

Coverage

Coverage Report
FileStmtsMissCoverMissing
src
   __init__.py00100% 
   api.py101694%30, 48, 70–71, 103–104
   art.py9367%24–25, 37
   cli.py25580%26, 37, 55–56, 60
   dev_streamlit.py37370%1–85
   gpt.py10640%16–21, 32–45
   helper.py1575863%53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 91, 102–106, 132, 134, 136, 145–153, 165, 178–179, 197–199, 209, 211–212, 235–236, 274–284, 291–299
   send_email.py24240%5–48
   server.py41410%5–82
   settings.py220100% 
   streamlit_helper.py33330%5–90
TOTAL45921354% 

Tests Skipped Failures Errors Time
9 0 :zzz: 0 :x: 0 :fire: 14.106s :stopwatch:
K-dash commented 1 month ago

I'm glad it seems to have worked well. Yeah, I think it's a good idea to adopt Streamlit! I'll list the things I think we should do in the future and the things that need to be considered, based on what comes to mind at this point.

Things I think we should do

Things that need to be considered

ryansurf commented 1 month ago

Allow users to input query parameters that were being sent from the Curl command as Streamlit input fields

I agree. Wondering if we should let the user input something similar to the cli args, like show_wave,color=purple,gpt etc. or we can use some toggles(like GPT=on/off)

Validation of input parameters (create a validation model in pydantic-settings)

Yep, its pretty easy to break the server at the moment

Visualization of weather forecast information

This would be the coolest feature imo. We have the pre-built map, but its not very useful. Something like this would be ideal (shows wind, wave height). I'm not sure how we would implement this ourselves

How to utilize GPT

I have an idea of how to do this. Simply have a on/off toggle for the GPT, and it its switched to "on" we can add gpt to the arguments, which is this line(64): surf_report = cli.run(args=["placeholder",f"{location}"]) -> surf_report = cli.run(args=["placeholder",f"{location}",gpt])

As for the name, I agree haha. Perhaps self-surf, selfHosted-surf or sh-surf?

K-dash commented 1 month ago

I agree. Wondering if we should let the user input something similar to the cli args, like show_wave,color=purple,gpt etc. or we can use some toggles(like GPT=on/off)

I have an idea of how to do this. Simply have a on/off toggle for the GPT, and it its switched to "on" we can add gpt to the arguments, which is this line(64): surf_report = cli.run(args=["placeholder",f"{location}"]) -> surf_report = cli.run(args=["placeholder",f"{location}",gpt])

I think it's good!

This would be the coolest feature imo. We have the pre-built map, but its not very useful. Something like this would be ideal (shows wind, wave height). I'm not sure how we would implement this ourselves

This seems like a great site that would be useful for surfers. It shows surf spots in Japan as well. I'm curious how they've accomplished that, but they likely have data on surf spots around the world. In any case, it would be difficult to implement similar functionality unless there is an API available to obtain information about surf spots...

As for the name, I agree haha. Perhaps self-surf, selfHosted-surf or sh-surf?

It's hard to decide on a name, isn't it? Haha. Maybe we can decide once the concept is more solidified!

K-dash commented 5 days ago

@ryansurf Long time no see! It seems you haven't been active on Github lately. Are you busy? I was curious about the progress of the Streamlit implementation, so I decided to check in here😎

ryansurf commented 5 days ago

@ryansurf Long time no see! It seems you haven't been active on Github lately. Are you busy? I was curious about the progress of the Streamlit implementation, so I decided to check in here😎

@K-dash welcome back! Indeed, work got a little busy so I haven't been active on GitHub as much lately.

A few months ago when we were working more consistently on this project I submitted a PR to have the project be added to the up for grabs website. The PR was approved about a week ago and now some more people are finding out about our project! I'm dedicating more time to work on it going forward

K-dash commented 5 days ago

@ryansurf Long time no see! It seems you haven't been active on Github lately. Are you busy? I was curious about the progress of the Streamlit implementation, so I decided to check in here😎

@K-dash welcome back! Indeed, work got a little busy so I haven't been active on GitHub as much lately.

A few months ago when we were working more consistently on this project I submitted a PR to have the project be added to the up for grabs website. The PR was approved about a week ago and now some more people are finding out about our project! I'm dedicating more time to work on it going forward

Good initiative! Please feel free to contact us if you need anything else:).

ryansurf commented 3 days ago

Hey @K-dash, I think we should merge this PR now.

The streamlit site is working well enough (definitely still needs some work), and I've updated the docs detailing how to run it.

At the moment I suppose we'll keep the other html/css frontend :flushed:

I've also made some slight updates to introduce the new make commands in the documentation, like make install, make lint and make format.

Let me know what you think! This PR might seem large but its mostly just the streamlit implementation

K-dash commented 3 days ago

Hey @K-dash, I think we should merge this PR now.

The streamlit site is working well enough (definitely still needs some work), and I've updated the docs detailing how to run it.

At the moment I suppose we'll keep the other html/css frontend 😳

I've also made some slight updates to introduce the new make commands in the documentation, like make install, make lint and make format.

Let me know what you think! This PR might seem large but its mostly just the streamlit implementation

I agree! I've commented on a few minor points. Thank you for merging the Makefile PR!