ADD: fetch raw measurements
This commit is contained in:
parent
8aba5ac6c2
commit
5a04bf2e91
@ -11,6 +11,7 @@ def utc_now() -> datetime:
|
|||||||
return datetime.now(timezone.utc)
|
return datetime.now(timezone.utc)
|
||||||
|
|
||||||
class MeasurementResolution(str, Enum):
|
class MeasurementResolution(str, Enum):
|
||||||
|
raw = "raw"
|
||||||
hourly = "hourly"
|
hourly = "hourly"
|
||||||
daily = "daily"
|
daily = "daily"
|
||||||
weekly = "weekly"
|
weekly = "weekly"
|
||||||
|
|||||||
@ -101,6 +101,7 @@ def _query_measurements(
|
|||||||
grouped[m.station_id] = []
|
grouped[m.station_id] = []
|
||||||
grouped[m.station_id].append(MeasurementResponse.model_validate(m))
|
grouped[m.station_id].append(MeasurementResponse.model_validate(m))
|
||||||
|
|
||||||
|
if resolution != MeasurementResolution.raw:
|
||||||
grouped = {
|
grouped = {
|
||||||
station_id: aggregate(measurements, resolution)
|
station_id: aggregate(measurements, resolution)
|
||||||
for station_id, measurements in grouped.items()
|
for station_id, measurements in grouped.items()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user