Exemplo n.º 1
0
 public ProtocolChartPresenter(IProtocolChartView view,
                               IProtocolToSchemaItemsMapper schemaItemsMapper,
                               ISchemaItemToSchemaItemDTOMapper schemaItemDTOMapper,
                               IDimensionRepository dimensionRepository) : base(view)
 {
     _schemaItemsMapper   = schemaItemsMapper;
     _schemaItemDTOMapper = schemaItemDTOMapper;
     _dimensionRepository = dimensionRepository;
 }
Exemplo n.º 2
0
        protected override void Context()
        {
            _simulation = new IndividualSimulation
            {
                Properties         = new SimulationProperties(),
                SimulationSettings = new SimulationSettings(),
                ModelConfiguration = new ModelConfiguration()
            };
            _individual        = new Individual().WithName("MyIndividual");
            _speciesPopulation = new SpeciesPopulation();

            _individual.OriginData = new OriginData {
                SpeciesPopulation = _speciesPopulation
            };
            _compound    = A.Fake <Compound>().WithName("MyCompound");
            _protocol    = A.Fake <SimpleProtocol>().WithName("MyProtocol");
            _formulation = A.Fake <Formulation>().WithName("Formulation");

            _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("Individual", PKSimBuildingBlockType.Individual)
            {
                BuildingBlock = _individual
            });
            _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("Compound", PKSimBuildingBlockType.Compound)
            {
                BuildingBlock = _compound
            });
            _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("Protocol", PKSimBuildingBlockType.Protocol)
            {
                BuildingBlock = _protocol
            });
            _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("Formulation", PKSimBuildingBlockType.Formulation)
            {
                BuildingBlock = _formulation
            });

            _protocolToProtocolSchemaItemMapper = A.Fake <IProtocolToSchemaItemsMapper>();
            sut = new SimulationConfigurationValidator(_protocolToProtocolSchemaItemMapper);

            _speciesPopulation.IsHeightDependent = false;
            _schemaItem = A.Fake <SchemaItem>();
            _doseUnit   = A.Fake <Unit>();
            _schemaItem.Dose.DisplayUnit = _doseUnit;

            _protocolProperties = new ProtocolProperties();
            _formulationMapping = new FormulationMapping {
                FormulationKey = "F1", Formulation = _formulation
            };
            _simulation.Properties.AddCompoundProperties(new CompoundProperties
            {
                Compound           = _compound,
                ProtocolProperties = _protocolProperties
            });
            A.CallTo(() => _protocolToProtocolSchemaItemMapper.MapFrom(_protocol)).Returns(new [] { _schemaItem });
        }
Exemplo n.º 3
0
 public ProtocolChartPresenter(
     IProtocolChartView view,
     IProtocolToSchemaItemsMapper schemaItemsMapper,
     ISchemaItemToSchemaItemDTOMapper schemaItemDTOMapper,
     IDimensionRepository dimensionRepository,
     IApplicationSettings applicationSettings) : base(view)
 {
     _schemaItemsMapper   = schemaItemsMapper;
     _schemaItemDTOMapper = schemaItemDTOMapper;
     _dimensionRepository = dimensionRepository;
     _applicationSettings = applicationSettings;
 }
Exemplo n.º 4
0
 public GlobalPKAnalysisTask(IParameterFactory parameterFactory, IProtocolToSchemaItemsMapper protocolToSchemaItemsMapper,
                             IProtocolFactory protocolFactory, IGlobalPKAnalysisRunner globalPKAnalysisRunner, IPKAnalysisTask pkAnalysisTask,
                             IPKCalculationOptionsFactory pkCalculationOptionsFactory, IVSSCalculator vssCalculator, IInteractionTask interactionTask, ICloner cloner)
 {
     _parameterFactory            = parameterFactory;
     _protocolToSchemaItemsMapper = protocolToSchemaItemsMapper;
     _protocolFactory             = protocolFactory;
     _globalPKAnalysisRunner      = globalPKAnalysisRunner;
     _pkAnalysisTask = pkAnalysisTask;
     _pkCalculationOptionsFactory = pkCalculationOptionsFactory;
     _vssCalculator   = vssCalculator;
     _interactionTask = interactionTask;
     _cloner          = cloner;
 }
