This document describes the flow of functions and objects within the package, specifically within the main exposed function classify_diabetes(). It shows the data sources and how they enter or are used in the function as well as how the different internal functions and logic are connected to each other. A high-level overview of the flow is shown in the diagram below.
Flow of functions in, as well as their required input registers, in the classify_diabetes() function used for classifying diabetes status using the osdc package. Light blue and orange boxes represent filtering functions (keep_* and drop_*, respectively).
The sections below are split into functions for keeping and dropping events as well as functions for determining the final diagnosis date and eventual classification of type 1 and type 2 diabetes.
For more details and descriptions about the individual steps within the algorithm, see the documentation on the internal functions: