NatVIII / rva.rip

The missing LGBTQ+ events board for Richmond, VA
https://rva.rip/
GNU Affero General Public License v3.0
9 stars 5 forks source link

Weather Report #76

Open NatVIII opened 4 months ago

NatVIII commented 4 months ago

Is your feature request related to a problem? Please describe. rva.rip is great for showing events, however, it can easily show just one more piece of information that could make it people's instant destination for information in RVA. It could also display the weather for today, and the next three days after that.

Describe the solution you'd like Display the temperature, in Fahrenheit, for today, and the next two days after, along with a small icon showing the state of the weather for the day in the style of the rest of the website. Display it in the top of the day's display, next to where the date is shown. If the temperature is clicked it should link to Accuweather or whatever API source that the weather is coming from for a more detailed view.

NatVIII commented 4 months ago

In addition, it should be enabled or disabled in the .env, along with the API key for the weather provider and location (which will be Richmond for this but in other environments will be whatever city).

Inglonias commented 2 months ago

A quick Google search shows that https://www.weatherapi.com/ provides most, but not all of the desires features for free. The big missing feature is a link to a more detailed forecast.

The accuweather API does have a free plan, but that plan is rate limited to fifty calls a day. I would suggest if a developer goes that route, they hit the API every hour and cache the results.

Inglonias commented 2 months ago

I'm planning to try to tackle this. Current plan is to use the accuweather API and cap it at one request per hour, with the widget refreshing once the next person visits the page after that timer is up.

NatVIII commented 2 months ago

This would be so awesome! Thank you so much @Inglonias

Edit: Feel free to reach out if you need any help getting the dev environment set up or how the systems connect to each other

Inglonias commented 2 months ago

Worth mentioning that AccuWeather has branding requirements - This may or may not be acceptable to you:

BRANDING REQUIREMENTS: You are required to display proper attribution when using AccuWeather APIs. Please include the AccuWeather logo, linked to our website (http://www.accuweather.com/) in clear view on your app or product. AccuWeather logo with linking must appear on all pages/screens where AccuWeather content appears, as stated in the Terms of Use.

The dropbox link doesn't work, but getting a png of their logo was dead simple anyhow.

NatVIII commented 2 months ago

Good eye @Inglonias ! I totally would have missed that. That sounds amenable, our emote system is already working so we can simply add an attribution towards the bottom of the page as non-intrusively as possible. Feel free to continue cracking away, I can try and pitch in if you need any help :heart:

Inglonias commented 2 months ago

Using Accuweather is probably not going to fly. Based on what I'm seeing, Accuweather limits you to fifty calls a day without paying them. My plan was to store that data for half an hour tops on the server itself and retrieve it when necessary. My research shows that the best way to store data like that is in a database. This application does have support for a prisma database, but I don't think you're using that functionality, and I don't want to force you into setting all that up just for little ol' me. I wouldn't want to do it.

https://www.weatherapi.com/ should be simpler all around - We can call that API up to a million times a month for free. You're the server admin, so you'd be able to tell me if you're getting more than a million hits a month, but my guess is that barring a DDOS attack, you're not. The population of Richmond is ~250k, and if a significant portion of the city uses this website, then we might need to upgrade switch the weather app off, but I don't think that's happening.

We would lose a built-in link to a more detailed forecast, but that's easy to work around - just post a link to the forecast on accuweather's website below the widget and make a note that the data sources aren't the same.

NatVIII commented 2 months ago

Actually @Inglonias I failed to mention this before, but the caching system already only really pulls new information every 30 minutes. Sure we could be pushing it slightly, but, if accuweather's API allows 50 pulls a day we'd totally be within parameters for the free plan. If it's not hard to implement, I'm cool with it!

Inglonias commented 2 months ago

If this function is sufficient for caching, then I'll use it for accuweather calls. I didn't see any databases for caching which is what confused me.

Inglonias commented 2 months ago

Took me a while to work out, but Nuxt and Nitro are bundled together, and Nitro does provide caching capabilities which you are using correctly.

Inglonias commented 3 weeks ago

I wanted to give you an update. For a variety of reasons, I have been putting this off, but I spent a good few hours working on it today. I think I have the API coming down now and all we need is to process the incoming data and make it look pretty on the page itself.

I've considered stopping after getting a strongly typed return value for others to put on the frontend, but I know that half measures are not typically appreciated in open source contributions (half-completing a feature just isn't useful).

NatVIII commented 3 weeks ago

Damn bro, that's awesome work. Keep at it! Your efforts are appreciated and I can't wait to see what comes out of your labor! Regardless it's been awesome seeing you around town, I hope we get a chance to sit down, talk, and collaborate more in the future!