[WIP] Implement growth assessment using WHO indicators #80

Draft
joao.dubas wants to merge 76 commits from jpd-feat-add-bmi-module-with-live-view into main
Showing only changes of commit 4234b2e917 - Show all commits

View File

@ -63,7 +63,7 @@ defmodule Growth.Indicators.Load do
def all do
"priv/growth/indicators/*.csv"
|> Path.wildcard()
|> Enum.map(&create_ets/1)
|> Enum.map(&create_ets_from_filename/1)
|> Enum.map(&Task.async(__MODULE__, :load_measure, [&1]))
|> Task.await_many()
end
@ -85,17 +85,18 @@ defmodule Growth.Indicators.Load do
measure
end
@spec filename_to_measure(String.t()) :: {atom(), String.t()}
@spec create_ets_from_filename(String.t()) :: {atom(), String.t()}
@doc """
Translate the given filename to the related module and return both in a tuple.
Create ets table based on filename and return a tuple with the ets table name and filename.
"""
def filename_to_measure(filename) do
def create_ets_from_filename(filename) do
measure =
filename
|> Path.basename()
|> Path.rootname()
|> String.to_atom()
|> then(&Keyword.get(@measure_to_score, &1, &1))
|> create_ets()
{measure, filename}
end