tensfeldt / openNCA

openNCA computation engine is an R package that provides for generation of pharmacokinetic parameter estimates using non-compartmental (NCA) pharmacokinetic analysis methods.
MIT License
27 stars 5 forks source link

openNCA CE release 3.0.2 missing DOSE and DOSEUNI variables cause error but should be allowed and prompt utilization of unit DOSE #291

Open tensfeldt opened 3 years ago

tensfeldt commented 3 years ago

This is issue was identified with release 3.0.2 and testcase tc2103. Dataset has no DOSE nor DOSEUNI fields which ordinarily would cause initiate utilization of a unit DOSE value of 1 (one) dose unit.

However, with this test case (haven't identified others at this point) an error is generated that causes the code to exit and stop. This may be occurring within the unit_conversion code since the error message appears after the messages generated from unit_conversion pass within the code.

This behavior doesn't appear to be related to the presence of "DOSE" in RETURNCOLS for the model configuration template as once DOSE is removed, the error persists.

> results_list <- run_computation(data=conc, map=mct, flag=flags, parameterset="PARAMETERLIST")
openNCA computation engine version 3.0.2
Computation Run Date/Time: 2021-07-30 13:50:57
**DOSE  as defined in 'map', do not appear in input concentration dataset 
assuming unit dose amounts for:  DOSE 
DOSEU  as defined in 'map', do not appear in input concentration dataset** 
unit_conversion : Unit Class 1 (Time) time_col:  TMAX TMIN TLAST TLAG KELTMLO KELTMHI THALF LASTTIME MRTLAST MRTEVIFO MRTEVIFP  parameters are scaled from  HR  to  HR  via scaling factor:  1 
unit_conversion : Unit Class 4 (Volume) volume_col:  VZFO VZFP  parameters are scaled from  ML  to  L  via scaling factor:  0.001 
unit_conversion : Unit Class 5 (Amount/Volume) conc_col:  CMAX CMIN CLAST CEST KELC0  parameters are scaled from  UG/ML  to  NG/ML  via scaling factor:  1000 
unit_conversion : Unit Class 6 (1/Time) kel_col:  KEL  parameters are scaled from  1/HR  to  1/HR  via scaling factor:  1 
unit_conversion : Unit Class 7 (Volume/Time) cl_col:  CLFO CLFP  parameters are scaled from  ML/HR  to  L/HR  via scaling factor:  0.001 
unit_conversion : Unit Class 8: (Amount.Time/Volume) auc_col:  AUCALL AUCLAST AUCLASTC AUC1 AUC2 AUC3 AUC4 AUC5 AUC6 AUC7 AUC8 AUC9 AUC10 AUC11 AUC12 AUC13 AUC14 AUC15 AUC16 AUC17 AUC18 AUCINFO AUCINFP AUCINFOC AUCINFPC  parameters are scaled from  UG.HR/ML  to  NG.HR/ML  via scaling factor:  1000 
unit_conversion : Unit Class 9: (Amount.Time.Time/Volume) aumc_col:  AUMCLAST AUMCINFO AUMCINFP  parameters are scaled from  UG.HR.HR/ML  to  NG.HR.HR/ML  via scaling factor:  1000 
**Error in `[.data.frame`(data_data, , map_data[, unlist(strsplit(map_data$DOSEULIST,  : 
  undefined columns selected**
In addition: Warning messages:
1: In validate_timeconc_data(map, data, flag, verbose = verbose) :
  assuming unit dose amounts for each dose
2: In validate_timeconc_data(map, data, flag, verbose = verbose) :
  Dosing unit: 'DOSEU' isn't present in input concentration dataset

3: In validate_timeconc_data(map, data, flag, verbose = verbose) :
  No tau information provided in 'map'.
4: In validate_timeconc_data(map, data, flag, verbose = verbose) :
  No told information provided in 'map'.
5: In run_computation(data = conc, map = mct, flag = flags, parameterset = "PARAMETERLIST") :
  'TAUs and TOLDs values are not provided via 'flag'! Using values provided via 'data' instead (if present)!
6: In run_computation(data = conc, map = mct, flag = flags, parameterset = "PARAMETERLIST") :
  NAs introduced by coercion
7: In any(k) : coercing argument of type 'double' to logical
8: In run_M1_SD_computation(data = merged_data, map = map_data, method = method,  :
  Flag 'FLGEMESIS' is not present in the dataset
9: In unit_conversion(data = data_data, map = map_data, result = computation_df,  :
  'AMOUNTU' #2# is not present in the dataset provided via 'map'
10: In unit_conversion(data = data_data, map = map_data, result = computation_df,  :
  'DOSEU' value provided via 'map' is not present in the dataset provided via 'data'
tensfeldt commented 3 years ago

The root cause of this issue has been identified. If DOSE units are missing from the input dataset when a DOSE is imputed as a unit dose, they cannot be found in the unit_conversion for processing within Unit Class 14 (Volume/Weight - body weight normalized volumes) or Unit Class 15 (Volume/Time/Body Weight - body weight normalized clearances).

A workaround in advance of a code fix is to add a DOSE unit to the input dataset and ensure that the model configuration template is configured to point to that data field. If this is done, parameter results are generated as expected.

tensfeldt commented 3 years ago

Issue is addressed in openNCA CE release 3.0.3 (not yet committed to repo - will update comment when git history cleaned up and pushed)