Skip to content

Commit

Permalink
Fixes #2508 Do not export calculation methods with Individual when th…
Browse files Browse the repository at this point in the history
…ere is only one possible value (#2510)

* Fixes #2508 Do not export calculation methods with Individual when there is only one possible value

* PR feedback

* PR feedback and update core

* update core
  • Loading branch information
rwmcintosh committed Apr 3, 2023
1 parent 9f56755 commit 64485bd
Show file tree
Hide file tree
Showing 20 changed files with 112 additions and 53 deletions.
4 changes: 2 additions & 2 deletions src/PKSim.Assets.Images/PKSim.Assets.Images.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OSPSuite.Assets" Version="12.0.86" />
<PackageReference Include="OSPSuite.Assets.Images" Version="12.0.86" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.91" />
<PackageReference Include="OSPSuite.Assets.Images" Version="12.0.91" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/PKSim.Assets/PKSim.Assets.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OSPSuite.Assets" Version="12.0.86" />
<PackageReference Include="OSPSuite.Assets.Images" Version="12.0.86" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.91" />
<PackageReference Include="OSPSuite.Assets.Images" Version="12.0.91" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/PKSim.BatchTool/PKSim.BatchTool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OSPSuite.Core" Version="12.0.86" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.86" />
<PackageReference Include="OSPSuite.Core" Version="12.0.91" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.91" />
<PackageReference Include="OSPSuite.DevExpress" Version="21.2.3" />
<PackageReference Include="OSPSuite.FuncParser" Version="4.0.0.54" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModel" Version="4.0.0.53" GeneratePathProperty="true" />
Expand Down
4 changes: 2 additions & 2 deletions src/PKSim.CLI.Core/PKSim.CLI.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OSPSuite.Assets" Version="12.0.86" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.91" />
<PackageReference Include="OSPSuite.Utility" Version="4.0.0.4" />
<PackageReference Include="OSPSuite.Core" Version="12.0.86" />
<PackageReference Include="OSPSuite.Core" Version="12.0.91" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/PKSim.CLI/PKSim.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.8.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.1.0" />
<PackageReference Include="OSPSuite.Core" Version="12.0.86" />
<PackageReference Include="OSPSuite.Presentation" Version="12.0.86" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.86" />
<PackageReference Include="OSPSuite.Core" Version="12.0.91" />
<PackageReference Include="OSPSuite.Presentation" Version="12.0.91" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.91" />
<PackageReference Include="OSPSuite.Utility" Version="4.0.0.4" />
<PackageReference Include="OSPSuite.FuncParser" Version="4.0.0.54" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModel" Version="4.0.0.53" GeneratePathProperty="true" />
Expand Down
8 changes: 4 additions & 4 deletions src/PKSim.Core/PKSim.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="OSPSuite.Utility" Version="4.0.0.4" />
<PackageReference Include="OSPSuite.Core" Version="12.0.86" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.86" />
<PackageReference Include="OSPSuite.Assets.Images" Version="12.0.86" />
<PackageReference Include="OSPSuite.Infrastructure.Import" Version="12.0.86" />
<PackageReference Include="OSPSuite.Core" Version="12.0.91" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.91" />
<PackageReference Include="OSPSuite.Assets.Images" Version="12.0.91" />
<PackageReference Include="OSPSuite.Infrastructure.Import" Version="12.0.91" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using OSPSuite.Core.Domain;
using OSPSuite.Utility.Collections;
using PKSim.Core.Model;

Expand All @@ -6,5 +7,6 @@ namespace PKSim.Core.Repositories
public interface ICalculationMethodCategoryRepository : IStartableRepository<CalculationMethodCategory>
{
CalculationMethodCategory FindBy(string categoryName);
bool HasMoreThanOneOption(CalculationMethod calculationMethod, Species species);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System.Collections.Generic;
using System.Linq;
using OSPSuite.Core.Domain;
using OSPSuite.Utility.Collections;
using OSPSuite.Utility.Extensions;
using PKSim.Core.Extensions;
using PKSim.Core.Model;
using PKSim.Core.Repositories;

Expand Down Expand Up @@ -33,7 +35,7 @@ protected override void DoStart()
{
var sortedCalculationMethods = calculationMethods.OrderBy(cm => _flatCalculationMethodRepository.FindById(cm.Name).Sequence);
var flatCategory = _flatCategoryRepository.FindBy(calculationMethods.Key);
var calculationMethodCategory = new CalculationMethodCategory {Name = flatCategory.Name, CategoryType = flatCategory.CategoryType};
var calculationMethodCategory = new CalculationMethodCategory { Name = flatCategory.Name, CategoryType = flatCategory.CategoryType };
sortedCalculationMethods.Each(calculationMethodCategory.Add);
_calculationMethodCategories.Add(calculationMethodCategory);
}
Expand All @@ -44,5 +46,10 @@ public CalculationMethodCategory FindBy(string categoryName)
Start();
return _calculationMethodCategories[categoryName];
}

public bool HasMoreThanOneOption(CalculationMethod calculationMethod, Species species)
{
return FindBy(calculationMethod.Category).AllForSpecies(species).HasAtLeastTwo();
}
}
}
18 changes: 9 additions & 9 deletions src/PKSim.Infrastructure/PKSim.Infrastructure.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.0" />
<PackageReference Include="Newtonsoft.Json.Schema" Version="3.0.13" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.86" />
<PackageReference Include="OSPSuite.Core" Version="12.0.86" />
<PackageReference Include="OSPSuite.Infrastructure" Version="12.0.86" />
<PackageReference Include="OSPSuite.Infrastructure.Castle" Version="12.0.86" />
<PackageReference Include="OSPSuite.Infrastructure.Export" Version="12.0.86" />
<PackageReference Include="OSPSuite.Infrastructure.Import" Version="12.0.86" />
<PackageReference Include="OSPSuite.Infrastructure.Reporting" Version="12.0.86" />
<PackageReference Include="OSPSuite.Infrastructure.Serialization" Version="12.0.86" />
<PackageReference Include="OSPSuite.Presentation.Serialization" Version="12.0.86" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.91" />
<PackageReference Include="OSPSuite.Core" Version="12.0.91" />
<PackageReference Include="OSPSuite.Infrastructure" Version="12.0.91" />
<PackageReference Include="OSPSuite.Infrastructure.Castle" Version="12.0.91" />
<PackageReference Include="OSPSuite.Infrastructure.Export" Version="12.0.91" />
<PackageReference Include="OSPSuite.Infrastructure.Import" Version="12.0.91" />
<PackageReference Include="OSPSuite.Infrastructure.Reporting" Version="12.0.91" />
<PackageReference Include="OSPSuite.Infrastructure.Serialization" Version="12.0.91" />
<PackageReference Include="OSPSuite.Presentation.Serialization" Version="12.0.91" />
<PackageReference Include="OSPSuite.Utility" Version="4.0.0.4" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions src/PKSim.Matlab/PKSim.Matlab.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OSPSuite.Assets" Version="12.0.86" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.91" />
<PackageReference Include="OSPSuite.Utility" Version="4.0.0.4" />
<PackageReference Include="OSPSuite.Core" Version="12.0.86" />
<PackageReference Include="OSPSuite.Core" Version="12.0.91" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@
using PKSim.Presentation.DTO.Mappers;
using System.Collections.Generic;
using System.Linq;
using OSPSuite.Core.Qualification;
using OSPSuite.Utility.Extensions;
using PKSim.Core.Extensions;
using PKSim.Core.Repositories;
using static PKSim.Core.CoreConstants;
using CalculationMethod = OSPSuite.Core.Domain.CalculationMethod;
using Species = PKSim.Core.Model.Species;

