Skip to content

Commit

Permalink
Fixes #2537 weird column names (#2672)
Browse files Browse the repository at this point in the history
* Fixes #2537 weird column names

* Fixes #2537 weird column names
  • Loading branch information
msevestre authored Jun 23, 2023
1 parent eec9429 commit 31ddbc8
Show file tree
Hide file tree
Showing 24 changed files with 127 additions and 85 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.198" />
<PackageReference Include="OSPSuite.Assets.Images" Version="12.0.198" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.199" />
<PackageReference Include="OSPSuite.Assets.Images" Version="12.0.199" />
</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.198" />
<PackageReference Include="OSPSuite.Assets.Images" Version="12.0.198" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.199" />
<PackageReference Include="OSPSuite.Assets.Images" Version="12.0.199" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/PKSim.Assets/PKSimConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1785,7 +1785,7 @@ public static class UI
public static readonly string MaxValue = "Maximum Value";
public static readonly string ArithmeticMean = "Arithmetic Mean";
public static readonly string GeometricMean = "Geometric Mean";
public static readonly string StandardDeviation = "Standard Deviation";
public static readonly string GeometricStandardDeviation = "Geometric Standard Deviation";
public static readonly string Median = "Median";
public static readonly string PercentilePercent = "% Percentile";
public static readonly string AllGender = "All";
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.198" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.198" />
<PackageReference Include="OSPSuite.Core" Version="12.0.199" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.199" />
<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.198" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.199" />
<PackageReference Include="OSPSuite.Utility" Version="4.0.0.4" />
<PackageReference Include="OSPSuite.Core" Version="12.0.198" />
<PackageReference Include="OSPSuite.Core" Version="12.0.199" />
</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.198" />
<PackageReference Include="OSPSuite.Presentation" Version="12.0.198" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.198" />
<PackageReference Include="OSPSuite.Core" Version="12.0.199" />
<PackageReference Include="OSPSuite.Presentation" Version="12.0.199" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.199" />
<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 @@ -31,10 +31,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.198" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.198" />
<PackageReference Include="OSPSuite.Assets.Images" Version="12.0.198" />
<PackageReference Include="OSPSuite.Infrastructure.Import" Version="12.0.198" />
<PackageReference Include="OSPSuite.Core" Version="12.0.199" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.199" />
<PackageReference Include="OSPSuite.Assets.Images" Version="12.0.199" />
<PackageReference Include="OSPSuite.Infrastructure.Import" Version="12.0.199" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
</ItemGroup>

Expand Down
18 changes: 12 additions & 6 deletions src/PKSim.Infrastructure/ORM/Repositories/OntogenyRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,24 @@ public class OntogenyRepository : StartableRepository<Ontogeny>, IOntogenyReposi
public ICache<string, string> SupportedProteins { get; }
private readonly IDisplayUnitRetriever _displayUnitRetriever;
private readonly IFormulaFactory _formulaFactory;
private readonly IGroupRepository _groupRepository;

