Help cleaning up this data transformation code

I thought about the group_by before but couldn’t wrap my head around it last night.

Zeros are indeed required, otherwise the time series are missing. How would the Enum.reduce/3 version look like?