Kpis

Adding js and html file for the kpis page, adding the necessary function in views, adding a few useful functions to common.js.

No rush.
add comments as to why length-1 vs length -2