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

Add infusiontime/dur #21

Merged
merged 4 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: monolix2rx
Title: Converts 'Monolix' Models to 'rxode2'
Version: 0.0.3
Version: 0.0.3.9000
Authors@R:
c(person("Matthew","Fidler", role = c("aut", "cre"), email = "matthew.fidler@gmail.com", comment=c(ORCID="0000-0001-8538-6691")),
person("Justin", "Wilkins", role = "ctb", email = "justin.wilkins@occams.com", comment=c(ORCID="0000-0002-7099-9396")))
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# monolix2rx (development version)

# monolix2rx 0.0.3

* For initial conditions starting with `rxCov_` don't add to ini
Expand Down
3 changes: 2 additions & 1 deletion R/content.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
occasion=NA_character_,
rate=NA_character_,
additionaldose=NA_character_,
missingdependentvariable=NA_character_)
missingdependentvariable=NA_character_,
infusiontime=NA_character_)
.monolix2rx$contLst <- character(0)
.monolix2rx$ssNbdoses <- 7L
.monolix2rx$yname <- character(0)
Expand Down
3 changes: 2 additions & 1 deletion R/dataImport.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@
occasion="occ",
rate="rate",
additionaldose="addl",
missingdependentvariable="mdv"))
missingdependentvariable="mdv",
infusiontime="dur"))
}
n
}, character(1), USE.NAMES = FALSE)
Expand Down
2 changes: 2 additions & 0 deletions inst/mlxtranContent.g
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ytypeLine: identifier '=' '{' 'use' '=' ('observationtype' | 'observationType')
admLine: identifier '=' '{' 'use' '=' 'administration' '}';
occLine: identifier '=' '{' 'use' '=' 'occasion' '}';
rateLine: identifier '=' '{' 'use' '=' 'rate' '}';
durLine: identifier '=' '{' 'use' '=' 'infusiontime' '}';
mdvLine: identifier '=' '{' 'use' '=' ('missingdependentvariable' | 'missingDependentVariable' ) '}';
nbd: decimalint;
ssLine: identifier '=' '{' 'use' '=' ('steadystate' | 'steadyState' ) (',' 'nbdoses' '=' nbd)? '}';
Expand Down Expand Up @@ -65,6 +66,7 @@ statement: idLine singleLineComment?
| admLine singleLineComment?
| occLine singleLineComment?
| rateLine singleLineComment?
| durLine singleLineComment?
| mdvLine singleLineComment?
| ssLine singleLineComment?
| regressorLine singleLineComment?
Expand Down
11 changes: 11 additions & 0 deletions src/mlxtranContent.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,16 @@ int content_process_rate(const char *name, D_ParseNode *pn) {
return 0;
}

int content_process_dur(const char *name, D_ParseNode *pn) {
if (!strcmp(name, "durLine")) {
D_ParseNode *xpn = d_get_child(pn, 0);
char *v = (char*)rc_dup_str(xpn->start_loc.s, xpn->end);
monolix2rxContentSetUse1("infusiontime", v);
return 1;
}
return 0;
}

int content_process_adm(const char *name, D_ParseNode *pn) {
if (!strcmp(name, "admLine")) {
D_ParseNode *xpn = d_get_child(pn, 0);
Expand Down Expand Up @@ -325,6 +335,7 @@ void wprint_parsetree_content(D_ParserTables pt, D_ParseNode *pn, int depth, pri
content_process_cat(name, pn) ||
content_process_occ(name, pn) ||
content_process_rate(name, pn) ||
content_process_dur(name, pn) ||
content_process_ytypeObs(name, pn) ||
content_process_addl(name, pn) ||
content_process_mdv(name, pn)
Expand Down
4,323 changes: 2,236 additions & 2,087 deletions src/mlxtranContent.g.d_parser.h

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions tests/testthat/test-content.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Sex = {type=categorical, categories={M, F}}")
tmp2 <- list(use1 = c(identifier = "ID", time = "TIME", eventidentifier = "EVID",
amount = "AMT", interdoseinterval = NA, censored = NA, limit = NA,
observationtype = "YTYPE", administration = "ADM", steadystate = NA,
observation = "DV", occasion=NA, rate=NA, additionaldose=NA, missingdependentvariable=NA),
observation = "DV", occasion=NA, rate=NA, additionaldose=NA, missingdependentvariable=NA, infusiontime=NA),
cont = c("WT", "CRCL"),
cat = list(Race = list(cat = c("Caucasian", "Black", "Latin"),
quote = c(FALSE, FALSE, FALSE)),
Expand Down Expand Up @@ -73,7 +73,7 @@ limit = {use=limit}")
tmp2 <- list(use1 = c(identifier = "ID", time = "TIME", eventidentifier = "EVID",
amount = "AMT", interdoseinterval = "II", censored = "cens", limit = "limit",
observationtype = "YTYPE", administration = "ADM", steadystate = "SS", observation = "DV",
occasion=NA, rate=NA, additionaldose=NA, missingdependentvariable=NA),
occasion=NA, rate=NA, additionaldose=NA, missingdependentvariable=NA, infusiontime=NA),
cont = c("WT", "CRCL"),
cat = list(Race = list(cat = c("Caucasian", "Black", "Latin"),
quote = c(FALSE, FALSE, FALSE)),
Expand Down Expand Up @@ -158,3 +158,8 @@ test_that("mdv", {
expect_equal(as.character(.content("mdv = {use=missingdependentvariable}")),
"mdv = {use=missingdependentvariable}")
})

test_that("dur", {
expect_equal(as.character(.content("dur = {use=infusiontime}")),
"dur = {use=infusiontime}")
})
Loading