protected override void FillUpReport(RandomPopulationSettings populationSettings, ReportPart reportPart)
        {
            var baseOnIndividualPart = new ReportPart().WithTitle(PKSimConstants.UI.BasedOnIndividual);

            baseOnIndividualPart.AddToContent(populationSettings.BaseIndividual.Name);

            var numberOfIndividualPart = new ReportPart().WithTitle(PKSimConstants.UI.NumberOfIndividuals);

            numberOfIndividualPart.AddToContent(populationSettings.NumberOfIndividuals.ToString(CultureInfo.InvariantCulture));

            var genderRatioPart = new ReportPart().WithTitle(PKSimConstants.UI.GenderRatio);

            foreach (var genderRatio in populationSettings.GenderRatios)
            {
                genderRatioPart.AddToContent(_reportGenerator.ReportFor(genderRatio).Content);
            }

            var parameterRangePart = new ReportPart().WithTitle(PKSimConstants.UI.PopulationParameterRanges);

            foreach (var parameterRange in populationSettings.ParameterRanges)
            {
                parameterRangePart.AddToContent(_reportGenerator.ReportFor(parameterRange).Content);
            }

            reportPart.AddPart(baseOnIndividualPart);
            reportPart.AddPart(numberOfIndividualPart);
            reportPart.AddPart(genderRatioPart);
            reportPart.AddPart(parameterRangePart);
        }
Exemplo n.º 2
0
        public ReportPart BuildDifferenceBetween(Simulation sourceSimulation, Simulation targetSimulation)
        {
            //compare building blocks
            var reportPart   = new ReportPart();
            var sourceReport = BuildFor(sourceSimulation).ToStringReport().Split('\n').ToList();
            var targetReport = BuildFor(targetSimulation).ToStringReport().Split('\n').ToList();

            var tempSourceReport = new List <string>(sourceReport);

            foreach (var line in tempSourceReport)
            {
                if (!targetReport.Contains(line))
                {
                    continue;
                }

                targetReport.Remove(line);
                sourceReport.Remove(line);
            }

            var beforePart = new ReportPart().WithTitle("Before");

            beforePart.AddToContent(sourceReport.ToString("\n"));
            var afterPart = new ReportPart().WithTitle("After");

            afterPart.AddToContent(targetReport.ToString("\n"));

            reportPart.AddPart(beforePart);
            reportPart.AddPart(afterPart);
            return(reportPart);
        }
Exemplo n.º 3
0
        protected override void FillUpReport(Simulation simulation, ReportPart reportPart)
        {
            var title = string.Format("{0} '{1}'", PKSimConstants.ObjectTypes.Simulation, simulation.Name);

            reportPart.AddPart(_reportGenerator.ReportFor(simulation.UsedBuildingBlocks).WithTitle(title));
            reportPart.AddPart(_reportGenerator.ReportFor(simulation.Creation).WithTitle(PKSimConstants.UI.Origin));
            reportPart.AddPart(_reportGenerator.ReportFor(simulation.Properties));
        }
Exemplo n.º 4
0
        public void Visit(Simulation simulation)
        {
            var report = new ReportPart();

            report.AddPart(_reportGenerator.ReportFor(simulation.UsedBuildingBlocks));
            report.AddPart(_reportGenerator.ReportFor(simulation.Creation));
            _report = report.ToStringReport();
        }
Exemplo n.º 5
0
        protected override void FillUpReport(SimulationProperties simulationProperties, ReportPart reportPart)
        {
            var part = new ReportPart {
                Title = PKSimConstants.UI.AllowAging
            };

            part.AddToContent(simulationProperties.AllowAging ? PKSimConstants.UI.Yes : PKSimConstants.UI.No);
            reportPart.AddPart(part);
            reportPart.AddPart(_reportGenerator.ReportFor(simulationProperties.ModelProperties));
            reportPart.AddPart(_reportGenerator.ReportFor(simulationProperties.EventProperties));
        }
