-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add categorise - categorise method for continuouscomposites and faceted modifications - added tests * add docstring to categorise
- Loading branch information
1 parent
f8543d6
commit 47498b4
Showing
4 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
function categorise(::Type{DAS28CRP}, v) | ||
out = v < 2.4 ? "Remission" : | ||
v <= 2.9 ? "Low" : | ||
v <= 4.6 ? "Moderate" : | ||
"High" | ||
return out | ||
end | ||
|
||
function categorise(::Type{DAS28ESR}, v) | ||
out = v < 2.6 ? "Remission" : | ||
v <= 3.2 ? "Low" : | ||
v <= 5.1 ? "Moderate" : | ||
"High" | ||
return out | ||
end | ||
|
||
function categorise(::Type{SDAI}, v) | ||
out = v < 3.3 ? "Remission" : | ||
v <= 11.0 ? "Low" : | ||
v <= 26.0 ? "Moderate" : | ||
"High" | ||
return out | ||
end | ||
|
||
""" | ||
categorise(x::ContinuousComposite) | ||
Convert `x` to a discrete value. | ||
# Examples | ||
```jldoctest | ||
julia> DAS28ESR(t28=4, s28=5, pga=12u"mm", apr=44u"mm/hr") |> categorise | ||
"Moderate" | ||
``` | ||
categorise(::Type{SDAI}, v) | ||
Convert `v` to a discrete value using `SDAI` thresholds. | ||
The same functionality exists for other `ContinuousComposites`. | ||
See also [`DAS28ESR`](@ref), [`DAS28CRP`](@ref). | ||
# Examples | ||
```jldoctest | ||
julia> categorise(SDAI, 3.6) | ||
"Low" | ||
``` | ||
""" | ||
categorise(x::ContinuousComposite) = categorise(typeof(x), score(x)) | ||
|
||
categorise(x::Faceted{<:ContinuousComposite}) = categorise(typeof(x.c0), score(x.c0)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters