Fix bug with mapping legacy query API, where either "type" or "types"
parameter might be supplied.
Tweaks to aggregate calculation script to reject seemingly inappropriate accumulation data. We know we have cases of "bad" data collected where the reported watt_hour values jump suddenly. This change attempts to work around those problems by ignoring those records when calculating an aggregation value.