private SensitivityAnalysisRunResultsImport createSensitivityAnalysisRunResultsFrom(IReadOnlyList <PKParameterSensitivitiesImport> allImportedResults, IModelCoreSimulation simulation) { var sensitivityAnalysisRunResultsImport = new SensitivityAnalysisRunResultsImport(); //First add all available results allImportedResults.Each(import => addPKParameterSensitivitiesFromSingleFile(sensitivityAnalysisRunResultsImport, import)); //now check that the defined outputs are actually available in the population simulation validateImportedQuantities(sensitivityAnalysisRunResultsImport, simulation); return(sensitivityAnalysisRunResultsImport); }
private void addImportedQuantityToLogForSuccessfulImport(SensitivityAnalysisRunResultsImport sensitivityAnalysisRunResultsImport) { if (sensitivityAnalysisRunResultsImport.Status.Is(NotificationType.Error)) { return; } sensitivityAnalysisRunResultsImport.AddInfo(Messages.FollowingPKParameterSensitivityWereSuccessfullyImported); foreach (var pkParameterSensitivity in sensitivityAnalysisRunResultsImport.SensitivityAnalysisRunResult.AllPKParameterSensitivities) { sensitivityAnalysisRunResultsImport.AddInfo(pkParameterSensitivity.ToString()); } }
private void validateImportedQuantities(SensitivityAnalysisRunResultsImport sensitivityAnalysisRunResultsImport, IModelCoreSimulation modelCoreSimulation) { var allOutputs = _quantitiesRetriever.OutputsFrom(modelCoreSimulation); foreach (var quantityPath in sensitivityAnalysisRunResultsImport.SensitivityAnalysisRunResult.AllPKParameterSensitivities.Select(x => x.QuantityPath).Distinct()) { var quantity = allOutputs[quantityPath]; if (quantity != null) { continue; } sensitivityAnalysisRunResultsImport.AddError(Error.CouldNotFindQuantityWithPath(quantityPath)); } }
private void addPKParameterSensitivitiesFromSingleFile(SensitivityAnalysisRunResultsImport sensitivityAnalysisRunResultsImport, PKParameterSensitivitiesImport pkParameterSensitivitiesImport) { var sensitivityAnalysisRunResult = sensitivityAnalysisRunResultsImport.SensitivityAnalysisRunResult; sensitivityAnalysisRunResultsImport.PKParameterSensitivitiesImportFiles.Add(pkParameterSensitivitiesImport.PKParameterSensitivitiesImportFile); foreach (var pkParameterSensitivity in pkParameterSensitivitiesImport.PKParameterSensitivities) { if (sensitivityAnalysisRunResult.HasPKParameterSensitivityWithId(pkParameterSensitivity.Id)) { sensitivityAnalysisRunResultsImport.AddError(Error.DuplicatedPKParameterSensitivityFor(pkParameterSensitivity.Id)); } else { sensitivityAnalysisRunResult.AddPKParameterSensitivity(pkParameterSensitivity); } } }