You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Description
Had to do a lot of work to strictly use DuckDB/SQL. I couldn't easily
make this a smaller PR as each issue only came up after addressing the
previous issue.
Closes#392, closes#390 (as this also converts the object into a DuckDB
dataset), closes#381
## Checklist
- [x] Ran `just run-all`
---------
Co-authored-by: Anders Aasted Isaksen <67263135+Aastedet@users.noreply.github.com>
Copy file name to clipboardExpand all lines: R/algorithm.R
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -68,13 +68,13 @@ algorithm <- function() {
68
68
lpr2_is_endocrinology_dept=list(
69
69
register="lpr_adm",
70
70
title="LPR2 endocrinology department",
71
-
logic="c_spec == 8",
71
+
logic="c_spec == 8L",
72
72
comments="`TRUE` when the department where the recorded diagnosis was endocrinology."
73
73
),
74
74
lpr2_is_medical_dept=list(
75
75
register="lpr_adm",
76
76
title="LPR2 other medical department",
77
-
logic="c_spec %in% c(1:7, 9:30)",
77
+
logic="c_spec %in% c(1L:7L, 9L:30L)",
78
78
comments="`TRUE` when the diagnosis was recorded at a medical department other than endocrinology."
79
79
),
80
80
lpr2_is_pregnancy_code=list(
@@ -141,7 +141,7 @@ algorithm <- function() {
141
141
is_within_pregnancy_interval=list(
142
142
register=NA,
143
143
title="Events that are within a potential pregnancy interval",
144
-
logic="has_pregnancy_event AND date >= (pregnancy_event_date - weeks(40)) AND date <= (pregnancy_event_date + weeks(12))",
144
+
logic="has_pregnancy_event AND date >= (pregnancy_event_date - weeks(40L)) AND date <= (pregnancy_event_date + weeks(12L))",
145
145
comments="The potential pregnancy interval is defined as 40 weeks before and 12 weeks after the pregnancy event date (birth or miscarriage)."
146
146
),
147
147
is_podiatrist_services=list(
@@ -153,7 +153,7 @@ algorithm <- function() {
153
153
is_not_metformin_for_pcos=list(
154
154
register=NA,
155
155
title="Metformin purchases that aren't potentially for the treatment of PCOS",
156
-
logic="NOT (koen == 2 AND atc =~ '^A10BA02$' AND ((date - foed_dato) < years(40) OR indication_code %in% c('0000092', '0000276', '0000781')))",
156
+
logic="NOT (koen == 2 AND atc =~ '^A10BA02$' AND (date < (foed_dato + years(40)) OR indication_code %in% c('0000092', '0000276', '0000781')))",
157
157
comments="Woman is defined as 2 in `koen`."
158
158
),
159
159
has_t1d=list(
@@ -189,7 +189,7 @@ algorithm <- function() {
189
189
has_insulin_purchases_within_180_days=list(
190
190
register=NA,
191
191
title="Whether any insulin was purchased within 180 days of the first purchase of GLD",
192
-
logic="any(is_insulin_gld_code & date <= (first_gld_date + days(180)))",
192
+
logic="any(is_insulin_gld_code & date <= (first_gld_date + days(180L)), na.rm = TRUE)",
193
193
comments="This is used to classify type 1 diabetes. It determines if any insulin was bought shortly after first buying any type of GLD, which suggests type 1 diabetes."
0 commit comments