public OntogenyRepository(
IFlatOntogenyRepository flatOntogenyRepository,
IInterpolation interpolation,
IObjectBaseFactory objectBaseFactory,
IDimensionRepository dimensionRepository,
IDisplayUnitRetriever displayUnitRetriever,
IFormulaFactory formulaFactory)
IFormulaFactory formulaFactory,
IGroupRepository groupRepository)
{
_flatOntogenyRepository = flatOntogenyRepository;
_interpolation = interpolation;
_objectBaseFactory = objectBaseFactory;
_dimensionRepository = dimensionRepository;
_displayUnitRetriever = displayUnitRetriever;
_formulaFactory = formulaFactory;
_groupRepository = groupRepository;
_allOntogenies = new List<Ontogeny>();
_ontogenyValues = new Cache<CompositeKey, IReadOnlyList<OntogenyMetaData>>(onMissingKey: x => new List<OntogenyMetaData>());
SupportedProteins = new Cache<string, string>
Expand Down Expand Up @@ -184,24 +187,27 @@ private Ontogeny forMolecule(OriginData originData, string molecule)

public DataRepository OntogenyToRepository(Ontogeny ontogeny, string containerName)
{
var dataRepository = new DataRepository {Name = PKSimConstants.UI.OntogenyFor(ontogeny.DisplayName, containerName)};
var group = _groupRepository.GroupByName(containerName);
var dataRepository = new DataRepository {Name = PKSimConstants.UI.OntogenyFor(ontogeny.DisplayName, group.DisplayName) };
var xDimension = _dimensionRepository.AgeInYears;
var yDimension = _dimensionRepository.NoDimension;
var xUnit = _displayUnitRetriever.PreferredUnitFor(xDimension);
var yUnit = _displayUnitRetriever.PreferredUnitFor(yDimension);

var pma = new BaseGrid(PKSimConstants.UI.PostMenstrualAge, xDimension) {DisplayUnit = xUnit };
var mean = new DataColumn(dataRepository.Name, yDimension, pma) {DisplayUnit = yUnit };
var std = new DataColumn(PKSimConstants.UI.StandardDeviation, yDimension, pma) {DisplayUnit = yUnit};
var geoSD = new DataColumn(PKSimConstants.UI.GeometricStandardDeviation, yDimension, pma) {DisplayUnit = yUnit};
//note:The main column for a range plot is the range area. The related column is the mean value. Hence the mean
//becomes the related column of the geoSD
mean.DataInfo.AuxiliaryType = AuxiliaryType.GeometricMeanPop;
std.AddRelatedColumn(mean);
geoSD.AddRelatedColumn(mean);
dataRepository.Add(mean);
dataRepository.Add(std);
dataRepository.Add(geoSD);

var allOntogenies = AllValuesFor(ontogeny, containerName).OrderBy(x => x.PostmenstrualAge).ToList();
pma.Values = values(allOntogenies, x => x.PostmenstrualAge);
mean.Values = values(allOntogenies, x => x.OntogenyFactor);
std.Values = values(allOntogenies, x => x.Deviation);
geoSD.Values = values(allOntogenies, x => x.Deviation);
return dataRepository;
}

Expand Down
18 changes: 9 additions & 9 deletions src/PKSim.Infrastructure/PKSim.Infrastructure.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,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.198" />
<PackageReference Include="OSPSuite.Core" Version="12.0.198" />
<PackageReference Include="OSPSuite.Infrastructure" Version="12.0.198" />
<PackageReference Include="OSPSuite.Infrastructure.Castle" Version="12.0.198" />
<PackageReference Include="OSPSuite.Infrastructure.Export" Version="12.0.198" />
<PackageReference Include="OSPSuite.Infrastructure.Import" Version="12.0.198" />
<PackageReference Include="OSPSuite.Infrastructure.Reporting" Version="12.0.198" />
<PackageReference Include="OSPSuite.Infrastructure.Serialization" Version="12.0.198" />
<PackageReference Include="OSPSuite.Presentation.Serialization" Version="12.0.198" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.199" />
<PackageReference Include="OSPSuite.Core" Version="12.0.199" />
<PackageReference Include="OSPSuite.Infrastructure" Version="12.0.199" />
<PackageReference Include="OSPSuite.Infrastructure.Castle" Version="12.0.199" />
<PackageReference Include="OSPSuite.Infrastructure.Export" Version="12.0.199" />
<PackageReference Include="OSPSuite.Infrastructure.Import" Version="12.0.199" />
<PackageReference Include="OSPSuite.Infrastructure.Reporting" Version="12.0.199" />
<PackageReference Include="OSPSuite.Infrastructure.Serialization" Version="12.0.199" />
<PackageReference Include="OSPSuite.Presentation.Serialization" Version="12.0.199" />
<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.198" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.199" />
<PackageReference Include="OSPSuite.Utility" Version="4.0.0.4" />
<PackageReference Include="OSPSuite.Core" Version="12.0.198" />
<PackageReference Include="OSPSuite.Core" Version="12.0.199" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ namespace PKSim.Presentation.DTO.Individuals
public class ShowOntogenyDataDTO
{
public Ontogeny SelectedOntogeny { get; set; }
public IGroup SelectedContainer { get; set; }
public IGroup SelectedGroup { get; set; }
}
}
6 changes: 3 additions & 3 deletions src/PKSim.Presentation/PKSim.Presentation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OSPSuite.Assets" Version="12.0.198" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.199" />
<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.198" />
<PackageReference Include="OSPSuite.Core" Version="12.0.198" />
<PackageReference Include="OSPSuite.Presentation" Version="12.0.199" />
<PackageReference Include="OSPSuite.Core" Version="12.0.199" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Linq;
using OSPSuite.Core.Chart;
using OSPSuite.Core.Domain;
using OSPSuite.Core.Domain.Data;
using OSPSuite.Presentation.Presenters;
using OSPSuite.Presentation.Presenters.Charts;
using PKSim.Assets;
Expand All @@ -15,10 +16,10 @@ namespace PKSim.Presentation.Presenters.Individuals
public interface IShowOntogenyDataPresenter : IDisposablePresenter
{
void Show(Ontogeny ontogeny);
IEnumerable<IGroup> AllContainers();
IEnumerable<IGroup> AllGroups();
IEnumerable<Ontogeny> AllOntogenies();
void OntogenyChanged();
void ContainerChanged();
void GroupChanged();
string GroupDescriptionFor(int index);
}

