Coder Social home page Coder Social logo

mood's Introduction

[deprecated] I'm now using FxLifeSheet for my mood tracking


mood

I have looked in the mirror every morning and asked myself: "If today were the last day of my life, would I want to do what I am about to do today?" And whenever the answer has been "No" for too many days in a row, I know I need to change something.

Steve Jobs

Background

I've been a heavy user of 1 Second Everyday, where I created a very personal video of the full year for the last 730 days. (Check out a public sample video here)

One thing I noticed is that I associate the mood and happiness when seeing the videos, however, I know that this will slowly fade away as time passes.

I wanted a way to track my overall happiness and excitement in my life, allowing me to monitor, analyze and react to it. As Steve Jobs said, if you notice a downwards trend, it might be time to apply some changes to your life.

How it works

It's a simple Telegram Bot that will send you a message 3 times a day:

  • One in the morning (I'd never reply to the bot before showering)
  • One after lunch
  • One when going to bed

You can always just text your bot a number, however, I know I'd forget it. That's why the bot sends you those reminders.

It then pulls up this really nice, optimized keyboard in Telegram, with a short description of what each number means.

If you forget to track a day, that's no big deal at all. The database is simple, it looks like this:

@_db.create_table :moods do
  primary_key :id
  DateTime :time
  Integer :value
end

I decided not to store the information about breakfast, lunch and dinner, as it would make time zones more complex, as I'm traveling quite a bit.

Future

Graphs

I want a nice visualization page & dashboard for this. Maybe even just send a weekly and monthly summary via Telegram?

Right now, just send /graph to your bot to get your historic mood as a simple graph.

Alerts

I want my bot to alert me when it detects a downwards trends. Similar to the stock trading approach, I was thinking of using the 7d average (7 days, 3 times a day => 21 data points). It's all relative, so if there is a downwards trends for 2 weeks, there probably is something bothering you

Integration into 1SE

I usually edit the 1SE videos slightly to have "subtitles" for some of the important life events. Additionally, I throw in the classic Every day of my life music.

Additionally, with that data, I want to overlay my happiness level somehow, probably in the form of a graph, a bar, or a wave. Not sure yet, but I got 11 months to figure that out.

How to use it

You'll have to setup a few things

  • Create a Telegram bot using @BotFather and get the API key, and message ID with you
  • Provide those values using TELEGRAM_TOKEN and TELEGRAM_CHAT_ID
    • To get the TELEGRAM_CHAT_ID, send a message to your bot and then access the following URL in your browser https://api.telegram.org/bot[TELEGRAM_TOKEN]/getUpdates. You'll see a message, and within that, the Chat ID to use
  • And host it on any server, like Heroku, and use the Heroku scheduler feature to call rake morning, rake noon and rake evening
  • Make sure the Heroku worker is enabled

mood's People

Contributors

ashfurrow avatar krausefx avatar orenyomtov avatar revolter avatar rsrbk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mood's Issues

Porting to Google Script

I am interested in using the project to another service, hopefully free, for personal use. Heroku seems to be a great solution but it is limited to restrictions such as Dynos down and not using Webhooks seem to be an issue.

The main targets could be:
1- Porting to a service such as GoogleScript
2- Rewriting the time triggering for the three request each day.
3- Plotting or reporting section.

Do you think if could be done based on this project?

Scheduling Add-on?

Hey, just curious how you automate the tasks for rake morning etc? Do you use a Heroku Add-on? Or have a server somewhere?

Undefined method `strip` for nil:NilClass

First off, I wanted to say that Mood has been pretty awesome so far.
Thank you for building it, I really enjoy using it ๐Ÿ‘

I noticed that my bot stopped responding after a bit so I checked out the Heroku logs and noticed that there was a crash. I'm unsure how this happened as it seemed like no invalid input was entered.

2018-02-22T17:29:52.170356+00:00 app[worker.1]: error sending the telegram notification
2018-02-22T17:29:52.170379+00:00 app[worker.1]: undefined method `strip' for nil:NilClass
2018-02-22T17:29:52.170381+00:00 app[worker.1]: /app/telegram_handler.rb:31:in `block (2 levels) in listen'
2018-02-22T17:29:52.170383+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/telegram-bot-ruby-0.8.6.1/lib/telegram/bot/client.rb:38:in `block in fetch_updates'
2018-02-22T17:29:52.170385+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/telegram-bot-ruby-0.8.6.1/lib/telegram/bot/client.rb:33:in `each'
2018-02-22T17:29:52.170386+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/telegram-bot-ruby-0.8.6.1/lib/telegram/bot/client.rb:33:in `fetch_updates'
2018-02-22T17:29:52.170388+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/telegram-bot-ruby-0.8.6.1/lib/telegram/bot/client.rb:25:in `listen'
2018-02-22T17:29:52.170389+00:00 app[worker.1]: /app/telegram_handler.rb:30:in `block in listen'
2018-02-22T17:29:52.170391+00:00 app[worker.1]: /app/telegram_handler.rb:85:in `perform_with_bot'
2018-02-22T17:29:52.170394+00:00 app[worker.1]: server.rb:3:in `<main>'
2018-02-22T17:29:52.170393+00:00 app[worker.1]: /app/telegram_handler.rb:29:in `listen'

This below screenshot is what I last entered prior to the responses stopping.
I added a small workaround to check for a nil message.text prior to parsing the input which happened at 1:32pm which seemed to resolve the issue. I'm curious to how this became nil though...

screen shot 2018-02-22 at 6 03 45 pm

If you're accepting PRs, I can send a fix that checks if the text is not nil but otherwise I wanted to give a heads up.

Heroku free tier: dynos going idle after 30 minutes and then not waking up

Hi,
I have hosted this bot on the free tier of Heroku. As the bot uses long polling, when the dynos go idle after 30 minutes, they aren't awoken anymore when I send new requests through Telegram.

Some of you are running this bot successfully on the free tier of Heroku, right? How? Have you implemented webhooks onto this or something?

Can I self host the db?

Not saying I don't trust you, and this PII isn't too bad to leak, I was simply wondering if you had thought about this at all

EDIT: PS this is awesome. I'm loving all these side projects you're pushing out ๐Ÿ™ƒ

Implicitly setting TELEGRAM_TOKEN and TELEGRAM_CHAT_ID values?

How can we implicitly set the values of TELEGRAM_TOKEN and TELEGRAM_CHAT_ID? So that the actual values aren't in plain sight in telegram_handler.rb.

I tried setting them as environmental values on my local machine, typing these lines in ~/.profile:

export TELEGRAM_TOKEN="<my-telegram-token>"
export TELEGRAM_CHAT_ID="<my-chat-id>"

But I guess that doesn't work when the bot is hosted on the cloud (Heroku).

My implementation of this bot is not working and I suspect it might be because of this.

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.