Skip to content

Commit

Permalink
Merge pull request #21 from nlmixr2/infusiontime
Browse files Browse the repository at this point in the history
Add infusiontime/dur
  • Loading branch information
mattfidler authored Nov 6, 2024
2 parents 01ef650 + 18ab522 commit 1e877df
Show file tree
Hide file tree
Showing 8 changed files with 2,263 additions and 2,092 deletions.
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}")
})

0 comments on commit 1e877df

Please sign in to comment.