Open-Systems-Pharmacology / OSPSuite-R

R package for the OSPSuite
https://www.open-systems-pharmacology.org/OSPSuite-R/
Other
29 stars 12 forks source link

Data importer errors are not propagated to R #1186

Open PavelBal opened 1 year ago

PavelBal commented 1 year ago

Trying to load the uploaded sheet with the configuration in PK-Sim shows an error that no unit for Measurement is defined:

image

Doing the same in R does not produce an error:

importConfig <- loadDataImporterConfiguration("esqlabs_dataImporter_configuration.xml")
dataSets <- loadDataSetsFromExcel(xlsFilePath = "MissingTimeUnit.xlsx",
                                  importerConfigurationOrPath = importConfig,
                                   importAllSheets = TRUE)

The imported data set is corrupt:

> dataSets
$`PTU_Mendes_2014__Human_PeripheralVenousBlood_Plasma_100 [mg] PTU_po_fasted`
DataSet: 
   Name: PTU_Mendes_2014__Human_PeripheralVenousBlood_Plasma_100 [mg] PTU_po_fasted 
   X dimension:  
 Error in rClr::clrCallStatic(typename, methodName, self$ref) : 
Type: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Method: OSPSuite.Core.Domain.UnitSystem.Unit get_DisplayUnit()
Stack trace:
at OSPSuite.Core.Domain.Data.DataColumn.get_DisplayUnit()
at OSPSuite.Core.Domain.WithDisplayUnitExtensions.DisplayUnitName(IWithDisplayUnit withDisplayUnit)
8.
rClr::clrCallStatic(typename, methodName, self$ref) at dot-net-wrapper.R#69
7.
private$wrapExtensionMethod(WITH_DISPLAY_UNIT_EXTENSION, "DisplayUnitName", 
"displayUnit", value) at data-column.R#32
6.
(function (value) 
{
if (missing(value)) {
return(private$wrapExtensionMethod(WITH_DISPLAY_UNIT_EXTENSION, ... at data-set.R#48
5.
(function (value) 
{
if (missing(value)) {
return(private$.xColumn$displayUnit) ... at printable.R#40
4.
private$printLine("X unit", self$xUnit) at data-set.R#277
3.
.subset2(x, "print")(...)
2.
print.R6(x)
1.
(function (x, ...) 
UseMethod("print"))(x)

I also have seen other use cases where the error in R is much less informative than the corresponding error in PK-Sim, so I assume some messages are not properly forwarded.

PavelBal commented 1 year ago

@rwmcintosh @georgeDaskalakis Assigning you to this, must be a Core issue.

svavil commented 1 year ago

This might be less important for external users, but this slows down internal development.