Skip to content

Commit

Permalink
440 support mobi dimensions (#1397)
Browse files Browse the repository at this point in the history
* Fixes update to new core

* Fixes #440 support mobi dimensions

* COnvert some reporting project to 7.4.0:

* Update project to pass tests

* Update project to pass tests

* Fixes #1398 It should not be possible to use a TableFormulation without any point

* Add missing converter 6.0.1 to 6.0.2:

* Add missing converter 6.0.1 to 6.0.2:

* Update to latest core to fix nuget issue
  • Loading branch information
msevestre committed Jan 31, 2020
1 parent 8912b75 commit 843ebe7
Show file tree
Hide file tree
Showing 125 changed files with 5,122 additions and 10,040 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="9.0.53" />
<PackageReference Include="OSPSuite.Assets.Images" Version="9.0.53" />
<PackageReference Include="OSPSuite.Assets" Version="9.0.70" />
<PackageReference Include="OSPSuite.Assets.Images" Version="9.0.70" />
</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="9.0.53" />
<PackageReference Include="OSPSuite.Assets.Images" Version="9.0.53" />
<PackageReference Include="OSPSuite.Assets" Version="9.0.70" />
<PackageReference Include="OSPSuite.Assets.Images" Version="9.0.70" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/PKSim.Assets/PKSimConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,8 @@ public static class Error

public static string NotMappingDefinedForQualificationStep(string qualificationStepType) => $"No mapping defined for {ObjectTypes.QualificationStep.ToLower()} '{qualificationStepType}'";

public static string TableFormulationRequiresAtLeastOnePoint(string formulation) => $"Table formulation '{formulation}' requires at least one point to be used in a simulation.";

public static string CouldNotFindSimulation(string simulationName) => CouldNotFind(OSPSuite.Assets.ObjectTypes.Simulation, simulationName);

public static string SimulationResultsFileDoesNotHaveTheExpectedFormat
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 @@ -63,10 +63,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OSPSuite.Core" Version="9.0.53" />
<PackageReference Include="OSPSuite.Core" Version="9.0.70" />
<PackageReference Include="OSPSuite.DevExpress" Version="19.2.4.1" />
<PackageReference Include="OSPSuite.FuncParser" Version="4.0.0.44" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModel" Version="4.0.0.32" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModel" Version="4.0.0.33" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModelSolver_CVODES" Version="4.1.0.7" GeneratePathProperty="true" />
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.112" GeneratePathProperty="true" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public bool Validate(IObjectBase objectToValidate)
if (validationResult.ValidationState == ValidationState.Valid)
return true;

var error = Error.EntityIsInvalid(this._executionContext.TypeFor<IObjectBase>(objectToValidate), objectToValidate.Name);
var error = Error.EntityIsInvalid(_executionContext.TypeFor(objectToValidate), objectToValidate.Name);
_logger.AddError(error);
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/PKSim.CLI.Core/PKSim.CLI.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<ItemGroup>
<PackageReference Include="OSPSuite.Utility" Version="4.0.0.4" />
<PackageReference Include="OSPSuite.Core" Version="9.0.53" />
<PackageReference Include="OSPSuite.Core" Version="9.0.70" />
</ItemGroup>

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

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.6.0" />
<PackageReference Include="CommandLineParser" Version="2.7.82" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.2.0" />
<PackageReference Include="OSPSuite.Core" Version="9.0.53" />
<PackageReference Include="OSPSuite.Presentation" Version="9.0.53" />
<PackageReference Include="OSPSuite.Core" Version="9.0.70" />
<PackageReference Include="OSPSuite.Presentation" Version="9.0.70" />
<PackageReference Include="OSPSuite.Utility" Version="4.0.0.4" />
<PackageReference Include="OSPSuite.FuncParser" Version="4.0.0.44" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModel" Version="4.0.0.32" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModel" Version="4.0.0.33" GeneratePathProperty="true" />
<PackageReference Include="OSPSuite.SimModelSolver_CVODES" Version="4.1.0.7" GeneratePathProperty="true" />
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.112" GeneratePathProperty="true" />

Expand Down
10 changes: 5 additions & 5 deletions src/PKSim.Core/PKSim.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="OSPSuite.Utility" Version="4.0.0.4" />
<PackageReference Include="OSPSuite.Core" Version="9.0.53" />
<PackageReference Include="OSPSuite.Assets" Version="9.0.53" />
<PackageReference Include="OSPSuite.Assets.Images" Version="9.0.53" />
<PackageReference Include="OSPSuite.Infrastructure.Import" Version="9.0.53" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.6.0" />
<PackageReference Include="OSPSuite.Core" Version="9.0.70" />
<PackageReference Include="OSPSuite.Assets" Version="9.0.70" />
<PackageReference Include="OSPSuite.Assets.Images" Version="9.0.70" />
<PackageReference Include="OSPSuite.Infrastructure.Import" Version="9.0.70" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
</ItemGroup>

<ItemGroup>
Expand Down
14 changes: 1 addition & 13 deletions src/PKSim.Core/ProjectVersions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,7 @@ public static class ProjectVersions
{
private static readonly Cache<int, ProjectVersion> _knownVersions = new Cache<int, ProjectVersion>(x => x.Version, x => null);

public static readonly ProjectVersion V5_0_1 = addVersion(20, "5.0.1");
public static readonly ProjectVersion V5_1_3 = addVersion(21, "5.1.3");
public static readonly ProjectVersion V5_1_4 = addVersion(22, "5.1.4");
public static readonly ProjectVersion V5_1_5 = addVersion(51, "5.1.5");
public static readonly ProjectVersion V5_2_1 = addVersion(53, "5.2.1");
public static readonly ProjectVersion V5_2_2 = addVersion(55, "5.2.2");
public static readonly ProjectVersion V5_3_1 = addVersion(57, "5.3.1");
public static readonly ProjectVersion V5_3_2 = addVersion(58, "5.3.2");
public static readonly ProjectVersion V5_4_1 = addVersion(59, "5.4.1");
public static readonly ProjectVersion V5_5_1 = addVersion(60, "5.5.1");
public static readonly ProjectVersion V5_5_2 = addVersion(61, "5.5.2");
public static readonly ProjectVersion V5_6_1 = addVersion(62, "5.6.1");
public static readonly ProjectVersion V5_6_2 = addVersion(63, "5.6.2");
public const int UNSUPPORTED = 63;
public static readonly ProjectVersion V6_0_1 = addVersion(64, "6.0.1");
public static readonly ProjectVersion V6_0_2 = addVersion(65, "6.0.2");
public static readonly ProjectVersion V6_1_2 = addVersion(66, "6.1.2");
Expand Down
16 changes: 16 additions & 0 deletions src/PKSim.Core/Services/SimulationConfigurationValidator.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using OSPSuite.Core.Domain;
using OSPSuite.Core.Domain.Formulas;
using OSPSuite.Utility.Extensions;
using PKSim.Assets;
using PKSim.Core.Mappers;
Expand Down Expand Up @@ -32,6 +33,7 @@ public void ValidateConfigurationFor(Simulation simulation)
var compounds = simulation.Compounds;
var simulationSubject = simulation.BuildingBlock<ISimulationSubject>();
var protocols = simulation.Protocols;
var formulations = simulation.AllBuildingBlocks<Formulation>();
var modelConfiguration = simulation.ModelConfiguration;

//ForComp model can only be used with small molecules
Expand Down Expand Up @@ -64,6 +66,20 @@ public void ValidateConfigurationFor(Simulation simulation)
});