namespace PKSim.Presentation.Mappers
{
Expand All @@ -19,11 +25,13 @@ public interface IIndividualToIndividualBuildingBlockMapper : IPathAndValueBuild
public class IndividualToIndividualBuildingBlockMapper : PathAndValueBuildingBlockMapper<Individual, IndividualBuildingBlock, IndividualParameter>, IIndividualToIndividualBuildingBlockMapper
{
private readonly ICalculationMethodToCategoryCalculationMethodDTOMapper _calculationMethodDTOMapper;
private readonly ICalculationMethodCategoryRepository _calculationMethodCategoryRepository;

public IndividualToIndividualBuildingBlockMapper(IObjectBaseFactory objectBaseFactory, IEntityPathResolver entityPathResolver, IApplicationConfiguration applicationConfiguration,
ILazyLoadTask lazyLoadTask, ICalculationMethodToCategoryCalculationMethodDTOMapper calculationMethodDTOMapper) : base(objectBaseFactory, entityPathResolver, applicationConfiguration, lazyLoadTask)
ILazyLoadTask lazyLoadTask, ICalculationMethodToCategoryCalculationMethodDTOMapper calculationMethodDTOMapper, ICalculationMethodCategoryRepository calculationMethodCategoryRepository) : base(objectBaseFactory, entityPathResolver, applicationConfiguration, lazyLoadTask)
{
_calculationMethodDTOMapper = calculationMethodDTOMapper;
_calculationMethodCategoryRepository = calculationMethodCategoryRepository;
}

protected override IReadOnlyList<IParameter> AllParametersFor(Individual individual)
Expand All @@ -46,7 +54,7 @@ public override IndividualBuildingBlock MapFrom(Individual input)
addOriginDataToBuildingBlock(buildingBlock, Assets.PKSimConstants.UI.Weight, input.OriginData.Weight);
addOriginDataToBuildingBlock(buildingBlock, Assets.PKSimConstants.UI.Population, input.OriginData.Population?.DisplayName);

input.OriginData.AllCalculationMethods().MapAllUsing(_calculationMethodDTOMapper)
input.OriginData.AllCalculationMethods().Where(cm => _calculationMethodCategoryRepository.HasMoreThanOneOption(cm, input.Species)).MapAllUsing(_calculationMethodDTOMapper)
.Each(x => addOriginDataToBuildingBlock(buildingBlock, x.DisplayName, x.CategoryItem.DisplayName));

buildingBlock.OriginData.ValueOrigin = input.OriginData.ValueOrigin.Clone();
Expand Down
6 changes: 3 additions & 3 deletions src/PKSim.Presentation/PKSim.Presentation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OSPSuite.Assets" Version="12.0.86" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.91" />
<PackageReference Include="OSPSuite.TeXReporting" Version="3.0.0.4" />
<PackageReference Include="OSPSuite.Utility" Version="4.0.0.4" />
<PackageReference Include="OSPSuite.Presentation" Version="12.0.86" />
<PackageReference Include="OSPSuite.Core" Version="12.0.86" />
<PackageReference Include="OSPSuite.Presentation" Version="12.0.91" />
<PackageReference Include="OSPSuite.Core" Version="12.0.91" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/PKSim.R/PKSim.R.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@


<ItemGroup>
<PackageReference Include="OSPSuite.Assets" Version="12.0.86" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.91" />
<PackageReference Include="OSPSuite.Utility" Version="4.0.0.4" />
<PackageReference Include="OSPSuite.Core" Version="12.0.86" />
<PackageReference Include="OSPSuite.Core" Version="12.0.91" />
<PackageReference Include="OSPSuite.FuncParser" Version="4.0.0.54" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModel" Version="4.0.0.53" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModelSolver_CVODES" Version="4.1.0.8" GeneratePathProperty="true" />
Expand Down
8 changes: 4 additions & 4 deletions src/PKSim.UI/PKSim.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.0" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.86" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.91" />
<PackageReference Include="OSPSuite.DataBinding" Version="3.0.0.4" />
<PackageReference Include="OSPSuite.DataBinding.DevExpress" Version="6.0.0.2" />
<PackageReference Include="OSPSuite.DevExpress" Version="21.2.3" />
<PackageReference Include="OSPSuite.Utility" Version="4.0.0.4" />
<PackageReference Include="OSPSuite.Presentation" Version="12.0.86" />
<PackageReference Include="OSPSuite.UI" Version="12.0.86" />
<PackageReference Include="OSPSuite.Core" Version="12.0.86" />
<PackageReference Include="OSPSuite.Presentation" Version="12.0.91" />
<PackageReference Include="OSPSuite.UI" Version="12.0.91" />
<PackageReference Include="OSPSuite.Core" Version="12.0.91" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/PKSim/PKSim.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OSPSuite.Assets" Version="12.0.86" />
<PackageReference Include="OSPSuite.Core" Version="12.0.86" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.91" />
<PackageReference Include="OSPSuite.Core" Version="12.0.91" />
<PackageReference Include="OSPSuite.DevExpress" Version="21.2.3" />
<PackageReference Include="OSPSuite.FuncParser" Version="4.0.0.54" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModel" Version="4.0.0.53" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModelSolver_CVODES" Version="4.1.0.8" GeneratePathProperty="true" />
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.112" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.Presentation" Version="12.0.86" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.Presentation" Version="12.0.91" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.TeXReporting" Version="3.0.0.4" GeneratePathProperty="true" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions tests/PKSim.Matlab.Tests/PKSim.Matlab.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.86" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.91" />
<PackageReference Include="OSPSuite.BDDHelper" Version="4.0.0.1" />
<PackageReference Include="OSPSuite.Core" Version="12.0.86" />
<PackageReference Include="OSPSuite.Core" Version="12.0.91" />
<PackageReference Include="OSPSuite.FuncParser" Version="4.0.0.54" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModel" Version="4.0.0.53" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModelSolver_CVODES" Version="4.1.0.8" GeneratePathProperty="true" />
Expand Down
4 changes: 2 additions & 2 deletions tests/PKSim.R.Tests/PKSim.R.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.86" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.91" />
<PackageReference Include="OSPSuite.BDDHelper" Version="4.0.0.1" />
<PackageReference Include="OSPSuite.Core" Version="12.0.86" />
<PackageReference Include="OSPSuite.Core" Version="12.0.91" />
<PackageReference Include="OSPSuite.FuncParser" Version="4.0.0.54" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModel" Version="4.0.0.53" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModelSolver_CVODES" Version="4.1.0.8" GeneratePathProperty="true" />
Expand Down
4 changes: 2 additions & 2 deletions tests/PKSim.Tests/PKSim.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.86" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.91" />
<PackageReference Include="OSPSuite.BDDHelper" Version="4.0.0.1" />
<PackageReference Include="OSPSuite.Core" Version="12.0.86" />
<PackageReference Include="OSPSuite.Core" Version="12.0.91" />
<PackageReference Include="OSPSuite.FuncParser" Version="4.0.0.54" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModel" Version="4.0.0.53" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModelSolver_CVODES" Version="4.1.0.8" GeneratePathProperty="true" />
Expand Down
Loading

0 comments on commit 64485bd

Please sign in to comment.