Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #2323 Popsim PkParameters not shown correctly for all ranges #2346

Merged
merged 1 commit into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}
}