Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: ✨ initial draft of functions to classify diabetes type #75

Merged
merged 48 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
b3d5f6d
docs: :sparkles: initial draft of diabetes type functionality flow
signekb Apr 12, 2024
328516b
fix: :fire: remove old figure experiments
signekb Apr 12, 2024
6f7b6c2
style: remove unnecessary "and" and commas from figure
signekb Apr 12, 2024
8dc6ae1
docs: update output of OSDC to include two inclusion dates (stable an…
signekb Apr 17, 2024
af93e94
fix: add oxford comma to header
signekb Apr 17, 2024
ef92306
fix: describe classifying steps as "filters" with "criteria"
signekb Apr 17, 2024
18951d7
docs: minor text fixes (add link and "the")
signekb Apr 17, 2024
9f45a1f
fix: update classify diabetes type flow chart based on feedback from …
signekb Apr 17, 2024
332f421
fix: specify that we use the primary diagnosis for classification
signekb Apr 17, 2024
b157b5a
fix: minor text edit to make sentence clearer
signekb Apr 17, 2024
6e9ddaa
docs: add description of example output table
signekb Apr 17, 2024
3084d2c
fix: add missing header in output example table
signekb Apr 17, 2024
175fa3d
style: :lipstick: format
signekb Apr 17, 2024
a3655b1
Merge branch 'docs/functionality-flow-diabetes-population' into docs/…
signekb Apr 17, 2024
f6bebfe
style:
signekb Apr 17, 2024
80fc885
Merge branch 'docs/functionality-flow-diabetes-population' into docs/…
signekb Apr 17, 2024
12fd1d1
docs: elaborate on hierarchy of diagnoses from endocrinological and m…
signekb Apr 17, 2024
33d764e
Merge branch 'docs/functionality-flow-diabetes-population' into docs/…
signekb Apr 25, 2024
6078cc7
Apply suggestions from code review
signekb Apr 26, 2024
57115bf
Merged origin/main into docs/functionality-flow-classify-diabetes-type
lwjohnst86 Apr 27, 2024
dadf568
Merge branch 'docs/functionality-flow-diabetes-population' of https:/…
lwjohnst86 Apr 27, 2024
f2f29fa
Merge branch 'docs/functionality-flow-diabetes-population' of https:/…
lwjohnst86 Apr 27, 2024
4295251
Apply suggestions from code review
signekb May 16, 2024
48c69bf
Merge branch 'main' into docs/functionality-flow-classify-diabetes-type
signekb May 16, 2024
b978ce6
docs: :fire: remove `_status` from `classify_diabetes_status()`
signekb May 16, 2024
688fd64
docs: :fire: remove mentions of "components"
signekb May 16, 2024
b6205d9
Update vignettes/function-flow.Rmd
signekb May 16, 2024
56dda95
Merge branch 'main' into docs/functionality-flow-classify-diabetes-type
signekb May 16, 2024
81b2561
docs: :memo: add register abbreviations based on `variable_description`
signekb May 16, 2024
80d3eab
docs: :fire: remove details about filter 1
signekb May 16, 2024
a0f7151
docs: :memo: align links to other vignettes
signekb May 17, 2024
616e105
feat: add classification to function-flow
signekb May 21, 2024
1ed60d1
feat: add function that join inclusion events
signekb May 21, 2024
ff87125
style: :art: refactor arrows and add comments to create a clearer str…
signekb May 21, 2024
7c77923
feat: update structure (arrows and together) to correct arrows and la…
signekb May 21, 2024
0266cee
style: :art: add black font to card and rectangle
signekb May 21, 2024
3dc29b7
feat: regenerate png from puml
signekb May 21, 2024
89dfe0b
docs: add name og brand drugs Saxenda and Wegovy
signekb May 30, 2024
cced272
fix: diagnosis -> diagnoses in inclusion function
signekb May 30, 2024
8662ce4
Merge branch 'main' into docs/functionality-flow-classify-diabetes-type
signekb May 30, 2024
950641b
docs: rename wld function; add data source and brand drug names
signekb May 30, 2024
9dacf9a
docs: rewrite of classification to omit the filter distinction
signekb May 30, 2024
214f0e5
docs: remove backticks from osdc package
signekb May 30, 2024
a6e7287
docs: :sparkles: create partial function flows while keeping the enti…
signekb May 30, 2024
f465a63
docs: add separate section for population extraction and fix header l…
signekb May 30, 2024
8c45dbc
docs: :fire: remove old classification puml
signekb May 30, 2024
2cf719c
Merge branch 'main' into docs/functionality-flow-classify-diabetes-type
signekb Jun 14, 2024
9c5759b
docs: :pencil2: very minor edits and formatting fixes
lwjohnst86 Jun 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions vignettes/functionality-flow.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,82 @@ the function `extract_classification_dates`. For each individual with
inclusion events, the date of the *second* event is extracted as the
classification date, i.e., the date the OSDC algorithm defines as the
diagnosis date.

## Classifying the diabetes type {#classifying-diabetes-type}

The second component of the OSDC algorithm classifies individuals from
the extracted diabetes population as having either type 1 or type 2
diabetes. The output of this component is a `data.frame` that includes
the diabetes type as well as the classification date (i.e., the date
of the second instance of the inclusion criteria described in the
sections above).

signekb marked this conversation as resolved.
Show resolved Hide resolved
This component will also have one user-facing function:
`classify_diabetes_type`. This function takes the output of
`extract_diabetes_population` as input.

### Type 1 classification

The classification of type 1 diabetes relies on the following criteria.
To be classified as having type 1 diabetes, individuals must have:

1. At least one T1D diagnosis and only purchased insulins (i.e., no
purchases of any other type of GLDs).
2. A majority of T1D diagnoses, purchased insulin within 180 days of
diagnosis, and 2/3 of GLD doses are insulin.

signekb marked this conversation as resolved.
Show resolved Hide resolved
Functions for the above criteria are described in the following
sections.

![Flow of functions for classifying the diabetes type using the `osdc`
package. The dark grey box denotes the user-facing function, while the
remaining boxes are internal
functions.](images/classify-diabetes-type-functions.png)

#### Criteria 1: Any T1D diagnoses and all GLD purchases are insulins

The first criteria includes two parts: 1) Whether individuals have any
T1D diagnoses and 2) whether all GLD purchases are insulin.

