Add pi calculation for new sessions.

When a new session is entered, the PI valu eis calculated and stored in the db
along with the other stuff