Open
Description
The main problem is that a TimeArray
is a parametric type, which is difficult to implement, see.
The meta::Any
field is not serializable as a JSON in any case.
JSON.json
even results in a stack overflow error.
This does work, but still makes the assumption that the timestamps are DateTime
.
They can be anything: Date
, DateTime
, TimeZones.ZonedDateTime
, TimesDates.TimeDate
, TimesDates.TimeDateZone
StructTypes.StructType(::Type{<:TimeSeries.TimeArray}) = StructTypes.CustomStruct()
function StructTypes.lower(x::TimeSeries.TimeArray)
return Dict(
"timestamp" => TimeSeries.timestamp(x),
"values" => [TimeSeries.values(x[c]) for c in TimeSeries.colnames(x)],
"colnames" => String.(TimeSeries.colnames(x)),
)
end
function StructTypes.construct(::Type{TimeSeries.TimeArray}, x)
return TimeSeries.TimeArray(
Dates.DateTime.(x["timestamp"]),
reduce(hcat, x["values"]),
Symbol.(x["colnames"]),
)
end
Metadata
Metadata
Assignees
Labels
No labels