Skip to content

Commit

Permalink
Modified intervals such that if the same time interval is added more …
Browse files Browse the repository at this point in the history
…than once subsequent additions will update the parameters of the interval.
  • Loading branch information
john-harrold committed Nov 26, 2023
1 parent 3e514a8 commit 077b48c
Show file tree
Hide file tree
Showing 43 changed files with 171 additions and 87 deletions.
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# ruminate 0.2.0
- Added MB (model builder) module with
- Support for rxode2 and NONMEM models
- Fixed bug in NCA module where column details didn't update properly when switching between analyses
- Fixed bug in NCA module where column details didn't update properly when switching between analyses.
- Fixed bug where detecting dosing from rows left the dosing records in the data frame for subsequent NCA.
- Fixed bug where the same parameter(s) were added over the same interval resulting in [[numeric]] in the reported values. Now if the same time interval is added more than once subsequent additions will update the parameters of the interval.

# ruminate 0.1.1
- Initial release
41 changes: 31 additions & 10 deletions R/NCA_Server.R
Original file line number Diff line number Diff line change
Expand Up @@ -4970,17 +4970,38 @@ NCA_add_int = function(state, interval_start, interval_stop, nca_parameters){
current_ana = NCA_fetch_current_ana(state)


# This adds the row
current_ana[["intervals"]] =
rbind( current_ana[["intervals"]],
data.frame("start" = interval_start,
"stop" = interval_stop,
"np_actual" = params_string,
"np_text" = names_string,
"delete" = FALSE))
# Saving the current analysis with the interval added
state = NCA_set_current_ana(state, current_ana)

# This determines if the new interval already exists:
int_exists = FALSE
if(!is.null(current_ana[["intervals"]])){
if(any((current_ana[["intervals"]][["start"]] == interval_start) &
(current_ana[["intervals"]][["stop"]] == interval_stop))){
int_exists = TRUE
}
}

# This adds a new interval:
if(int_exists){
# If the interval exists we replace the values
int_ridx = which(c((current_ana[["intervals"]][["start"]] == interval_start) & (current_ana[["intervals"]][["stop"]] == interval_stop)))
# Now we update just the parameters:
current_ana[["intervals"]][int_ridx, "np_actual"] = params_string
current_ana[["intervals"]][int_ridx, "np_text" ] = names_string
formods::FM_le(state, "NCA_add_int: update")
} else {
# If the interval does not exist we add a new one:
current_ana[["intervals"]] =
rbind( current_ana[["intervals"]],
data.frame("start" = interval_start,
"stop" = interval_stop,
"np_actual" = params_string,
"np_text" = names_string,
"delete" = FALSE))
formods::FM_le(state, "NCA_add_int: append")
}

# Saving the current analysis with the interval added/updated
state = NCA_set_current_ana(state, current_ana)

state}

Expand Down
6 changes: 3 additions & 3 deletions docs/articles/noncompartmental_analysis.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ articles:
deployment: deployment.html
model_builder: model_builder.html
noncompartmental_analysis: noncompartmental_analysis.html
last_built: 2023-11-26T05:29Z
last_built: 2023-11-26T22:20Z

8 changes: 4 additions & 4 deletions docs/reference/MB_build_code.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions docs/reference/MB_del_current_element.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions docs/reference/MB_fetch_catalog.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/MB_fetch_code.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 077b48c

Please sign in to comment.