Expand All @@ -39,10 +40,12 @@ public ShowOntogenyDataPresenter(
{
_ontogenyRepository = ontogenyRepository;
_simpleChartPresenter = simpleChartPresenter;
_simpleChartPresenter.PreExportHook = orderOntogenyColumns;
_groupRepository = groupRepository;
_view.AddChart(_simpleChartPresenter.View);
}


public void Show(Ontogeny ontogeny)
{
_speciesName = ontogeny.SpeciesName;
Expand All @@ -54,7 +57,7 @@ public void Show(Ontogeny ontogeny)
_view.Display();
}

public IEnumerable<IGroup> AllContainers()
public IEnumerable<IGroup> AllGroups()
{
return _ontogenyRepository.AllValuesFor(_dto.SelectedOntogeny)
.Select(x => _groupRepository.GroupByName(x.GroupName)).Distinct();
Expand All @@ -72,20 +75,20 @@ public void OntogenyChanged()
updateChart();
}

public void ContainerChanged()
public void GroupChanged()
{
updateChart();
}

public string GroupDescriptionFor(int index)
{
var allContainers = AllContainers().ToList();
return index < allContainers.Count ? allContainers[index].Description : string.Empty;
var allGroups = AllGroups().ToList();
return index < allGroups.Count ? allGroups[index].Description : string.Empty;
}

private void updateChart()
{
var data = _ontogenyRepository.OntogenyToRepository(_dto.SelectedOntogeny, _dto.SelectedContainer.Name);
var data = _ontogenyRepository.OntogenyToRepository(_dto.SelectedOntogeny, _dto.SelectedGroup.Name);
var chart = _simpleChartPresenter.Plot(data, Scalings.Linear);
chart.AxisBy(AxisTypes.X).Caption = PKSimConstants.UI.PostMenstrualAge;
chart.AxisBy(AxisTypes.X).GridLines = true;
Expand All @@ -94,9 +97,17 @@ private void updateChart()
_simpleChartPresenter.Refresh();
}


private IEnumerable<DataColumn> orderOntogenyColumns(IEnumerable<DataColumn> dataColumns)
{
//we need to inverse the order of columns so that standard deviation is last and ontogeny is first
//this is the other way by constructions as the main curve is in fact the deviation and the related column is the mean
return dataColumns.Reverse();
}

private void updateAvailableContainerForOntogeny()
{
_dto.SelectedContainer = AllContainers().FirstOrDefault();
_dto.SelectedGroup = AllGroups().FirstOrDefault();
}
}
}
4 changes: 2 additions & 2 deletions src/PKSim.Presentation/Services/OntogenyTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ private IReadOnlyList<ColumnInfo> getColumnInfos()
var geoMean = new ColumnInfo
{
DefaultDimension = _dimensionRepository.NoDimension,
Name = PKSimConstants.UI.StandardDeviation,
DisplayName = PKSimConstants.UI.StandardDeviation,
Name = PKSimConstants.UI.GeometricStandardDeviation,
DisplayName = PKSimConstants.UI.GeometricStandardDeviation,
IsMandatory = false,
BaseGridName = ageColumn.Name,
RelatedColumnOf = ontogenyFactor.Name
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.198" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.199" />
<PackageReference Include="OSPSuite.Utility" Version="4.0.0.4" />
<PackageReference Include="OSPSuite.Core" Version="12.0.198" />
<PackageReference Include="OSPSuite.Core" Version="12.0.199" />
<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.Starter/PKSim.UI.Starter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OSPSuite.Presentation" Version="12.0.198" />
<PackageReference Include="OSPSuite.UI" Version="12.0.198" />
<PackageReference Include="OSPSuite.Core" Version="12.0.198" />
<PackageReference Include="OSPSuite.Infrastructure" Version="12.0.198" />
<PackageReference Include="OSPSuite.Presentation" Version="12.0.199" />
<PackageReference Include="OSPSuite.UI" Version="12.0.199" />
<PackageReference Include="OSPSuite.Core" Version="12.0.199" />
<PackageReference Include="OSPSuite.Infrastructure" Version="12.0.199" />
</ItemGroup>

</Project>
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.198" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.199" />
<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.198" />
<PackageReference Include="OSPSuite.UI" Version="12.0.198" />
<PackageReference Include="OSPSuite.Core" Version="12.0.198" />
<PackageReference Include="OSPSuite.Presentation" Version="12.0.199" />
<PackageReference Include="OSPSuite.UI" Version="12.0.199" />
<PackageReference Include="OSPSuite.Core" Version="12.0.199" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/PKSim.UI/Views/Individuals/ShowOntogenyDataView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ public override void InitializeBinding()
.AndDisplays(o => o.DisplayName)
.Changed += () => OnEvent(_presenter.OntogenyChanged);

_screenBinder.Bind(x => x.SelectedContainer)
_screenBinder.Bind(x => x.SelectedGroup)
.To(listBoxContainer)
.WithValues(dto => _presenter.AllContainers())
.WithValues(dto => _presenter.AllGroups())
.AndDisplays(x => x.DisplayName)
.Changed += () => OnEvent(_presenter.ContainerChanged);
.Changed += () => OnEvent(_presenter.GroupChanged);
}

public void BindTo(ShowOntogenyDataDTO showOntogenyDataDTO)
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.198" />
<PackageReference Include="OSPSuite.Core" Version="12.0.198" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.199" />
<PackageReference Include="OSPSuite.Core" Version="12.0.199" />
<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.198" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.Presentation" Version="12.0.199" 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.198" />
<PackageReference Include="OSPSuite.Assets" Version="12.0.199" />
<PackageReference Include="OSPSuite.BDDHelper" Version="4.0.0.1" />
<PackageReference Include="OSPSuite.Core" Version="12.0.198" />
<PackageReference Include="OSPSuite.Core" Version="12.0.199" />
<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 31ddbc8

Please sign in to comment.