add db.py, rewrite README.md

add db.py, rewrite README.md. Need to update views as the database schema changed.