chore(growth): move nil logic to scorer behaviour
All checks were successful
continuous-integration/drone/pr Build is passing
All checks were successful
continuous-integration/drone/pr Build is passing
Handle `nil` measurement in `Growth.Score.Scorer`.
This commit is contained in:
@@ -23,7 +23,7 @@ defmodule Growth.Calc.Centile do
|
||||
|
||||
alias Growth.Calc.ZScore
|
||||
|
||||
@spec compute(number(), ZScore.l(), ZScore.m(), ZScore.s()) :: number() | :na | nil
|
||||
@spec compute(number(), ZScore.l(), ZScore.m(), ZScore.s()) :: number() | :na
|
||||
@doc """
|
||||
Compute the centile for a given measurement (`y`) and the Box-Cox values: power (`l`), median (`m`), and
|
||||
coefficient of variation (`s`).
|
||||
@@ -36,10 +36,6 @@ defmodule Growth.Calc.Centile do
|
||||
19.0
|
||||
|
||||
"""
|
||||
def compute(nil, _, _, _) do
|
||||
nil
|
||||
end
|
||||
|
||||
def compute(y, l, m, s) do
|
||||
zscore = ZScore.raw(y, l, m, s)
|
||||
|
||||
|
@@ -34,7 +34,7 @@ defmodule Growth.Calc.ZScore do
|
||||
"""
|
||||
@type s :: number()
|
||||
|
||||
@spec compute(number(), l(), m(), s()) :: Growth.measure()
|
||||
@spec compute(number(), l(), m(), s()) :: number()
|
||||
@doc """
|
||||
Compute the adjusted z-score for a given measurement (`y`) and the Box-Cox values: power (`l`), median (`m`), and
|
||||
coefficient of variation (`s`).
|
||||
@@ -49,11 +49,6 @@ defmodule Growth.Calc.ZScore do
|
||||
1.4698319520484722
|
||||
|
||||
"""
|
||||
|
||||
def compute(nil, _, _, _) do
|
||||
nil
|
||||
end
|
||||
|
||||
def compute(y, l, m, s) do
|
||||
y
|
||||
|> raw(l, m, s)
|
||||
|
Reference in New Issue
Block a user