/// <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 youthPediatricSymptonChecklist = new YouthPediatricSymptonChecklist(assessment);
            var values = new List <TimeFrequency>
            {
                youthPediatricSymptonChecklist.YouthChildsEmotionalAndBehaviorProblemsGroup.HasTroubleWithTeacher,
                youthPediatricSymptonChecklist.YouthChildsEmotionalAndBehaviorProblemsGroup.LessInterestedInSchool,
                youthPediatricSymptonChecklist.YouthChildsEmotionalAndBehaviorProblemsGroup.AbsentFromSchool,
                youthPediatricSymptonChecklist.YouthChildsEmotionalAndBehaviorProblemsGroup.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());

            _youthPediatricSymptonChecklist = new YouthPediatricSymptonChecklist(assessment);

            _youthPediatricSymptonChecklistReportData = new YouthPediatricSymptonChecklistReportData(_youthPediatricSymptonChecklist);
            PopulateReportData(patient, staff);
            var reportDataCollection = new PediatricSymptonChecklistReportDataCollection
            {
                _youthPediatricSymptonChecklistReportData
            };
            var report = new YouthPediatricSymptonChecklistReport
            {
                DataSource = reportDataCollection,
            };

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