Exemplo n.º 6
0
        protected override void FillUpReport(OriginData originData, ReportPart reportPart)
        {
            var populationProperties = new TablePart(keyName: PKSimConstants.UI.PopulationProperties, valueName: PKSimConstants.UI.Value)
            {
                Title = PKSimConstants.UI.PopulationProperties
            };

            populationProperties.AddIs(PKSimConstants.UI.Species, originData.Species.DisplayName);
            populationProperties.AddIs(PKSimConstants.UI.Population, originData.SpeciesPopulation.DisplayName);
            populationProperties.AddIs(PKSimConstants.UI.Gender, originData.Gender.DisplayName);

            var individualProperties = new TablePart(PKSimConstants.UI.IndividualParameters, PKSimConstants.UI.Value, PKSimConstants.UI.Unit)
            {
                Title = PKSimConstants.UI.IndividualParameters
            };

            individualProperties.Types[PKSimConstants.UI.Value] = typeof(double);
            if (originData.SpeciesPopulation.IsAgeDependent)
            {
                if (originData.Age.HasValue)
                {
                    individualProperties.AddIs(PKSimConstants.UI.Age, displayValueFor(originData.Age.Value, _dimensionRepository.AgeInYears, originData.AgeUnit), originData.AgeUnit);
                }

                if (originData.SpeciesPopulation.IsPreterm && originData.GestationalAge.HasValue)
                {
                    individualProperties.AddIs(PKSimConstants.UI.GestationalAge, displayValueFor(originData.GestationalAge.Value, _dimensionRepository.AgeInWeeks, originData.GestationalAgeUnit), originData.GestationalAgeUnit);
                }
            }

            individualProperties.AddIs(PKSimConstants.UI.Weight, displayValueFor(originData.Weight, _dimensionRepository.Mass, originData.WeightUnit), originData.WeightUnit);

            if (originData.SpeciesPopulation.IsHeightDependent)
            {
                if (originData.Height.HasValue)
                {
                    individualProperties.AddIs(PKSimConstants.UI.Height, displayValueFor(originData.Height.Value, _dimensionRepository.Length, originData.HeightUnit), originData.HeightUnit);
                }

                if (originData.BMI.HasValue)
                {
                    individualProperties.AddIs(PKSimConstants.UI.BMI, displayValueFor(originData.BMI.Value, _dimensionRepository.BMI, originData.BMIUnit), originData.BMIUnit);
                }
            }

            reportPart.AddPart(populationProperties);
            reportPart.AddPart(individualProperties);
            reportPart.AddPart(_reportGenerator.ReportFor(originData.SubPopulation));
            reportPart.AddPart(_reportGenerator.ReportFor(originData.AllCalculationMethods()));
        }
        protected override void FillUpReport(IEnumerable <CalculationMethod> calculationMethods, ReportPart reportPart)
        {
            var calcMethodPart = new TablePart(keyName: PKSimConstants.UI.Category, valueName: PKSimConstants.UI.CalculationMethods)
            {
                Title = PKSimConstants.UI.CalculationMethods
            };

            foreach (var calculationMethod in calculationMethods)
            {
                var currentCalculationMethod = calculationMethod;
                var category = _calculationMethodCategoryRepository.FindBy(currentCalculationMethod.Category);
                var allCalculationMethods = category.AllItems().ToList();
                if (allCalculationMethods.Count == 1)
                {
                    continue;
                }

                //more than one cm in this category. Check that this is not only due to different models
                allCalculationMethods.Remove(calculationMethod);
                var allModelsUsedInCategory  = allCalculationMethods.SelectMany(x => x.AllModels).Distinct();
                var allSpeciesUsedInCategory = allCalculationMethods.SelectMany(x => x.AllSpecies).Distinct();

                //at least another category available in the model and species
                if (allModelsUsedInCategory.Any(x => currentCalculationMethod.AllModels.Contains(x)) &&
                    allSpeciesUsedInCategory.Any(x => currentCalculationMethod.AllSpecies.Contains(x)))
                {
                    calcMethodPart.AddIs(_representationInfoRepository.DisplayNameFor(category),
                                         _representationInfoRepository.DisplayNameFor(calculationMethod));
                }
            }

            reportPart.AddPart(calcMethodPart);
        }