Exemplo n.º 5
0
 public EventBuildingBlockCreator(IObjectBaseFactory objectBaseFactory,
                                  IProtocolToSchemaItemsMapper schemaItemsMapper,
                                  IApplicationFactory applicationFactory,
                                  IFormulationFromMappingRetriever formulationFromMappingRetriever,
                                  ICloneManagerForBuildingBlock cloneManagerForBuildingBlock,
                                  IParameterIdUpdater parameterIdUpdater,
                                  IParameterSetUpdater parameterSetUpdater,
                                  IEventGroupRepository eventGroupRepository)
 {
     _objectBaseFactory  = objectBaseFactory;
     _schemaItemsMapper  = schemaItemsMapper;
     _applicationFactory = applicationFactory;
     _formulationFromMappingRetriever = formulationFromMappingRetriever;
     _cloneManagerForBuildingBlock    = cloneManagerForBuildingBlock;
     _parameterIdUpdater   = parameterIdUpdater;
     _parameterSetUpdater  = parameterSetUpdater;
     _eventGroupRepository = eventGroupRepository;
 }
Exemplo n.º 6
0
        protected override void Context()
        {
            _vssCalculator               = A.Fake <IVSSCalculator>();
            _parameterFactory            = A.Fake <IParameterFactory>();
            _protocolMapper              = A.Fake <IProtocolToSchemaItemsMapper>();
            _protocolFactory             = A.Fake <IProtocolFactory>();
            _globalPKAnalysisRunner      = A.Fake <IGlobalPKAnalysisRunner>();
            _pkCalculationOptionsFactory = A.Fake <IPKCalculationOptionsFactory>();
            _pkAnalysisTask              = A.Fake <IPKAnalysesTask>();
            _interactionTask             = A.Fake <IInteractionTask>();
            _cloner = A.Fake <ICloner>();
            sut     = new GlobalPKAnalysisTask(_parameterFactory, _protocolMapper, _protocolFactory, _globalPKAnalysisRunner,
                                               _pkAnalysisTask, _pkCalculationOptionsFactory, _vssCalculator, _interactionTask, _cloner);

            var baseGrid = new BaseGrid("time", A.Fake <IDimension>());

            _peripheralVenousBloodPlasma = CalculationColumnFor(baseGrid, CoreConstants.Organ.PeripheralVenousBlood, CoreConstants.Observer.PLASMA_PERIPHERAL_VENOUS_BLOOD, CoreConstants.Observer.PLASMA_PERIPHERAL_VENOUS_BLOOD, _compoundName);
            _venousBloodPlasma           = CalculationColumnFor(baseGrid, CoreConstants.Organ.VenousBlood, CoreConstants.Compartment.Plasma, CoreConstants.Observer.CONCENTRATION_IN_CONTAINER, _compoundName);

            _individual = A.Fake <Individual>();
            _species    = new Species();
            A.CallTo(() => _individual.Species).Returns(_species);

            _compound           = new Compound().WithName(_compoundName);
            _compoundProperties = new CompoundProperties {
                Compound = _compound
            };
            _simulationSchemaItems = new List <SchemaItem>();
            _protocol = new SimpleProtocol();
            _compoundProperties.ProtocolProperties.Protocol = _protocol;
            A.CallTo(() => _protocolMapper.MapFrom(_protocol)).Returns(_simulationSchemaItems);

            _simulation = new IndividualSimulation {
                Properties = new SimulationProperties()
            };

            _simulation.Properties.AddCompoundProperties(_compoundProperties);
            _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("CompId", PKSimBuildingBlockType.Compound)
            {
                BuildingBlock = _compound
            });
            _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("IndividualId", PKSimBuildingBlockType.Individual)
            {
                BuildingBlock = _individual
            });
            _simulation.DataRepository = new DataRepository {
                _venousBloodPlasma, _peripheralVenousBloodPlasma
            };

            _venousBloodPK = new PKValues();
            _venousBloodPK.AddValue(Constants.PKParameters.Vss, 10);
            _venousBloodPK.AddValue(Constants.PKParameters.Vd, 11);
            _venousBloodPK.AddValue(Constants.PKParameters.CL, 12);

            _venousBloodPK.AddValue(Constants.PKParameters.AUC_inf, 13);
            _venousBloodPK.AddValue(Constants.PKParameters.AUC_inf_tD1_norm, 14);

            _peripheralVenousBloodPK = new PKValues();
            _peripheralVenousBloodPK.AddValue(Constants.PKParameters.Vss, 21);
            _peripheralVenousBloodPK.AddValue(Constants.PKParameters.Vd, 22);
            _peripheralVenousBloodPK.AddValue(Constants.PKParameters.CL, 23);
            _peripheralVenousBloodPK.AddValue(Constants.PKParameters.AUC_inf, 24);
            _peripheralVenousBloodPK.AddValue(Constants.PKParameters.AUC_inf_tD1_norm, 25);
            _peripheralVenousBloodPK.AddValue(Constants.PKParameters.C_max, 26);
            _peripheralVenousBloodPK.AddValue(Constants.PKParameters.C_max_tDLast_tDEnd, 27);


            A.CallTo(() => _pkAnalysisTask.CalculatePK(_venousBloodPlasma, A <PKCalculationOptions> ._)).Returns(_venousBloodPK);
            A.CallTo(() => _pkAnalysisTask.CalculatePK(_peripheralVenousBloodPlasma, A <PKCalculationOptions> ._)).Returns(_peripheralVenousBloodPK);
            A.CallTo(() => _parameterFactory.CreateFor(A <string> ._, A <double> ._, A <string> ._, PKSimBuildingBlockType.Simulation))
            .ReturnsLazily(s => new PKSimParameter().WithName((string)s.Arguments[0])
                           .WithDimension(A.Fake <IDimension>())
                           .WithFormula(new ConstantFormula((double)s.Arguments[1])));
        }
