/// <summary>
        ///     Calculates the score.
        /// </summary>
        /// <param name="assessment">The assessment.</param>
        public void CalculateScore(AssessmentInstance assessment)
        {
            var total = (assessment.ItemInstances.Where(item => item.Value.GetType() == typeof(TimeFrequency))
                         .Select(item => (TimeFrequency)item.Value)
                         .Select(tf => int.Parse(tf.Value.ToString()))).Sum();
            var patient = _patientRepository.GetByKey(assessment.PatientKey);
            var pediatricSymptonChecklist = new PediatricSymptonChecklist(assessment);
            var values = new List <TimeFrequency>
            {
                pediatricSymptonChecklist.ChildsEmotionalAndBehaviorProblemsGroup.HasTroubleWithTeacher,
                pediatricSymptonChecklist.ChildsEmotionalAndBehaviorProblemsGroup.LessInterestedInSchool,
                pediatricSymptonChecklist.ChildsEmotionalAndBehaviorProblemsGroup.AbsentFromSchool,
                pediatricSymptonChecklist.ChildsEmotionalAndBehaviorProblemsGroup.SchoolGradesDropping
            };

            total -= Common.AdjustScoreBasedOnAge(patient, values);
            assessment.ScoreComplete(new CodedConcept(CodeSystems.Obhita, string.Empty, string.Empty), total, true);
        }
        /// <summary>Generates the specified key.</summary>
        /// <param name="key">The key.</param>
        /// <param name="reportName">Name of the report.</param>
        /// <param name="parameters">The parameters.</param>
        /// <returns>A <see cref="IReport" />.</returns>
        /// <exception cref="System.ArgumentException">Invalid parameters.</exception>
        public IReport Generate(Guid key, string reportName, object parameters = null)
        {
            var assessment = _assessmentInstanceRepository.GetByKey(key);
            var patient    = _patientRepository.GetByKey(assessment.PatientKey);
            var staff      = _staffRepository.GetByKey(assessment.CreatedByStaffKey.GetValueOrDefault());

            _pediatricSymptonChecklist = new PediatricSymptonChecklist(assessment);

            _pediatricSymptonChecklistReportData = new PediatricSymptonChecklistReportData(_pediatricSymptonChecklist);
            PopulateReportData(patient, staff);
            var reportDataCollection = new PediatricSymptonChecklistReportDataCollection
            {
                _pediatricSymptonChecklistReportData
            };
            var report = new PediatricSymptonChecklistReport
            {
                DataSource = reportDataCollection,
            };

            return(report);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PediatricSymptonChecklistReportData"/> class.
 /// </summary>
 /// <param name="pediatricSymptonChecklist">The pediatric sympton checklist.</param>
 public PediatricSymptonChecklistReportData(PediatricSymptonChecklist pediatricSymptonChecklist)
 {
     PediatricSymptonChecklist = pediatricSymptonChecklist;
     AssessmentInstance        = pediatricSymptonChecklist.AssessmentInstance;
 }