Exemplo n.º 8
0
        protected override void FillUpReport(Simulation simulation, ReportPart reportPart)
        {
            var title = $"{PKSimConstants.ObjectTypes.Simulation} '{simulation.Name}'";

            reportPart.AddPart(_reportGenerator.ReportFor(simulation.UsedBuildingBlocks).WithTitle(title));
            reportPart.AddPart(_reportGenerator.ReportFor(simulation.Creation).WithTitle(PKSimConstants.UI.Origin));
            reportPart.AddPart(_reportGenerator.ReportFor(simulation.Properties));

            //Add special node with calculation methods per compound. Because the compound might be lazy loaded,
            //it is potentially not available in the compound properties
            simulation.UsedBuildingBlocksInSimulation(PKSimBuildingBlockType.Compound).ToList().Each((x, index) =>
            {
                var compoundPropertiesWithName = new CompoundPropertiesCalculationMethods(x.Name, simulation.CompoundPropertiesList[index]);
                reportPart.AddPart(_reportGenerator.ReportFor(compoundPropertiesWithName));
            });
        }
Exemplo n.º 9
0
        protected override void FillUpReport(DataRepository dataRepository, ReportPart reportPart)
        {
            reportPart.Title = PKSimConstants.ObjectTypes.ObservedData;
            reportPart.AddToContent(dataRepository.Name);
            reportPart.AddPart(_reportGenerator.ReportFor(dataRepository.ExtendedProperties));

            foreach (var column in dataRepository.AllButBaseGrid())
            {
                if (column.DataInfo == null)
                {
                    continue;
                }

                reportPart.AddPart(_reportGenerator.ReportFor(column));
            }
        }
Exemplo n.º 10
0
 protected override void FillUpReport(Schema schema, ReportPart reportPart)
 {
     reportPart.Title = schema.Name;
     reportPart.AddToContent(_reportGenerator.ReportFor(schema.StartTime));
     reportPart.AddToContent(_reportGenerator.ReportFor(schema.TimeBetweenRepetitions));
     reportPart.AddToContent(_reportGenerator.ReportFor(schema.NumberOfRepetitions));
     schema.SchemaItems.Each(x => reportPart.AddPart(_reportGenerator.ReportFor(x)));
 }
Exemplo n.º 11
0
 protected override void FillUpReport(DataColumn column, ReportPart reportPart)
 {
     if (column.DataInfo == null)
     {
         return;
     }
     reportPart.AddPart(_reportGenerator.ReportFor(column.DataInfo.ExtendedProperties).WithTitle(column.Name));
 }
        protected override void FillUpReport(CompoundProperties compoundProperties, ReportPart reportPart)
        {
            var processes      = compoundProperties.Processes;
            var compoundConfig = new TablePart(PKSimConstants.UI.Parameter, PKSimConstants.UI.AlternativeInCompound)
            {
                Title = PKSimConstants.UI.SimulationCompoundsConfiguration
            };


            foreach (var alternativeSelection in compoundProperties.CompoundGroupSelections)
            {
                var parameterName = _representationInfoRepository.DisplayNameFor(RepresentationObjectType.GROUP, alternativeSelection.GroupName);
                compoundConfig.AddIs(parameterName, alternativeSelection.AlternativeName);
            }

            reportPart.AddPart(compoundConfig);
            reportPart.AddPart(_reportGenerator.ReportFor(processes.MetabolizationSelection).WithTitle(PKSimConstants.UI.SimulationMetabolism));
            reportPart.AddPart(_reportGenerator.ReportFor(processes.TransportAndExcretionSelection).WithTitle(PKSimConstants.UI.SimulationTransportAndExcretion));
            reportPart.AddPart(_reportGenerator.ReportFor(processes.SpecificBindingSelection).WithTitle(PKSimConstants.UI.SimulationSpecificBinding));
        }
