convert a query string to a json structure
calculate the a rate given over any interval with a retention period.