Coder Social home page Coder Social logo

cclauss / achoo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tmthyjames/achoo

1.0 2.0 0.0 27 KB

Achoo uses a Raspberry Pi to predict if my son will need his inhaler on any given day using weather, pollen, and air quality data. If the prediction for a given day is above a specified threshold, the Pi will email his school nurse, and myself, notifying her that he may need preemptive treatment.

License: MIT License

Python 71.87% R 26.07% Shell 2.06%

achoo's Introduction

Achoo

Achoo uses a Raspberry Pi to predict if my son will need his inhaler on any given day using weather, pollen, and air quality data. If the prediction for a given day is above a specified threshold, the Pi will email his school nurse, and myself, notifying her that he may need preemptive treatment. TUTORIAL COMING SOON

Prompted by this reddit post. Lots of great ideas in there.

UPDATE

I will be updating this readme fairly often for the next week or two to make sure the code and instructions are as readable as possible.

First, you'll want to declare a few environment variables:

FROM_EMAIL - the sender's email address.
TO_EMAIL - the email addresses to send the alerts to.
GMAIL_PASSWORD - to send emails (if you don't already have one) you'll need to register an app with gmail.
USERNAME - the PostgreSQL username (or other database).
PASSWORD - PostgreSQL password.
DARK_SKY_API_KEY - for the weather data, I'm using Dark Sky. You get 1,000 free hits a day. Their pricing is really affordabe.
DARK_SKY_LOCATION - The latitude, longitude for the location you'll be tracking.
POLLEN_ZIPCODE - The zipcode you'll be tracking.

For now, the work flow is reflected in the bash script that runs daily:

#!/bin/bash
Rscript train_model.r &&

python get_allergy_data.py && python get_weather_data.py && python get_air_data.py &&

Rscript run_model.r &&

python get_resutls_send_email.py
  1. Train the model (this assumes we have data, so I'll upload some test data that I've been using)
  2. Get all weather, allergy, and air quality data
  3. Run the model (this will write the results to the database after every run)
  4. Retrieve the results (this is the step that sends the email if the prediction is greater than X).

This bash script currently runs as a cron job.

To record the inhaler/breathing treatment data, you'll run treatment_tracker.py from your Raspberry Pi like this:

$ python treatment_tracker.py &

I have two buttons on my Pi: one for his breathing treatment, the other for his inhaler (pics and a blog post coming soon).

Outstanding questions

  1. Is there a better way than using a cron job?
  2. The Raspberry Pi isn't ideal. Maybe we should be using Nomie 2 to record events? (HT to sujins for this suggestion). I'd like to make it easy for the user to add their own method and their own host for storing data.
  3. I have a feeling many users will want to easily add their own models (Nueral Networks, GBMs, GLMs, etc.). What is the best way for users to add their own models?
  4. Should we support two languages? Currently I'm using Python and R.
  5. I still have a lot of architectural concerns about this project so far, but I'm hoping things will be more smooth as a couple weeks' worth of development pass.
  6. LONG TERM: How to make this non-developer friendly? How can the typical person with allergies/asthma make use of this day-to-day? Can we make this a mobile app? I think this is my end goal.

achoo's People

Contributors

tmthyjames avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.