Exemplo n.º 13
0
        protected override void FillUpReport(Formulation formulation, ReportPart reportPart)
        {
            reportPart.Title = _infoRepository.DisplayNameFor(RepresentationObjectType.CONTAINER, formulation.FormulationType);
            string parameterTableCaption = PKSimConstants.UI.ParametersDefinedIn(formulation.Name);

            if (formulation.IsDissolved)
            {
                reportPart.AddToContent(PKSimConstants.UI.NoParameter);
                return;
            }

            TablePart tablePart;

            if (!formulation.IsParticleDissolution)
            {
                var parameterList = new ParameterList(parameterTableCaption, formulation.AllVisibleParameters());
                tablePart = parameterList.ToTable(_infoRepository);
            }
            else
            {
                var particleDisperseSystem      = formulation.Parameter(Constants.Parameters.PARTICLE_DISPERSE_SYSTEM);
                var particleDistribution        = formulation.Parameter(Constants.Parameters.PARTICLE_SIZE_DISTRIBUTION);
                var displayParticleDistribution = _infoRepository.DisplayNameFor(particleDistribution);
                tablePart = new TablePart(PKSimConstants.UI.Parameter)
                {
                    Caption = parameterTableCaption
                };

                if (particleDisperseSystem.Value == CoreConstants.Parameters.MONODISPERSE)
                {
                    tablePart.AddIs(_infoRepository.DisplayNameFor(particleDisperseSystem), PKSimConstants.UI.Monodisperse);
                    tablePart.AddIs(formulation.Parameter(CoreConstants.Parameters.PARTICLE_RADIUS_MEAN), _infoRepository);
                }
                else
                {
                    tablePart.AddIs(_infoRepository.DisplayNameFor(particleDisperseSystem), PKSimConstants.UI.Polydisperse);
                    if (particleDistribution.Value == CoreConstants.Parameters.PARTICLE_SIZE_DISTRIBUTION_NORMAL)
                    {
                        tablePart.AddIs(displayParticleDistribution, PKSimConstants.UI.Normal);
                        tablePart.AddIs(formulation.Parameter(CoreConstants.Parameters.PARTICLE_RADIUS_MEAN), _infoRepository);
                        tablePart.AddIs(formulation.Parameter(CoreConstants.Parameters.PARTICLE_RADIUS_STD_DEVIATION), _infoRepository);
                    }
                    else
                    {
                        tablePart.AddIs(displayParticleDistribution, PKSimConstants.UI.LogNormal);
                        tablePart.AddIs(formulation.Parameter(CoreConstants.Parameters.PARTICLE_LOG_DISTRIBUTION_MEAN), _infoRepository);
                        tablePart.AddIs(formulation.Parameter(CoreConstants.Parameters.PARTICLE_LOG_VARIATION_COEFF), _infoRepository);
                    }
                }
            }

            tablePart.Title = reportPart.Title;
            reportPart.AddPart(tablePart);
        }
        protected override void FillUpReport(CompoundPropertiesCalculationMethods compoundPropertiesCalculationMethods, ReportPart reportPart)
        {
            var(compoundName, compoundProperties) = compoundPropertiesCalculationMethods;

            //Because the compound might be lazy loaded, it is potentially not available in the compound properties
            var compoundNameToUse = compoundProperties.Compound?.Name ?? compoundName;

            var calculationMethodReport = _reportGenerator.ReportFor(compoundProperties.AllCalculationMethods()).WithTitle(compoundNameToUse);

            reportPart.AddPart(calculationMethodReport);
        }
        protected override void FillUpReport(ImportPopulationSettings populationSettings, ReportPart reportPart)
        {
            var baseOnIndividualPart = new ReportPart().WithTitle(PKSimConstants.UI.BasedOnIndividual);

            baseOnIndividualPart.AddToContent(populationSettings.BaseIndividual.Name);

            var numberOfIndividuals    = populationSettings.AllFiles.Sum(x => x.NumberOfIndividuals);
            var numberOfIndividualPart = new ReportPart().WithTitle(PKSimConstants.UI.NumberOfIndividuals);

            numberOfIndividualPart.AddToContent(numberOfIndividuals.ToString(CultureInfo.InvariantCulture));

            var part = new ReportPart().WithTitle(PKSimConstants.UI.CreatedUsingFiles);

            foreach (var populationFiles in populationSettings.AllFiles)
            {
                part.AddToContent(FileHelper.ShortenPathName(populationFiles.FilePath, 50));
            }

            reportPart.AddPart(baseOnIndividualPart);
            reportPart.AddPart(numberOfIndividualPart);
            reportPart.AddPart(part);
        }
