Defined latest group and building db functions and implemented db.py to the routes.

- Edited db.py queries.
- two new db.py functions 
- imported db.py to density.py and implemented to routes
can you name the arguments for .format just like you did above?