generate and persist ratings