Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
Fix zero dose + evid=2 to not be counted as dose
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Feb 7, 2024
1 parent 8249e25 commit 3e9b16b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions inst/include/rxode2parseHandleEvid.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,13 @@ static inline int handleTlastInlineUpateDosingInformation(rx_solving_options_ind
}
break;
}
if (curDose[0] == 0.0 &&
getEvidP1(ind, ind->idx) == 2) {
// evid=2 can add zero dose to turn on a compartment;
// therefore if the current dose is zero and the next evid = 2
// don't treat it as a new dose.
return 0;
}
return 1;
}

Expand Down
4 changes: 2 additions & 2 deletions src/etTran.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@ List etTransParse(List inData, List mv, bool addCmt=false,
else caddl = inAddl[i];
if (IntegerVector::is_na(caddl)) caddl = 0;
// EVID flag
if (evidCol == -1){
if (evidCol == -1) {
// Missing EVID
if (rateI == 0 && (ISNA(camt) || camt == 0.0)){
cevid = 0;
Expand Down Expand Up @@ -1252,7 +1252,7 @@ List etTransParse(List inData, List mv, bool addCmt=false,
cevid=0;
}
}
switch(cevid){
switch(cevid) {
case 0:
// Observation
nobs++;
Expand Down

0 comments on commit 3e9b16b

Please sign in to comment.