Commit bffe4ba7 authored by Christophe Benz's avatar Christophe Benz

Allow series without name (display code)

parent 2d6f4c23
......@@ -261,27 +261,37 @@ provider =
series : Decoder Series
series =
succeed Series
|: field "series_code" string
|: field "series_name" string
|: field "provider_code" string
|: field "dataset_code" string
|: (maybe <| field "@frequency" string)
|: (field "dimensions" (dict string)
|> withDefault Dict.empty
)
|: (field "observations_attributes" (list observationsAttribute)
|> withDefault []
)
|: (field "period" (list string)
|> withDefault []
)
|: (field "period_start_day" (list string)
|> withDefault []
)
|: (field "value" (list observationValue)
|> withDefault []
)
map
(\series ->
if String.isEmpty series.name then
{ series | name = series.code }
else
series
)
<|
succeed Series
|: field "series_code" string
|: (field "series_name" string
|> withDefault ""
)
|: field "provider_code" string
|: field "dataset_code" string
|: (maybe <| field "@frequency" string)
|: (field "dimensions" (dict string)
|> withDefault Dict.empty
)
|: (field "observations_attributes" (list observationsAttribute)
|> withDefault []
)
|: (field "period" (list string)
|> withDefault []
)
|: (field "period_start_day" (list string)
|> withDefault []
)
|: (field "value" (list observationValue)
|> withDefault []
)
observationsAttribute : Decoder ObservationsAttribute
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment