Skip to content

Commit

Permalink
Fixes #2323 Popsim PkParameters not shown correctly for all ranges (#…
Browse files Browse the repository at this point in the history
…2346)

nice
  • Loading branch information
rwmcintosh authored Sep 20, 2022
1 parent 587ede3 commit 4fa171d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/PKSim.Core/Services/PKAnalysesTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ public PKAnalysis CreatePKAnalysisFromValues(PKValues pkValues, Simulation simul
/// If the string cannot be split on 'Range', returns the original text in both members of the tuple</returns>
private (string lowerRange, string upperRange) rangeDescriptions(string text)
{
var splitStrings = text.Split(new[] { "Range" }, StringSplitOptions.RemoveEmptyEntries);
var splitStrings = text.Split(new[] { "Range" }, StringSplitOptions.None);
var match = splitStrings.Length == 2;

if (!match)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public abstract class concern_for_PopulationPKAnalysesTask : ContextSpecificatio
protected const string _percentileId = "Percentile";
protected PercentileStatisticalAggregation _percentileStatisticalAggregation;
protected PopulationStatisticalAnalysis _populationStatisticalAnalysis;
private PredefinedStatisticalAggregation _rangeAggregation;

protected override void Context()
{
Expand All @@ -59,9 +60,12 @@ protected override void Context()
_statisticalDataCalculator = new StatisticalDataCalculator();
_representationInfoRepository = A.Fake<IRepresentationInfoRepository>();
_percentileStatisticalAggregation = new PercentileStatisticalAggregation { Selected = true, Percentile = 50 };
_rangeAggregation = new PredefinedStatisticalAggregation { Selected = true, Method = StatisticalAggregationType.Range90 };
_populationStatisticalAnalysis = new PopulationStatisticalAnalysis();
_populationStatisticalAnalysis.AddStatistic(_percentileStatisticalAggregation);
_populationStatisticalAnalysis.AddStatistic(_rangeAggregation);
A.CallTo(() => _representationInfoRepository.DisplayNameFor(_percentileStatisticalAggregation)).Returns(_percentileId);
A.CallTo(() => _representationInfoRepository.DisplayNameFor(_rangeAggregation)).Returns("Range 5% to 95%");
sut = new PKAnalysesTask(_lazyLoadTask, _pkValuesCalculator, _pkParameterRepository, _pkCalculationOptionsFactory, _entityPathResolver,_pkMapper, _dimensionRepository, _statisticalDataCalculator, _representationInfoRepository);

_populationSimulation = A.Fake<PopulationSimulation>();
Expand Down Expand Up @@ -233,10 +237,13 @@ public void should_aggregate_correctly()
A<PKParameterMode>.Ignored,
"Esomeprazole"
)).MustHaveHappened();
_pkAnalyses.Count().ShouldBeEqualTo(1);
_pkAnalyses.Count().ShouldBeEqualTo(3);
var curveData = _pkAnalyses.First().CurveData;
curveData.Caption.ShouldBeEqualTo("Esomeprazole-Percentile");
curveData.QuantityPath.ShouldBeEqualTo("Organism|PeripheralVenousBlood|Esomeprazole|Plasma (Peripheral Venous Blood)");

_pkAnalyses.Count(x => x.CurveData.Caption.Equals("Esomeprazole-5%")).ShouldBeEqualTo(1);
_pkAnalyses.Count(x => x.CurveData.Caption.Equals("Esomeprazole-95%")).ShouldBeEqualTo(1);
_pkAnalyses.Count(x => x.CurveData.Caption.Equals("Esomeprazole-Percentile")).ShouldBeEqualTo(1);
}
}
}

0 comments on commit 4fa171d

Please sign in to comment.