Inspiration

Checking the weather is like checking your emails - you do it when you're extremely bored, or when you're forced to for some reason. Being a new resident in Buffalo NY, being prepared for erratic weather is something I've had to deal with and thus being forced to check the weather is why I've been much more active on my Weather app than I have ever had to. And it's not just me. Local Buffalo-ans also struggle to get ready for the ever-changing weather, but I suppose they've pretty much gotten used to walking in unexpected icy cold rains and dressed sluggishly on warm sunny days. This piece of software aims to remedy all that.

What it does

Simply, it pushes you a notification about how you should get ready and offers you a brief summary of the weather today 20 mins before you leave your home. An extended functionality that we offer is a summary of the weather to expect tomorrow, also in the form of a notification. Never overdress, underdress or even check the weather to decide the dress code ever again!

How we built it

Due to limitations in mobile development skills and time, we quickly abandoned the idea of making this software mobile. Instead, we were set on making this a desktop piece of software (notice how I call this a "piece of software" and not an app, as will be clear later). First, we take user input (what time they wanted to receive these notifications daily, location info) in the command line. We used the openweathermap/geo API to convert the zip code provided into latitude and longitudes. Next, we used the One-Call weather API and got only saved what we needed. We did some processing of the data we got, and we passed into a Python function that does desktop push notifications. The software should infinitely loop until the next specified "time for push notification". The code base is almost entirely Python. Now, the way the software is meant to interact with a user is at 2 stages only: once during info insertion and during the push notifications. Since notifications are pushed onto the system itself, it's closer to a system call than an app that you'll have to use.

Challenges we ran into

Using the various APIs and pushing notifications were new for both of us, and thus took a fair amount of our time. As mentioned earlier, we didn't have any mobile development skills and thus were constrained to only making this desktop. Due to lack of time, we also gave up on building a nice-looking UI for user inputs, instead opting to just use the command line as a proof-of-concept.

Limitations

(ps. this is a field we added ourselves for thoroughness)

  • This software assumes the day's weather doesn't change. While that may be true for the most days, it's not quite true for all days.
  • This software assumes users don't want to change their preferences in the future. More time on this project would solve this easily
  • It also assumes the terminal running this code will stay on forever.
  • It assumes users maintain that strict routine 24/7. This is obviously not true. GPS systems were considered however, it would be tedious work, so we let this suffice for now.
  • Robust testing was pretty close to impossible. Since the software is meant to be time-sensitive and thanks to our use of system time, testing long term is impossible. A better implementation would have been to decouple system-time-retrieval and calls to notify(), such that we could simulate system time ups to trigger notify().
  • Your system may need to install several packages before usage.
  • The system assumes a few "well form-ness" of inputs. We ignore some of these checks due to time.
  • Some values such as the threshold for cold is hard coded. Perhaps more versatility on the users end would be better.

How to use Nofity-Weather

1) Make sure you have the following packages:

  • We suggest you run the following command lines on your console even if you think you have it.
  • pip install plyer
  • pip install schedule
  • pip install requests
  • We acknowledge that in Windows systems these imports result in WARNINGS. Ignore it.

2) Run the code as you normally would run any Python script from the file main.py.

3) At the terminal, input where prompted

  • You may hit your "Enter" key for whatever input you wish to omit. For example, if you think your phone number is not necessary, simply skip over it.
  • You MUST provide us with a zip code at the very least.
  • Inputting zip codes should be in the format: [Numbers 0-9], no space. Example, 14228
  • Any time related inputs MUST be in 24 hour format. Example, 3.30pm == 1530 and 2.00am == 0200
  • In general, just follow closely to the instructions at the prompt.

4) Wait. When the time comes, you will receive a push notification with an exciting little message.

Accomplishments that we're proud of

Once started, the code works for a long time without "stack overflowing", because the way the system spins is within a while loop and new stacks are opened every time a new call for update happens. Eventually it will overflow, however given the RAM capacities of today, a bi-yearly re-instantiation of the runtime or a more robust algorithm would work fine. Admittedly, it consumes a lot of wasted CPU time, however it was the only way we could think of to implement a time sensitive operation. What this means is, in theory, as long as you didn't mind your terminal running forever in the background, this piece of software is NEARLY production ready. Also, the code base was carefully planned such that functionality is as uncoupled as possible, for example, we had a class each for getting the APIs, initial user input, notification body generation and the actual push notification function. Debugging, testing, and extending functionality should be relatively simple. To close, this software has been tested to work on Windows, macOS and Linux based operating systems.

What we learned

Using APIs and delivering push notifications on desktop.

What's next for Notify-Weather

  • A developer mode. A friendly platform for testing code.
  • Functionality for users to change their preferences of time and location.
  • Exportability to mobile and integration as a software extension on desktop.
  • A more user-friendly UI for user input.
  • Possibly, a GPS system instead of user inputs. Provides more automation and a more hands-free experience for the user.
  • A more involved notification message.
Share this project:

Updates