-
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.
* swap t28, s28 for tjc, sjc Modify field names to use more common description. Online calculators mention swollen / tender joint counts without specifying the number of joints. * add categories - added categories to docstrings of composites - added example about categorisation * chore: straggler md after makedocs * fix cutoffs in categorisation table SDAI and CDAI have boundary-inclusive remission cutoffs, see SDAI calculator https://www.mdcalc.com/calc/2194/simple-disease-activity-index-sdai-rheumatoid-arthritis * change `threeitem` to a `Subset` implemented a more general Subset type that allows for keeping only a specified subset of components of a given composite. Made `threeitem(x::BooleanRemission)` a call to a prespecified `Subset`. * generalise `revised` `revised`can now change cutoffs for any component of a boolean remission, with the default implementation being that for the "classic" revised boolean composite * Documentation and test - make `ModifiedComposites` error on misspecification (same component assigned to two facets, subsetting by the same component twice) - add tests that check if misspecification of `ModifiedComposites` errors as intended - refactor main functions from utils to functions folder
- Loading branch information
1 parent
b5c07ad
commit 6d77962
Showing
29 changed files
with
582 additions
and
250 deletions.
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
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,57 @@ | ||
```@meta | ||
EditURL = "../../../examples/categorisation.jl" | ||
``` | ||
|
||
# Categorising composites | ||
|
||
In this tutorial, we will explore how to convert continuous composites, like the DAS28ESR or SDAI, into discrete disease activity levels. | ||
|
||
````@example categorisation | ||
using RheumaComposites | ||
using Unitful | ||
```` | ||
|
||
As long as the composite you are defining is a continuous composite, all you need to do is to call [`categorise`](@ref). | ||
|
||
````@example categorisation | ||
sdai = SDAI(tjc=2, sjc=1, pga=6u"cm", ega=5.5u"cm", crp=15u"mg/L") | ||
sdai isa ContinuousComposite | ||
```` | ||
|
||
Well, that was expected! | ||
|
||
Now let's see what the discrete disease activity level of this score would be. | ||
|
||
````@example categorisation | ||
categorise(sdai) | ||
```` | ||
|
||
## Cutoffs | ||
|
||
The cutoffs used per composite and category are: | ||
|
||
| Disease activity | DAS28ESR | DAS28CRP | SDAI | CDAI | | ||
|:-----------------|----------|----------|--------|--------| | ||
| Remission | ``<`` 2.6 | ``<`` 2.4 | ``\leq`` 3.3 | ``\leq`` 2.8 | | ||
| Low | ``\leq`` 3.2 | ``\leq`` 2.9 | ``\leq`` 11.0 | ``\leq`` 10.0 | | ||
| Moderate | ``\leq`` 5.1 | ``\leq`` 4.6 | ``\leq`` 26.0 | ``\leq`` 22.0 | | ||
| High | ``>`` 5.1 | ``>`` 4.6 | ``>`` 26.0 | ``>`` 22.0 | | ||
|
||
Internally, these are saved in a `NamedTuple` which you can import with `import RheumaComposites: cont_cutoff`. | ||
To retrieve the cutoff for a Moderate CDAI, you would: | ||
|
||
````@example categorisation | ||
import RheumaComposites: cont_cutoff | ||
cont_cutoff.CDAI.moderate | ||
```` | ||
|
||
Note that this only returns the boundary value of the respective category, and that the inclusion of this value varies across **both** composites and categories. | ||
It is therefore safest to simply rely on the `categorise` function. | ||
|
||
An alternative way to check the cutoffs is the respective composite's documentation. | ||
You can see this by typing `?CDAI` in the REPL. | ||
|
||
--- | ||
|
||
*This page was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).* | ||
|
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,43 @@ | ||
# # Categorising composites | ||
|
||
# In this tutorial, we will explore how to convert continuous composites, like the DAS28ESR or SDAI, into discrete disease activity levels. | ||
|
||
using RheumaComposites | ||
using Unitful | ||
|
||
# As long as the composite you are defining is a continuous composite, all you need to do is to call [`categorise`](@ref). | ||
|
||
sdai = SDAI(tjc=2, sjc=1, pga=6u"cm", ega=5.5u"cm", crp=15u"mg/L") | ||
sdai isa ContinuousComposite | ||
|
||
# Well, that was expected! | ||
|
||
# Now let's see what the discrete disease activity level of this score would be. | ||
|
||
categorise(sdai) | ||
#= | ||
## Cutoffs | ||
The cutoffs used per composite and category are: | ||
| Disease activity | DAS28ESR | DAS28CRP | SDAI | CDAI | | ||
|:-----------------|----------|----------|--------|--------| | ||
| Remission | ``<`` 2.6 | ``<`` 2.4 | ``\leq`` 3.3 | ``\leq`` 2.8 | | ||
| Low | ``\leq`` 3.2 | ``\leq`` 2.9 | ``\leq`` 11.0 | ``\leq`` 10.0 | | ||
| Moderate | ``\leq`` 5.1 | ``\leq`` 4.6 | ``\leq`` 26.0 | ``\leq`` 22.0 | | ||
| High | ``>`` 5.1 | ``>`` 4.6 | ``>`` 26.0 | ``>`` 22.0 | | ||
Internally, these are saved in a `NamedTuple` which you can import with `import RheumaComposites: cont_cutoff`. | ||
To retrieve the cutoff for a Moderate CDAI, you would: | ||
=# | ||
|
||
import RheumaComposites: cont_cutoff | ||
cont_cutoff.CDAI.moderate | ||
|
||
#= | ||
Note that this only returns the boundary value of the respective category, and that the inclusion of this value varies across **both** composites and categories. | ||
It is therefore safest to simply rely on the `categorise` function. | ||
An alternative way to check the cutoffs is the respective composite's documentation. | ||
You can see this by typing `?CDAI` in the REPL. | ||
=# |
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
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,52 @@ | ||
""" | ||
isremission(x::AbstractComposite) | ||
Check whether a composite fulfils remission criteria. | ||
# Examples | ||
```jldoctest | ||
julia> DAS28ESR(tjc=4, sjc=5, pga=44u"mm", apr=23u"mm/hr") |> isremission | ||
false | ||
julia> BooleanRemission(tjc=1, sjc=0, pga=14u"mm", crp=0.4u"mg/dl") |> | ||
revised |> | ||
isremission | ||
true | ||
``` | ||
""" | ||
isremission(::Type{DAS28ESR}, x) = score(x) < cont_cutoff.DAS28ESR.remission | ||
isremission(::Type{DAS28CRP}, x) = score(x) < cont_cutoff.DAS28CRP.remission | ||
|
||
isremission(::Type{SDAI}, x) = score(x) <= cont_cutoff.SDAI.remission | ||
isremission(::Type{CDAI}, x) = score(x) <= cont_cutoff.CDAI.remission | ||
|
||
isremission(::Type{PGA}, x) = x.value <= 10.0u"mm" | ||
isremission(::Type{SJC}, x) = x.value == 0 | ||
|
||
_check(component, x) = getproperty(bool_cutoff_funs, component)(x) | ||
|
||
_check(component, x, offset) = getproperty(bool_cutoff_funs, component)(x; offset=offset) | ||
|
||
function isremission(::Type{<:BooleanComposite}, x) | ||
return mapreduce(component -> _check(component, x), &, components(x)) | ||
end | ||
|
||
function isremission(::Type{<:Subset{N, <:BooleanComposite}}, x) where {N} | ||
return mapreduce(component -> _check(component, root(x)), &, components(x)) | ||
end | ||
|
||
function isremission(::Type{<:Revised{<:BooleanComposite}}, x) | ||
offset_components = propertynames(offset(x)) | ||
out = mapreduce(&, components(x)) do compo | ||
if compo in offset_components | ||
compo_offset = getproperty(offset(x), compo) | ||
_check(compo, root(x), compo_offset) | ||
else | ||
_check(compo, root(x)) | ||
end | ||
end | ||
return out | ||
end | ||
|
||
isremission(x::AbstractComposite) = isremission(typeof(x), x) | ||
isremission(x::AbstractComponent) = isremission(typeof(x), x) |
Oops, something went wrong.