public OriginData MapFrom(IndividualSettingsDTO individualSettingsDTO)
        {
            var originData = new OriginData
            {
                Species           = individualSettingsDTO.Species,
                SpeciesPopulation = individualSettingsDTO.SpeciesPopulation,
                Gender            = individualSettingsDTO.Gender,
                SubPopulation     = subPopulationFrom(individualSettingsDTO.SubPopulation),
                Age                = individualSettingsDTO.ParameterAge.KernelValue,
                AgeUnit            = displayUnit(individualSettingsDTO.ParameterAge),
                GestationalAge     = individualSettingsDTO.ParameterGestationalAge.KernelValue,
                GestationalAgeUnit = displayUnit(individualSettingsDTO.ParameterGestationalAge),
                Height             = individualSettingsDTO.ParameterHeight.KernelValue,
                HeightUnit         = displayUnit(individualSettingsDTO.ParameterHeight),
                Weight             = individualSettingsDTO.ParameterWeight.KernelValue,
                WeightUnit         = displayUnit(individualSettingsDTO.ParameterWeight),
                BMI                = individualSettingsDTO.ParameterBMI.KernelValue,
                BMIUnit            = displayUnit(individualSettingsDTO.ParameterBMI),
            };

            originData.UpdateValueOriginFrom(individualSettingsDTO.ValueOrigin);
            individualSettingsDTO.CalculationMethods.Select(cm => cm.CalculationMethod).Each(originData.AddCalculationMethod);

            return(originData);
        }
Esempio n. 2
0
        protected override void Context()
        {
            base.Context();
            _originData = new OriginData {
                Species = new Species {
                    Name = "A", Icon = "B"
                }, SpeciesPopulation = A.Fake <SpeciesPopulation>()
            };
            _individual    = new Individual();
            _organism      = new Organism();
            _neighborhoods = A.Fake <IContainer>();
            _rootContainer = new RootContainer();
            A.CallTo(() => _entityBaseFactory.Create <IRootContainer>()).Returns(_rootContainer);
            A.CallTo(() => _entityBaseFactory.Create <Individual>()).Returns(_individual);
            A.CallTo(() => _entityBaseFactory.Create <Organism>()).Returns(_organism);
            A.CallTo(() => _entityBaseFactory.Create <IContainer>()).Returns(_neighborhoods);

            _valueOrigin = new ValueOrigin {
                Method = ValueOriginDeterminationMethods.InVitro, Source = ValueOriginSources.Database
            };
            _originData.UpdateValueOriginFrom(_valueOrigin);

            _originData.Age     = 10;
            _originData.AgeUnit = _age.DisplayUnit.Name;
            _organism.Add(_age);

            _originData.GestationalAge     = 40;
            _originData.GestationalAgeUnit = _gestationalAge.DisplayUnit.Name;
            _organism.Add(_gestationalAge);

            _originData.Height     = 170;
            _originData.HeightUnit = _height.DisplayUnit.Name;
            _organism.Add(_height);

            _originData.Weight     = 170;
            _originData.WeightUnit = _weight.DisplayUnit.Name;
            _organism.Add(_weight);

            _originData.BMI     = 170;
            _originData.BMIUnit = _bmi.DisplayUnit.Name;
            _organism.Add(_bmi);
        }
Esempio n. 3
0
        public OriginData MapFrom(IndividualSettingsDTO individualSettingsDTO)
        {
            var originData = new OriginData
            {
                Species        = individualSettingsDTO.Species,
                Population     = individualSettingsDTO.Population,
                Gender         = individualSettingsDTO.Gender,
                SubPopulation  = subPopulationFrom(individualSettingsDTO.SubPopulation),
                Age            = originDataParameterFrom(individualSettingsDTO.ParameterAge),
                GestationalAge = originDataParameterFrom(individualSettingsDTO.ParameterGestationalAge),
                Height         = originDataParameterFrom(individualSettingsDTO.ParameterHeight),
                Weight         = originDataParameterFrom(individualSettingsDTO.ParameterWeight),
                BMI            = originDataParameterFrom(individualSettingsDTO.ParameterBMI)
            };

            updateDiseaseState(originData, individualSettingsDTO);

            originData.UpdateValueOriginFrom(individualSettingsDTO.ValueOrigin);
            individualSettingsDTO.CalculationMethods.Select(cm => cm.CalculationMethod).Each(originData.AddCalculationMethod);

            return(originData);
        }