public IndividualSettingsDTO MapFrom(Individual individual)
        {
            var originData    = individual.OriginData;
            var individualDTO = new IndividualSettingsDTO
            {
                Species               = originData.Species,
                Population            = originData.Population,
                SubPopulation         = _subPopulationDTOMapper.MapFrom(originData.SubPopulation),
                Gender                = originData.Gender,
                CalculationMethods    = originData.AllCalculationMethods().MapAllUsing(_calculationMethodDTOMapper),
                DiseaseState          = originData.DiseaseState ?? _diseaseStateRepository.HealthyState,
                DiseaseStateParameter = originData.DiseaseStateParameters
                                        .Select(_originDataParameterMapper.MapFrom)
                                        .FirstOrDefault() ?? new NullParameterDTO()
            };

            individualDTO.UpdateValueOriginFrom(originData.ValueOrigin);

            individualDTO.SetDefaultParameters(
                _parameterMapper.MapAsReadWriteFrom(individual.Organism.Parameter(CoreConstants.Parameters.AGE)),
                _parameterMapper.MapAsReadWriteFrom(individual.Organism.Parameter(CoreConstants.Parameters.HEIGHT)),
                _parameterMapper.MapAsReadWriteFrom(individual.Organism.Parameter(CoreConstants.Parameters.WEIGHT)),
                _parameterMapper.MapAsReadWriteFrom(individual.Organism.Parameter(CoreConstants.Parameters.BMI)),
                _parameterMapper.MapAsReadWriteFrom(individual.Organism.Parameter(Constants.Parameters.GESTATIONAL_AGE)));


            return(individualDTO);
        }
Beispiel #2
0
        public void RetrieveDefaultValueFor(IndividualSettingsDTO individualSettingsDTO)
        {
            individualSettingsDTO.SubPopulation = _subPopulationDTOMapper.MapFrom(_originDataTask.DefaultSubPopulationFor(individualSettingsDTO.Species));
            //Default parameter such as age etc.. were not defined yet
            var originData   = _originDataMapper.MapFrom(individualSettingsDTO);
            var parameterAge = _parameterMapper.MapAsReadWriteFrom(_individualModelTask.MeanAgeFor(originData));

            originData.Age = parameterAge.KernelValue;

            var parameterGestationalAge = _parameterMapper.MapAsReadWriteFrom(_individualModelTask.MeanGestationalAgeFor(originData));

            originData.GestationalAge = parameterGestationalAge.KernelValue;
            setDefaultValues(individualSettingsDTO, originData, parameterAge, parameterGestationalAge);
        }
        public IndividualSettingsDTO MapFrom(Individual individual)
        {
            var individualDTO = new IndividualSettingsDTO
            {
                Species            = individual.OriginData.Species,
                SpeciesPopulation  = individual.OriginData.SpeciesPopulation,
                SubPopulation      = _subPopulationDTOMapper.MapFrom(individual.OriginData.SubPopulation),
                Gender             = individual.OriginData.Gender,
                CalculationMethods = individual.OriginData.AllCalculationMethods().MapAllUsing(_calculationMethodDTOMapper)
            };

            individualDTO.SetDefaultParameters(_parameterMapper.MapAsReadWriteFrom(individual.Organism.Parameter(CoreConstants.Parameter.AGE)),
                                               _parameterMapper.MapAsReadWriteFrom(individual.Organism.Parameter(CoreConstants.Parameter.HEIGHT)),
                                               _parameterMapper.MapAsReadWriteFrom(individual.Organism.Parameter(CoreConstants.Parameter.WEIGHT)),
                                               _parameterMapper.MapAsReadWriteFrom(individual.Organism.Parameter(CoreConstants.Parameter.BMI)),
                                               _parameterMapper.MapAsReadWriteFrom(individual.Organism.Parameter(CoreConstants.Parameter.GESTATIONAL_AGE)));


            return(individualDTO);
        }
        public void UpdateDefaultValueFor(IndividualSettingsDTO individualSettingsDTO)
        {
            individualSettingsDTO.SubPopulation = _subPopulationDTOMapper.MapFrom(_originDataTask.DefaultSubPopulationFor(individualSettingsDTO.Species));
            //Default parameter such as age etc.. were not defined yet
            var originData   = _originDataMapper.MapFrom(individualSettingsDTO);
            var parameterAge = _individualModelTask.MeanAgeFor(originData);

            if (parameterAge != null)
            {
                originData.Age = new OriginDataParameter(parameterAge.Value);
            }

            var parameterGestationalAge = _individualModelTask.MeanGestationalAgeFor(originData);

            if (parameterGestationalAge != null)
            {
                originData.GestationalAge = new OriginDataParameter(parameterGestationalAge.Value);
            }

            setDefaultValues(individualSettingsDTO, originData, _parameterMapper.MapAsReadWriteFrom(parameterAge), _parameterMapper.MapAsReadWriteFrom(parameterGestationalAge));
        }
 public IParameterDTO MapFrom(OriginDataParameter originDataParameter)
 {
     return(_parameterDTOMapper.MapAsReadWriteFrom(parameterFrom(originDataParameter)));
 }