administeredCompoundWithSuperSaturationEnabled.Each(x => validateSupersaturationUsageFor(x.Compound, x.Protocol, x.FormulationMappings));

formulations.Where(x=>x.FormulationType==CoreConstants.Formulation.TABLE).Each(validateTableFormulation);
}

private void validateTableFormulation(Formulation tableFormulation)
{
var formulaParameter = tableFormulation.Parameter(CoreConstants.Parameters.FRACTION_DOSE);
var tableFormula = formulaParameter?.Formula as TableFormula;

//at least one point in this formulation
if(tableFormula!=null && tableFormula.AllPoints().Any())
return;

throw new InvalidSimulationConfigurationException(PKSimConstants.Error.TableFormulationRequiresAtLeastOnePoint(tableFormulation.Name));
}

private void validateSupersaturationUsageFor(Compound compound, Protocol protocol, IReadOnlyList<FormulationMapping> formulationMappings)
Expand Down
2 changes: 1 addition & 1 deletion src/PKSim.Core/Services/SimulationModelCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void CreateModelFor(Simulation simulation, bool shouldValidate = true, bo
private void updateSimulationAfterModelCreation(Simulation simulation)
{
//last step. Once the model has been created, it is necessary to set the id of the simulation
//in all paramater defined in the model
//in all parameter defined in the model
_parameterIdUpdater.UpdateSimulationId(simulation);

var allMoleculeAmounts = simulation.All<IMoleculeAmount>().ToList();
Expand Down
12 changes: 6 additions & 6 deletions src/PKSim.Core/Services/SimulationPKParametersImportTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace PKSim.Core.Services
{
public interface ISimulationPKParametersImportTask
{
Task<SimulationPKParametersImport> ImportPKParameters(PopulationSimulation populationSimulation, string filefullPath, CancellationToken cancellationToken);
Task<SimulationPKParametersImport> ImportPKParameters(PopulationSimulation populationSimulation, string fileFullPath, CancellationToken cancellationToken);
}

public class SimulationPKParametersImportTask : ISimulationPKParametersImportTask
Expand All @@ -23,9 +23,9 @@ public SimulationPKParametersImportTask(ISimulationPKAnalysesImporter pkAnalyses
_quantityRetriever = quantityRetriever;
}

public async Task<SimulationPKParametersImport> ImportPKParameters(PopulationSimulation populationSimulation, string filefullPath, CancellationToken cancellationToken)
public async Task<SimulationPKParametersImport> ImportPKParameters(PopulationSimulation populationSimulation, string fileFullPath, CancellationToken cancellationToken)
{
var importedPKAnalysis = await importPKAnalysesFromFile(filefullPath, cancellationToken);
var importedPKAnalysis = await importPKAnalysesFromFile(fileFullPath, cancellationToken);
validateConsistencyWithSimulation(populationSimulation, importedPKAnalysis);
addImportedPKToLogForSuccessfulImport(importedPKAnalysis);
return importedPKAnalysis;
Expand Down Expand Up @@ -82,12 +82,12 @@ private void validateLength(PopulationSimulation populationSimulation, QuantityP
importedPKParameter.AddError(PKSimConstants.Error.NotEnoughPKValuesForParameter(pkParameter.Name, pkParameter.QuantityPath, populationSimulation.NumberOfItems, pkParameter.Count));
}

private Task<SimulationPKParametersImport> importPKAnalysesFromFile(string filefullPath, CancellationToken cancellationToken)
private Task<SimulationPKParametersImport> importPKAnalysesFromFile(string fileFullPath, CancellationToken cancellationToken)
{
return Task.Run(() =>
{
var pKAnalysesFile = new PKAnalysesImportFile { FilePath = filefullPath };
var pkAnalyses = _pkAnalysesImporter.ImportPKParameters(filefullPath, pKAnalysesFile);
var pKAnalysesFile = new PKAnalysesImportFile { FilePath = fileFullPath };
var pkAnalyses = _pkAnalysesImporter.ImportPKParameters(fileFullPath, pKAnalysesFile);
return new SimulationPKParametersImport(pkAnalyses, pKAnalysesFile);
}, cancellationToken);
}
Expand Down
3 changes: 0 additions & 3 deletions src/PKSim.Infrastructure/InfrastructureRegister.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
using PKSim.Infrastructure.ORM.Mappers;
using PKSim.Infrastructure.ORM.Repositories;
using PKSim.Infrastructure.ProjectConverter;
using PKSim.Infrastructure.ProjectConverter.v5_3;
using PKSim.Infrastructure.ProjectConverter.v6_2;
using PKSim.Infrastructure.Reporting.Markdown;
using PKSim.Infrastructure.Reporting.Markdown.Builders;
Expand Down Expand Up @@ -307,13 +306,11 @@ private static void registerConverters(IContainer container)
scan.IncludeNamespaceContainingType<IObjectConverter>();
scan.ExcludeType<ProjectConverterLogger>();
scan.ExcludeType<ObjectConverterFinder>();
scan.ExcludeType<Converter52To531>();
scan.ExcludeType<Converter612To621>();
scan.WithConvention<PKSimRegistrationConvention>();
});

//required as singleton because of element caching
container.Register<Converter52To531, IObjectConverter, Converter52To531>(LifeStyle.Singleton);
container.Register<Converter612To621, IObjectConverter, Converter612To621>(LifeStyle.Singleton);
container.Register<IObjectConverterFinder, ObjectConverterFinder>(LifeStyle.Singleton);
container.Register<IProjectConverterLogger, ProjectConverterLogger>(LifeStyle.Singleton);
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 @@ -38,15 +38,15 @@
<PackageReference Include="LumenWorksCsvReader" Version="4.0.0" />
<PackageReference Include="MarkdownLog.NS20" Version="0.10.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" />
<PackageReference Include="Newtonsoft.Json.Schema" Version="3.0.11" />
<PackageReference Include="OSPSuite.Core" Version="9.0.53" />
<PackageReference Include="OSPSuite.Infrastructure" Version="9.0.53" />
<PackageReference Include="OSPSuite.Infrastructure.Castle" Version="9.0.53" />
<PackageReference Include="OSPSuite.Infrastructure.Export" Version="9.0.53" />
<PackageReference Include="OSPSuite.Infrastructure.Import" Version="9.0.53" />
<PackageReference Include="OSPSuite.Infrastructure.Reporting" Version="9.0.53" />
<PackageReference Include="OSPSuite.Infrastructure.Serialization" Version="9.0.53" />
<PackageReference Include="OSPSuite.Presentation.Serialization" Version="9.0.53" />
<PackageReference Include="Newtonsoft.Json.Schema" Version="3.0.13" />
<PackageReference Include="OSPSuite.Core" Version="9.0.70" />
<PackageReference Include="OSPSuite.Infrastructure" Version="9.0.70" />
<PackageReference Include="OSPSuite.Infrastructure.Castle" Version="9.0.70" />
<PackageReference Include="OSPSuite.Infrastructure.Export" Version="9.0.70" />
<PackageReference Include="OSPSuite.Infrastructure.Import" Version="9.0.70" />
<PackageReference Include="OSPSuite.Infrastructure.Reporting" Version="9.0.70" />
<PackageReference Include="OSPSuite.Infrastructure.Serialization" Version="9.0.70" />
<PackageReference Include="OSPSuite.Presentation.Serialization" Version="9.0.70" />
<PackageReference Include="OSPSuite.Utility" Version="4.0.0.4" />
</ItemGroup>

Expand Down
Loading

0 comments on commit 843ebe7

Please sign in to comment.