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: 📝 expand on inclusions and exclusions #133

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
90c7492
Fleshed out and updated include_gld_purchases() flow documentation
Sep 18, 2024
0504532
Added description of podiatrist services function flow
Sep 18, 2024
7777f36
Reformated some GLD text, added HbA1c and started on pregnancy dates
Sep 18, 2024
6382624
Reworded include_hba1c section
Sep 19, 2024
4fd5903
Added lpr-joins, started on describing lpr processing
Sep 19, 2024
29fea86
Finished LPR/diagnosis part of function flow
Sep 19, 2024
f9d7661
fixed a new things to describe LPR3 processing
Sep 19, 2024
9a05d81
specified that only primary diagnoses go into type classification
Sep 19, 2024
f03a4da
Update vignettes/function-flow.Rmd
Aastedet Sep 19, 2024
bc889d4
switched the order of inclusion sections and mentioned that some of t…
Sep 19, 2024
8d60bd0
Merge branch 'update-function-flow' of https://github.com/steno-aarhu…
Sep 19, 2024
9a74ea0
Merge branch 'main' into update-function-flow
Aastedet Sep 20, 2024
7525b60
fixed spec to speciale variable name
Sep 20, 2024
25db86d
Merge branch 'update-function-flow' of https://github.com/steno-aarhu…
Sep 20, 2024
092824e
Removed "name" or "vnr" variables from GLD function flow.
Sep 20, 2024
20f5886
Updates join_lpr function description to filter to necessary diagnoses.
Sep 20, 2024
61b5d27
Removed section on weightloss drugs, since we're no longer including …
Sep 20, 2024
7b9738d
Update vignettes/function-flow.Rmd
Aastedet Sep 20, 2024
3a95d4f
Added description of exclude_potential_pcos()
Sep 20, 2024
f663844
Merge branch 'update-function-flow' of https://github.com/steno-aarhu…
Sep 20, 2024
fe257a6
Renamed some variables.
Sep 20, 2024
4bba18e
Added censoring/exclusion function description
Sep 20, 2024
7cca920
Added correct diagnoses to filter to in lpr_join() functions.
Sep 27, 2024
b40412c
changed specialty values to align with the PR with a refactored creat…
Sep 27, 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
49 changes: 31 additions & 18 deletions vignettes/function-flow.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -121,38 +121,50 @@ input to extract the dates of all diabetes-specific podiatrist services.

<!-- TODO: Add details on how this filtering should be done -->

AAI: By date
signekb marked this conversation as resolved.
Show resolved Hide resolved

#### GLD purchases

The function `include_gld_purchases()` uses `lmdb` to extract the dates
of all GLD purchases (from 1997 onwards).

<!-- TODO: Add details on how this filtering should be done -->

<!-- TODO: Add this + link to resource "For details about this, see [link]." -->
of all GLD purchases.

These dates are extracted by filtering values beginning with "A10" in
Aastedet marked this conversation as resolved.
Show resolved Hide resolved
the `atc` column of the `lmdb` register. In addition to the identifier
variable (`pnr`) and date (`eksd`), additional information needed for
censoring or for classification of diabetes type are also extracted: the
type of drug (`atc`), the amount purchased (`volume` and `apk`), the
indication code (`indo`), and its brand name or vnr-number (`name` or
`vnr`). These events are then passed to a chain of exclusion functions:
`exclude_wld_purchases()`, `exclude_potential_pcos()`,
`exclude_pregnancy()` described in the sections below.
Aastedet marked this conversation as resolved.
Show resolved Hide resolved

After these exclusion functions have been applied, the output serves as
inputs to two sets of functions:

1. the `get_diagnosis_date()` function for the final step of the
Aastedet marked this conversation as resolved.
Show resolved Hide resolved
inclusion process.
2. the `get_only_insulin_purchases()`,
`get_insulin_purchases_within_180_days()`, and
`get_insulin_is_two_thirds_of_gld_doses()` helper functions for the
classification of diabetes type.

Since the diagnosis code data on pregnancies is insufficient to perform
censoring prior to 1997, `include_gld_purchases()` only extracts dates
from 1997 onward by default (if Medical Birth Register data is available
to use for censoring, the extraction window can be extended).
Aastedet marked this conversation as resolved.
Show resolved Hide resolved

### Exclusion events

#### HbA1c tests and GLD purchases during pregnancy

The function `exclude_pregnancy()` uses diagnoses from LPR2 or LPR3 as
Aastedet marked this conversation as resolved.
Show resolved Hide resolved
input and is used to exclude both HbA1c tests and GLD purchases during
pregnancy.
pregnancy, as these may be due to gestational diabetes, rather than type
1 or type 2 diabetes.

Internally, this relies on the function `get_pregnancy_dates()` that
contains the following three helper functions:

- `calculate_pregnancy_index_date_for_mc_visits_wo_end_date()` (this
might be removed with the inclusion of the birth register)
- `get_pregnancy_end_dates()`: Keep maternal care visits with an end
date and drop visits between 40 weeks before end date and 12 weeks
after end date.
- `get_maternal_care_visit_dates_without_end_date()`: Uses the output
from `get_pregnancy_end_dates()` which identifies maternal care
visits *with* end dates to derive maternal care visits *without* end
dates. below.

<!-- TODO: What is done with the mc visits without end dates then? -->

<!-- TODO: Add details on how this filtering should be done -->

#### Glucose-lowering brand drugs for weight loss
Expand Down Expand Up @@ -284,3 +296,4 @@ is within a time-period of insufficient data coverage,
contains the inclusion date of this individual.

<!-- TODO: Specify the "stable" time-period: e.g., later than 1997 -->

Loading