This repository was archived by the owner on Aug 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
Data Models
Arun Thampi edited this page Sep 27, 2016
·
6 revisions
Botmetrics uses Postgres as its main data store and here are the different models that it uses:

- User: A User is a Devise backed model that deals with user authentication.
-
BotCollaborator: BotCollaborator is a join table used to form a relationship between a Bot and a User. A user can invite other users as collaborators to view metrics on the same bot and each time that happens a new
BotCollaboratorentry is created. (A Userhas_manyBotsthroughBotCollaborators). - Bot: A Bot is the model that backs a new "bot project" that a user might create. If you have Facebook, Slack and Kik bots, you will create three separate bots for each.
-
BotInstance: A BotInstance is a model that
belongs_toa Bot. The significance of aBotInstancevaries on the platform. For Slack, every time a new team signs up to use your bot, a newBotInstancerecord is created. On Facebook and Kik, only a singleBotInstanceexists per bot. -
BotUser: A BotUser is a model that
belongs_toa BotInstance. A BotUser represents all of the users that interact with your bot on that platform. -
Event: An Event is a model that
belongs_toboth BotInstance and BotUser. An event represents a "metric" on Botmetrics. Every time a message is sent to/from the bot (or in the case of Slack, a message that is being transmitted in a channel that the bot has access to), or an image upload, etc. is tracked in theEventmodel. -
Dashboard: A Dashboard is a model that
belongs_toa Bot. A dashboard is created every time a user creates a custom dashboard to track a custom metric. -
DashboardEvent: A DashboardEvent acts a join model between
DashboardandEvent. Whenever a new event is created, if it matches the conditions of the custom dashboard, aDashboardEvententry will be created to store the relationship between the Dashboard and the Event. (A Dashboardhas_manyEventsthroughDashboardEvents).