My Doppler Value Investing site (http://www.dopplervalueinvesting.com) uses Ruby on Rails and a Postgres database. There are two important parts: the superficial analysis and an in-depth analysis. An example of the superficial analysis is at: http://www.dopplervalueinvesting.com/stocks/FAST An example of the in-depth analysis is at: http://old.doppler.webfactional.com/sites/default/files/stock-results/FAST.html Note that the results of the superficial analysis are 1-dimensional - just parameters. This easily fits into one row in one table of a database. Note that the results of the in-depth analysis are 2-dimensional - parameters AND year. How would this fit into a Postgres database? What are your suggestions? Is it possible to have a table within a table? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/259c7f97-a656-4c3d-9b62-05a8ed4656e2%40googlegroups.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
On 13 August 2013 18:47, Jason Hsu, Android developer <jhsu802701-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> My Doppler Value Investing site (http://www.dopplervalueinvesting.com) uses > Ruby on Rails and a Postgres database. > > There are two important parts: the superficial analysis and an in-depth > analysis. > > An example of the superficial analysis is at: > http://www.dopplervalueinvesting.com/stocks/FAST > > An example of the in-depth analysis is at: > http://old.doppler.webfactional.com/sites/default/files/stock-results/FAST.html > > Note that the results of the superficial analysis are 1-dimensional - just > parameters. This easily fits into one row in one table of a database. > > Note that the results of the in-depth analysis are 2-dimensional - > parameters AND year. How would this fit into a Postgres database? What are > your suggestions? Is it possible to have a table within a table?Split it into multiple tables with associations between them (has_many, belongs to). Conceptually that can be likened to tables within tables. Have one table for each type of data. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvp%2BSOVOiFwemHEHV2Js7ky4rRyDszduk8VzsaATiFOFw%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
Jason Hsu, Android developer wrote in post #1118601:> An example of the in-depth analysis is at: > http://old.doppler.webfactional.com/sites/default/files/stock-results/FAST.html> Note that the results of the in-depth analysis are 2-dimensional - > parameters AND year. How would this fit into a Postgres database? What > are your suggestions? Is it possible to have a table within a table?Technically speaking database tables are 2-dimensional. They have columns and rows. It just happens to be that the "columns" dimension is fixed and the "rows" is variable. If you take your "Per Share Values" table that''s actually what you see. The real issue is that you have decided to present the table transposed. You have a fixed number of rows and possibly a variable number of columns (years). The data itself could be represented using a single table: +------+---------+---------+---------------+----------+ | Year | Int Vlu | Net Liq | Proj Fr Ca Fl | Pl/Pr/Eq | +------+---------+---------+---------------+----------+ | 2011 | 14.55 | -0.27 | 1.459 | 2.414 | | 2010 | 13.22 | -0.04 | 1.302 | 2.106 | | 2009 | ..... | ..... | ..... | ..... | +------+---------+---------+---------------+----------+ In this case the four numeric values are functionally dependent on the year. http://en.wikipedia.org/wiki/Functional_dependency This would be the most efficient way to store the data shown in your table. However, this is making the assumption that the four columns are fixed. If you actually have two variable sets of data then you would need multiple tables to store the data. If course the other tricky thing is laying out the stored data into your HTML table columns and rows. I would likely create an Array of Hashes from the ActiveRecord objects with the data laid out as it looks in the HTML table. This gives you the flexibility of matrix like data structure that is variable in both dimensions. This might be useful regardless of whether your data is stored in one table or many. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/eaf9f6c962b148a301f0a66ced51c4ac%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.