public DataTable PKAnalysesToDataTable(PopulationSimulationPKAnalyses pkAnalyses, IModelCoreSimulation simulation) { var dataTable = new DataTable(simulation.Name); dataTable.AddColumn <int>(INDIVIDUAL_ID); dataTable.AddColumn <string>(QUANTITY_PATH); dataTable.AddColumn <string>(PARAMETER); dataTable.AddColumn <string>(VALUE); dataTable.AddColumn <string>(UNIT); dataTable.BeginLoadData(); foreach (var quantityPKParameter in pkAnalyses.All()) { var quantityPath = quantityPKParameter.QuantityPath; var molWeight = simulation.MolWeightFor(quantityPath); var pkParameter = _pkParameterRepository.FindByName(quantityPKParameter.Name); var quantityPKParameterContext = new QuantityPKParameterContext(quantityPKParameter, molWeight); var mergedDimension = _dimensionFactory.MergedDimensionFor(quantityPKParameterContext); var unit = mergedDimension.UnitOrDefault(pkParameter.DisplayUnit); quantityPKParameter.ValueCache.KeyValues.Each(kv => { var row = dataTable.NewRow(); row[INDIVIDUAL_ID] = kv.Key; row[QUANTITY_PATH] = inQuote(quantityPath); row[PARAMETER] = inQuote(pkParameter.Name); row[VALUE] = mergedDimension.BaseUnitValueToUnitValue(unit, kv.Value).ConvertedTo <string>(); row[UNIT] = unit.Name; dataTable.Rows.Add(row); }); } dataTable.EndLoadData(); return(dataTable); }
public void Visit(PopulationSimulationPKAnalyses populationSimulationPKAnalyses) { var allQuantityPKAnalysis = populationSimulationPKAnalyses.All().ToList(); populationSimulationPKAnalyses.Clear(); allQuantityPKAnalysis.Each(x => { x.Name = ConvertPKParameterName(x.Name); populationSimulationPKAnalyses.AddPKAnalysis(x); }); _converted = true; }
public void should_exclude_the_norm_parameters() { _popAnalaysis.All().Count().ShouldBeEqualTo(1); _popAnalaysis.PKParameterFor("Liver|Cell|Drug|Concentration", _p1.Name).Values[0].ShouldBeEqualTo(10f); _popAnalaysis.HasPKParameterFor("Liver|Cell|Drug|Concentration", _p2.Name).ShouldBeFalse(); }
public void should_return_a_pk_analysis_object_with_the_expected_data() { _result.All().Count().ShouldBeEqualTo(2); _result.HasPKParameterFor(_outputPath, "My PK-Parameter").ShouldBeTrue(); _result.HasPKParameterFor(_outputPath, "C_max").ShouldBeTrue(); }
public void should_have_added_the_pk_parameters_to_the_existing_pk_parameters() { _pkAnalysis.All().ShouldContain(_pkParameter1, _pkParameter2); }
public void should_also_return_value_for_the_dynamic_parameters() { _popAnalysis.All().Count().ShouldBeEqualTo(2); _popAnalysis.PKParameterFor("Liver|Cell|Drug|Concentration", _p1.Name).ValueFor(0).ShouldBeEqualTo(10f); _popAnalysis.PKParameterFor("Liver|Cell|Drug|Concentration", _userDefinedParameter1.Name).ValueFor(0).ShouldBeEqualTo(30f); }