Exemplo n.º 16
0
        protected override void FillUpReport(Compound compound, ReportPart reportPart)
        {
            reportPart.AddPart(_reportGenerator.ReportFor(compound.ParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_LIPOPHILICITY)));
            reportPart.AddToContent(_reportGenerator.ReportFor(compound.Parameter(Constants.Parameters.MOL_WEIGHT)));
            reportPart.AddToContent(_reportGenerator.ReportFor(compound.Parameter(CoreConstants.Parameters.EFFECTIVE_MOLECULAR_WEIGHT)));
            reportPart.AddToContent(_reportGenerator.ReportFor(compound.Parameter(CoreConstants.Parameters.IS_SMALL_MOLECULE)));

            if (compound.IsNeutral)
            {
                reportPart.AddToContent(PKSimConstants.UI.CompoundTypeNeutral);
            }
            else
            {
                addCompoundTypePart(reportPart, compound, CoreConstants.Parameters.PARAMETER_PKA1, CoreConstants.Parameters.COMPOUND_TYPE1);
                addCompoundTypePart(reportPart, compound, CoreConstants.Parameters.PARAMETER_PKA2, CoreConstants.Parameters.COMPOUND_TYPE2);
                addCompoundTypePart(reportPart, compound, CoreConstants.Parameters.PARAMETER_PKA3, CoreConstants.Parameters.COMPOUND_TYPE3);
            }
            var fractionUnboundReport = _reportGenerator.ReportFor(compound.ParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_FRACTION_UNBOUND));

            fractionUnboundReport.AddToContent(_reportGenerator.ReportFor(compound.Parameter(CoreConstants.Parameters.PLASMA_PROTEIN_BINDING_PARTNER)));
            reportPart.AddPart(fractionUnboundReport);
        }
Exemplo n.º 17
0
        protected override void FillUpReport(IPopulationAnalysisField populationAnalysisField, ReportPart reportPart)
        {
            reportPart.Title = _objectTypeResolver.TypeFor(populationAnalysisField);
            reportPart.AddToContent(populationAnalysisField.Name);

            var groupingField = populationAnalysisField as PopulationAnalysisGroupingField;

            if (groupingField == null)
            {
                return;
            }

            reportPart.AddPart(_reportGenerator.ReportFor(groupingField.GroupingDefinition));
        }
        protected override void FillUpReport(PopulationSimulationComparison simulationComparison, ReportPart reportPart)
        {
            base.FillUpReport(simulationComparison, reportPart);
            var part = new ReportPart {
                Title = PKSimConstants.UI.ReferenceSimulation
            };

            if (simulationComparison.HasReference)
            {
                part.AddToContent(simulationComparison.ReferenceSimulation.Name);
            }
            else
            {
                part.AddToContent(PKSimConstants.UI.None);
            }

            reportPart.AddPart(part);
        }
 protected override void FillUpReport(AdvancedProtocol advancedProtocol, ReportPart reportPart)
 {
     reportPart.Title = PKSimConstants.UI.AdvancedProtocolMode;
     advancedProtocol.AllSchemas.Each(s => reportPart.AddPart(_reportGenerator.ReportFor(s)));
 }
