Rails ActiveRecord 数据分析
我正在寻找一个基于 Rails ActiveRecord 的 Gem 来提供数据分析,以便我可以趋势数据的变化。想象一下:
class Report < ActiveRecord
scope :overdue, lambda { where :due_date <= Time.now }
profile_counts overdue, :frequency=>:nightly
end
这个想法是“profile_counts”方法将附加到一些全局数据分析表,该表将随着时间的推移对延迟报告的计数进行趋势分析。
请就宝石、最佳实践等提出建议。
I'm looking for a Rails ActiveRecord based Gem to provide data profiling so that I can trend changes in the data. Imagine:
class Report < ActiveRecord
scope :overdue, lambda { where :due_date <= Time.now }
profile_counts overdue, :frequency=>:nightly
end
The idea would be that the "profile_counts" method would append to some global data profiling table that would trend the count of late reports over time.
Please advise on gems, best practices etc.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许我不明白这个问题,但是一个简单的 cron 作业每天运行不会做你想做的事吗?
趋势表中只有日期(日期时间)和逾期(整数)列?
我想你可以推出一个使用 Rufus::Scheduler 或每当 gems 的插件,但对我来说这看起来有点矫枉过正。
Perhaps I don't understand the question, but wouldn't a simple cron job, run daily, do what you want?
where the trends table has only date (datetime) and overdue (integer) columns?
I guess that you can roll a plugin that will use Rufus::Scheduler or whenever gems, but it looks like an overkill to me.
我不认为有一个 gem 可以自动执行此操作,但我认为安排一个作业只需跟踪
scope
的count
就足够容易了,然后您可以随时间查询它以用于报告目的I don't think theres a gem that does this automatically but I think it would be easy enough to have a scheduled job just keep track of the
count
of ascope
and then you can query it over time for reporting purposes