Exemplo n.º 7
0
 public SimulationConfigurationValidator(IProtocolToSchemaItemsMapper schemaItemsMapper)
 {
     _schemaItemsMapper = schemaItemsMapper;
 }
        protected override void Context()
        {
            _vssCalculator               = A.Fake <IVSSCalculator>();
            _parameterFactory            = A.Fake <IParameterFactory>();
            _protocolMapper              = A.Fake <IProtocolToSchemaItemsMapper>();
            _protocolFactory             = A.Fake <IProtocolFactory>();
            _globalPKAnalysisRunner      = A.Fake <IGlobalPKAnalysisRunner>();
            _pkCalculationOptionsFactory = A.Fake <IPKCalculationOptionsFactory>();
            _pkAnalysisTask              = A.Fake <IPKAnalysesTask>();
            _interactionTask             = A.Fake <IInteractionTask>();
            _cloner = A.Fake <ICloner>();
            sut     = new GlobalPKAnalysisTask(_parameterFactory, _protocolMapper, _protocolFactory, _globalPKAnalysisRunner,
                                               _pkAnalysisTask, _pkCalculationOptionsFactory, _vssCalculator, _interactionTask, _cloner);

            var baseGrid = new BaseGrid("time", A.Fake <IDimension>());

            _peripheralVenousBloodPlasma = CalculationColumnFor(baseGrid, CoreConstants.Organ.PERIPHERAL_VENOUS_BLOOD, CoreConstants.Observer.PLASMA_PERIPHERAL_VENOUS_BLOOD, CoreConstants.Observer.PLASMA_PERIPHERAL_VENOUS_BLOOD, _compoundName);
            _venousBloodPlasma           = CalculationColumnFor(baseGrid, CoreConstants.Organ.VENOUS_BLOOD, CoreConstants.Compartment.PLASMA, CoreConstants.Observer.CONCENTRATION_IN_CONTAINER, _compoundName);

            _individual = A.Fake <Individual>();
            _species    = new Species();
            A.CallTo(() => _individual.Species).Returns(_species);

            _compound           = new Compound().WithName(_compoundName);
            _compoundProperties = new CompoundProperties {
                Compound = _compound
            };
            _protocol = new SimpleProtocol();
            _compoundProperties.ProtocolProperties.Protocol = _protocol;

            _simulation = new IndividualSimulation {
                Properties = new SimulationProperties()
            };

            _simulation.Properties.AddCompoundProperties(_compoundProperties);
            _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("CompId", PKSimBuildingBlockType.Compound)
            {
                BuildingBlock = _compound
            });
            _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("IndividualId", PKSimBuildingBlockType.Individual)
            {
                BuildingBlock = _individual
            });
            _simulation.DataRepository = new DataRepository {
                _venousBloodPlasma, _peripheralVenousBloodPlasma
            };
            _simulation.SimulationSettings = new SimulationSettings();
            _simulation.OutputSchema       = new OutputSchema();
            _simulation.OutputSchema.AddInterval(new OutputInterval {
                DomainHelperForSpecs.ConstantParameterWithValue(100).WithName(Constants.Parameters.END_TIME)
            });
            _simulation.Model = new OSPSuite.Core.Domain.Model {
                Root = new Container()
            };
            _eventGroup   = new EventGroup();
            _application1 = new Container().WithName("App1").WithContainerType(ContainerType.Application);
            _application1.Add(new MoleculeAmount().WithName(_compoundName));
            _application1.Add(DomainHelperForSpecs.ConstantParameterWithValue(10).WithName(Constants.Parameters.START_TIME));
            _application2 = new Container().WithName("App2").WithContainerType(ContainerType.Application);
            _application2.Add(DomainHelperForSpecs.ConstantParameterWithValue(10).WithName(Constants.Parameters.START_TIME));
            _application2.Add(new MoleculeAmount().WithName(_compoundName));
            _simulation.Model.Root.Add(_eventGroup);
            _eventGroup.Add(_application1);
            _venousBloodPK = new PKValues();
            _venousBloodPK.AddValue(Constants.PKParameters.Vss, 10);
            _venousBloodPK.AddValue(Constants.PKParameters.Vd, 11);
            _venousBloodPK.AddValue(Constants.PKParameters.CL, 12);

            _venousBloodPK.AddValue(Constants.PKParameters.AUC_inf, 13);
            _venousBloodPK.AddValue(Constants.PKParameters.AUC_inf_tD1_norm, 14);

            _peripheralVenousBloodPK = new PKValues();
            _peripheralVenousBloodPK.AddValue(Constants.PKParameters.Vss, 21);
            _peripheralVenousBloodPK.AddValue(Constants.PKParameters.Vd, 22);
            _peripheralVenousBloodPK.AddValue(Constants.PKParameters.CL, 23);
            _peripheralVenousBloodPK.AddValue(Constants.PKParameters.AUC_inf, 24);
            _peripheralVenousBloodPK.AddValue(Constants.PKParameters.AUC_inf_tD1_norm, 25);
            _peripheralVenousBloodPK.AddValue(Constants.PKParameters.C_max, 26);
            _peripheralVenousBloodPK.AddValue(Constants.PKParameters.C_max_tDLast_tDEnd, 27);


            A.CallTo(() => _pkAnalysisTask.CalculatePK(_venousBloodPlasma, A <PKCalculationOptions> ._)).Returns(_venousBloodPK);
            A.CallTo(() => _pkAnalysisTask.CalculatePK(_peripheralVenousBloodPlasma, A <PKCalculationOptions> ._)).Returns(_peripheralVenousBloodPK);
            A.CallTo(() => _parameterFactory.CreateFor(A <string> ._, A <double> ._, A <string> ._, PKSimBuildingBlockType.Simulation))
            .ReturnsLazily(s => new PKSimParameter().WithName((string)s.Arguments[0])
                           .WithDimension(A.Fake <IDimension>())
                           .WithFormula(new ConstantFormula((double)s.Arguments[1])));
        }