Exemplo n.º 20
0
 protected override void FillUpReport(ModelProperties modelProperties, ReportPart reportPart)
 {
     reportPart.Title = PKSimConstants.UI.SimulationModelConfiguration;
     reportPart.AddToContent(_representationInfoRepository.DisplayNameFor(RepresentationObjectType.MODEL, modelProperties.ModelConfiguration.ModelName));
     reportPart.AddPart(_reportGenerator.ReportFor(modelProperties.AllCalculationMethods()));
 }
Exemplo n.º 21
0
        protected override void FillUpReport(OriginData originData, ReportPart reportPart)
        {
            var populationProperties = new TablePart(keyName: PKSimConstants.UI.PopulationProperties, valueName: PKSimConstants.UI.Value)
            {
                Title = PKSimConstants.UI.PopulationProperties
            };

            populationProperties.AddIs(PKSimConstants.UI.Species, originData.Species.DisplayName);
            populationProperties.AddIs(PKSimConstants.UI.Population, originData.Population.DisplayName);
            populationProperties.AddIs(PKSimConstants.UI.Gender, originData.Gender.DisplayName);

            var individualProperties = new TablePart(PKSimConstants.UI.IndividualParameters, PKSimConstants.UI.Value, PKSimConstants.UI.Unit)
            {
                Title = PKSimConstants.UI.IndividualParameters,
                Types =
                {
                    [PKSimConstants.UI.Value] = typeof(double)
                }
            };

            if (originData.Population.IsAgeDependent)
            {
                if (originData.Age != null)
                {
                    individualProperties.AddIs(PKSimConstants.UI.Age, displayValueFor(originData.Age), originData.Age.Unit);
                }

                if (originData.Population.IsPreterm && originData.GestationalAge != null)
                {
                    individualProperties.AddIs(PKSimConstants.UI.GestationalAge, displayValueFor(originData.GestationalAge), originData.GestationalAge.Unit);
                }
            }

            individualProperties.AddIs(PKSimConstants.UI.Weight, displayValueFor(originData.Weight), originData.Weight.Unit);

            if (originData.Population.IsHeightDependent)
            {
                if (originData.Height != null)
                {
                    individualProperties.AddIs(PKSimConstants.UI.Height, displayValueFor(originData.Height), originData.Height.Unit);
                }

                if (originData.BMI != null)
                {
                    individualProperties.AddIs(PKSimConstants.UI.BMI, displayValueFor(originData.BMI), originData.BMI.Unit);
                }
            }

            reportPart.AddPart(populationProperties);
            reportPart.AddPart(individualProperties);
            var diseaseState = originData.DiseaseState;

            if (diseaseState != null)
            {
                var diseaseStateProperties = new TablePart(PKSimConstants.UI.DiseaseState, PKSimConstants.UI.Value, PKSimConstants.UI.Unit)
                {
                    Title = diseaseState.DisplayName
                };
                originData.DiseaseStateParameters.Each(x =>
                {
                    var parameter   = diseaseState.Parameter(x.Name);
                    var displayName = _representationInfoRepository.DisplayNameFor(parameter);
                    diseaseStateProperties.AddIs(displayName, displayValueFor(x), x.Unit);
                });
                reportPart.AddPart(diseaseStateProperties);
            }

            reportPart.AddPart(_reportGenerator.ReportFor(originData.SubPopulation));
            reportPart.AddPart(_reportGenerator.ReportFor(originData.AllCalculationMethods()));
        }