Thus, this criteria contains two functions:

1. `t1d_include_at_least_one_t1d_diagnosis`, which relies on the
hospital diagnoses from DNPR extracted in component 1.
2. `t1d_include_only_purchased_insulins` which relies on the GLD
purchases from Lægemiddelsdatabasen.

<!-- TODO: Add English translations for Lægemiddelsdatabasen -->

#### Criteria 2: Majority of T1D diagnoses, insulin within 180 days of diagnosis and insulin constitutes 2/3 of all GLD doses

The second criteria is three-fold: 1) Whether individuals have a
majority of T1D diagnoses, 2) whether they purchased insulin within 180
days of diagnosis, and 3) whether insulin constitutes 2/3 of all their
GLD doses.

This results in three functions:

1. `t1d_include_majority_of_diagnoses_is_t1d()` (as compared to T2D
diagnoses) which again relies on hospital diagnoses from DNPR.
2. `t1d_include_insulin_purchase_within_180_days_of_diagnosis` which
relies on both diagnosis from DNPR and GLD purchases from
Lægemiddelsdatabasen.
3. `t1d_include_two_thirds_of_purchased_gld_doses_are_insulin` which
relies on the GLD purchases from Lægemiddelsdatabasen.

Note that in the first function, individuals must have a majority of T1D
diagnoses from endocrinological departments (or from other medical
departments, in the absence of contacts to endocrinological
departments).

### Type 2 classification

As described in the [design](design.Rmd) vignette, individuals not
classified as type 1 cases are classified as type 2 cases.

## Output

The output of the second component, and therefore, the OSDC algorithm is
a `data.frame` including a background population and a diabetes
population. For the diabetes population, both the classification (type 1
or type 2) and the classification date is included.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions vignettes/images/classify-diabetes-type-functions.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@startuml classify-diabetes-type-functions

skinparam defaultTextAlignment center

#darkgrey: Classify_diabetes_type;
!pragma useVerticalIf on
if (**Filter 1**\nt1d_include_at_least_one_t1d_diagnosis\nt1d_include_only_purchased_insulins) then (no)
:Type 2;
detach
elseif (**Filter 2**\nt1d_include_majority_of_diagnoses_is_t1d\nt1d_include_insulin_purchase_within_180_days_of_diagnosis\nt1d_include_two_thirds_of_purchased_gld_doses_are_insulin) then (no)
:Type 2;
detach
else (\nyes)
endif
:Type 1;
detach

@enduml