Skip to content
/ mara Public

A bot-driven approach to chronic pain tracking and forecasting

Notifications You must be signed in to change notification settings

Schwad/mara

Repository files navigation

Mara Gitter chat

Maintainability Build Status Coverage Status Inline docs

Mara Slack

Discussion

This application commands a registered Telegram bot to interface with individuals for chronic pain tracking. The bot is here.

This primarily relies on the fantastic telegram_bot gem built by the wonderful @eljojo.

Ruby on Rails

This application requires:

  • Ruby 2.4.4
  • Rails 5.2.0

General Notes

MaraBot does not currently persist or 'remember' conversation state and history, although this is likely to change in the future.

The Bot is run as a background job with Sidekiq/Redis, and is initialized in the Procfile like so:

web: rake mara:start && bundle exec rails server -p $PORT

To work with MaraBot in development, you fire it up with rake mara:reset (kills any active bots and starts a new one). If you are going from scratch, this will likely involve booting your redis-server, then sidekiq, then rake mara:reset. This implementation is likely to be revisited as we set up webhooks

This application uses the Interactor design pattern (implemented with the interactor gem) to process bot interactions.

For further background, here is an unofficial talk about this project given at Isle of Ruby:

VIDEO

Webhook setup in development

The best way to use telegram bots long term is with webhooks. You can read more about them here.

  • Set environment variables for :bot_host (the ngrok url), :mara_bot_key and 'webhook_key'

  • rails s

  • ngrok http 3000 (you will need ngrok)

Adding yourself as a user

This should happen immediately whenever someone contacts the bot. Again, in production this is meant to be a bot-only interface (except for analytics on our end). Hooking in, getting out, should be open for the user in the interactions with MaraBot.

Documentation and Support

Full documentation for this application is available here. In development, update the documentation files with rake rdoc.

Key technologies:

Misc

  • Check how many hits to Wunderground API we are receiving here

Contributing

See CONTRIBUTORS.md

Credits

Todo

  • Build out utility to store and track data results over time (users - strategies - accuracy - daily)
  • Build out script to run in memory and write writeable data

License

Copyright 2018 Nick Schwaderer

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

A bot-driven approach to chronic pain tracking and forecasting

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published