-
Notifications
You must be signed in to change notification settings - Fork 13
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
WIP #486 expose data repository #487
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WIP
R/data-repository.R
Outdated
DataColumn$new(private$wrapReadOnlyProperty("BaseGrid", value)) | ||
}, | ||
#' @field columns Returns all columns (including baseGrid defined in the data) | ||
columns = function(value){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cloneable = FALSE, | ||
active = list( | ||
#' @field baseGrid Returns the base column for the population (typically time column) | ||
baseGrid = function(value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in core, we have basegrid, columns, and allButBaseGrid.
I will implement the same methods (baseGrid is typically time, columns are all columns in the dataRepo, allButBaseGrids are all except basegrid)
Should we have a property called Time that returned baseGrid? or property called Measurement that returns col2 and a property called error that returns col3? not sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have a property called Time that returned baseGrid? or property called Measurement that returns col2 and a property called error that returns col3?
I would say no and no. Basegrid might be different from "Time", we could have several measurements and several errors, so I wouldn't provide shortcuts for the specific use case "ObservedDataRepo = {Time, Measurement, Error}"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could have several measurements and several errors,
Reallly, do we have it somewhere (and how)? @Yuri05
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory results from a simulation etc.. are DataRepositories
So yes we can have one time and multiple measurements. Each measurements can in theory have multiple errors. I think we are using this for the PI results.
Practically probably not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@msevestre I propose some changes to the naming.
cloneable = FALSE, | ||
active = list( | ||
#' @field baseGrid Returns the base column for the population (typically time column) | ||
baseGrid = function(value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could have several measurements and several errors,
Reallly, do we have it somewhere (and how)? @Yuri05
}, | ||
#' @field metaData Returns a named list of meta data defined for the data repository. | ||
#' where the name is the name of the metaData and the value is the meta data value. | ||
metaData = function(value){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
R/data-repository.R
Outdated
if (is.null(private$.metaData)) { | ||
netExtendedProperties <- private$wrapReadOnlyProperty("ExtendedProperties", value) | ||
netMetaData <- rClr::clrGet(netExtendedProperties, "All") | ||
names <- unlist(lapply(netMetaData, function(data) rClr::clrGet(data, "Name"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PavelBal Any way to do this 3 lines in one? Seems to be a bit stupid. At any rate, the array will be very small anyways so I don't mind iterating twice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't think of anything.
@@ -18,6 +18,4 @@ initPackage <- function() { | |||
apiConfig$pkParametersFilePath <- filePathFor("OSPSuite.PKParameters.xml") | |||
|
|||
rClr::clrCallStatic("OSPSuite.R.Api", "InitializeOnce", apiConfig$ref) | |||
dimensionTask <- getNetTask("DimensionTask") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Yuri05 THis was creating some issues. And then I wondered. Do we actually need to load if from .NET
isn't it enough to have it a constant as it is now?
@@ -48,6 +48,10 @@ ifNotNull <- function(condition, outputIfNotNull, outputIfNull = NULL) { | |||
#' See https://github.com/Open-Systems-Pharmacology/OSPSuite-R/issues/476 for details | |||
#' @import stringr | |||
encodeUnit <- function(unit) { | |||
|
|||
#TODO maybe we don't even need to load from .NET | |||
# dimensionTask <- getNetTask("DimensionTask") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Yuri05 If we want to load from .NET we would need to do it here the first time is is being used. But why do we need this in the first place since ospsuiteEnv$muSymbol
is already set
see ospsuite-env.R
Specifies the symbol used for µ. This will be set by the .NET layer
ospsuiteEnv$muSymbol <- "µ"
R/data-repository.R
Outdated
if (is.null(private$.metaData)) { | ||
netExtendedProperties <- private$wrapReadOnlyProperty("ExtendedProperties", value) | ||
netMetaData <- rClr::clrGet(netExtendedProperties, "All") | ||
names <- unlist(lapply(netMetaData, function(data) rClr::clrGet(data, "Name"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unlist(x, use.names = FALSE) is much faster than unlist(x).
No idea what the actual benefit would be here, but why not add it..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
@@ -18,6 +18,4 @@ initPackage <- function() { | |||
apiConfig$pkParametersFilePath <- filePathFor("OSPSuite.PKParameters.xml") | |||
|
|||
rClr::clrCallStatic("OSPSuite.R.Api", "InitializeOnce", apiConfig$ref) | |||
dimensionTask <- getNetTask("DimensionTask") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you remove "DimensionTask"? I was counting on it for the utilities-dimensions
.
Btw. I only was creating it the first time it was requested:
In ospsuite-env (esqlabsEnv in my code):
# NetTask "DimensionTask" cached for performance benefits. Created the first time it is requested.
esqlabsEnv$DimensionTask <- NULL
Then a function somewhere:
#' Return an instance of the .NET Task "DimensionTask".
#'
#' @return An instance of the Task
getDimensionTask <- function() {
dimTask <- esqlabsEnv$DimensionTask
if (is.null(dimTask)) {
dimTask <- getNetTask("DimensionTask")
esqlabsEnv$DimensionTask <- dimTask
}
return(dimTask)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remove it. Instatntiating object in the init creates weird error messages during build.
Can you quantify cached for performance benefits.
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are looking at sthg else. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but I am going to add it to core because it's probably a good optimization since this is used quite often
@@ -48,6 +48,10 @@ ifNotNull <- function(condition, outputIfNotNull, outputIfNull = NULL) { | |||
#' See https://github.com/Open-Systems-Pharmacology/OSPSuite-R/issues/476 for details | |||
#' @import stringr | |||
encodeUnit <- function(unit) { | |||
|
|||
#TODO maybe we don't even need to load from .NET |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh you have it here... See my suggestion above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what you mean
This is just a WIP. I would like to understand what we need exactly
So far