/// <summary>
        ///     Initializes a new instance of the <see cref="NidaAssessFurtherScoring" /> class.
        /// </summary>
        /// <param name="assessment">The assessment.</param>
        public NidaAssessFurtherScoring(AssessmentInstance assessment)
        {
            var nidaAssessFurther    = new NidaAssessFurther(assessment);
            var hasDailyUseSubstance =
                nidaAssessFurther.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceMarijuanaPersonalMedicalHistoryFrequency == DrugUseFrequency.DailyOrAlmostDaily ||
                nidaAssessFurther.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceCocainePersonalMedicalHistoryFrequency == DrugUseFrequency.DailyOrAlmostDaily ||
                nidaAssessFurther.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceOpioidPersonalMedicalHistoryFrequency == DrugUseFrequency.DailyOrAlmostDaily ||
                nidaAssessFurther.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceStimulantPersonalMedicalHistoryFrequency == DrugUseFrequency.DailyOrAlmostDaily ||
                nidaAssessFurther.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceSedativePersonalMedicalHistoryFrequency == DrugUseFrequency.DailyOrAlmostDaily ||
                nidaAssessFurther.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceOtherSubstanceofAbusePersonalMedicalHistoryFrequency == DrugUseFrequency.DailyOrAlmostDaily;

            var hasWeeklyUseSubstance =
                nidaAssessFurther.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceOpioidPersonalMedicalHistoryFrequency == DrugUseFrequency.Weekly ||
                nidaAssessFurther.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceCocainePersonalMedicalHistoryFrequency == DrugUseFrequency.Weekly ||
                nidaAssessFurther.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceStimulantPersonalMedicalHistoryFrequency == DrugUseFrequency.Weekly;

            var score =
                hasDailyUseSubstance ||
                hasWeeklyUseSubstance ||
                (
                    nidaAssessFurther.InjectionGroup.SubstanceAbuseIllicitSubstanceIntravenousRouteofAdministrationPersonalMedicalHistoryInd2 &&
                    nidaAssessFurther.InjectionGroup.SubstanceAbuseIllicitSubstanceIntravenousRouteofAdministrationPersonalMedicalHistoryFrequency
                    == InjectionFrequency.InThePast90Days
                )
                ||
                nidaAssessFurther.SudTreatmentGroup.SubstanceAbuseSubstanceRelatedDisorderCurrentTherapyPersonalMedicalHistoryInd2;

            TotalScore = score;
        }
        private static ReportModel CreateSummarySection(IResourcesManager resourcesManager, AssessmentInstance dastInstance, AssessmentInstance nidaAssessFurtherInstance)
        {
            var reportModel = new ReportModel
            {
                Name           = ReportNames.NidaPatientSummaryReport,
                IsCustomizable = true
            };
            var reportItems = new List <ReportItem> ();
            var nidaAssessFurtherResources = resourcesManager == null
                ? new ResourceManager(typeof(NidaAssessFurther))
                : resourcesManager.GetResourceManagerByName(NidaAssessFurther.AssessmentCodedConcept.Code);

            var nidaAssessFurther = new NidaAssessFurther(nidaAssessFurtherInstance);
            var displayName       = nidaAssessFurtherResources.GetString(
                "_" + AssessmentPart.GetPropertyCodedConcept <NidaAssessFurther, Lookup>(
                    a => a.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceOpioidPersonalMedicalHistoryFrequency).Code);

            CheckAddDrugFrequency(
                reportItems,
                nidaAssessFurtherResources,
                nidaAssessFurther.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceOpioidPersonalMedicalHistoryFrequency,
                displayName);
            displayName = nidaAssessFurtherResources.GetString(
                "_" + AssessmentPart.GetPropertyCodedConcept <NidaAssessFurther, Lookup>(
                    a => a.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceCocainePersonalMedicalHistoryFrequency).Code);
            CheckAddDrugFrequency(
                reportItems,
                nidaAssessFurtherResources,
                nidaAssessFurther.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceCocainePersonalMedicalHistoryFrequency,
                displayName);
            displayName = nidaAssessFurtherResources.GetString(
                "_" + AssessmentPart.GetPropertyCodedConcept <NidaAssessFurther, Lookup>(
                    a => a.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceMarijuanaPersonalMedicalHistoryFrequency).Code);
            CheckAddDrugFrequency(
                reportItems,
                nidaAssessFurtherResources,
                nidaAssessFurther.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceMarijuanaPersonalMedicalHistoryFrequency,
                displayName);
            displayName = nidaAssessFurtherResources.GetString(
                "_" + AssessmentPart.GetPropertyCodedConcept <NidaAssessFurther, Lookup>(
                    a => a.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceSedativePersonalMedicalHistoryFrequency).Code);
            CheckAddDrugFrequency(
                reportItems,
                nidaAssessFurtherResources,
                nidaAssessFurther.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceSedativePersonalMedicalHistoryFrequency,
                displayName);
            displayName = nidaAssessFurtherResources.GetString(
                "_" + AssessmentPart.GetPropertyCodedConcept <NidaAssessFurther, Lookup>(
                    a => a.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceStimulantPersonalMedicalHistoryFrequency).Code);
            CheckAddDrugFrequency(
                reportItems,
                nidaAssessFurtherResources,
                nidaAssessFurther.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceStimulantPersonalMedicalHistoryFrequency,
                displayName);
            displayName = nidaAssessFurther.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceOtherSubstanceofAbusePersonalMedicalHistorySpecify;
            CheckAddDrugFrequency(
                reportItems,
                nidaAssessFurtherResources,
                nidaAssessFurther.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceOtherSubstanceofAbusePersonalMedicalHistoryFrequency,
                displayName);
            reportModel.AddReportItem(
                new ReportItem(
                    PropertyUtil.ExtractPropertyName <NidaReportData, string> (r => r.SummaryHeader),
                    null,
                    new[]
            {
                dastInstance.Score.Value
            },
                    reportItems.ToArray()
                    )
            {
                ItemMetadata = new ItemMetadata {
                    MetadataItems = new List <IMetadataItem> {
                        new ReadonlyMetadataItem {
                            IsReadonly = true
                        }
                    }
                }
            });
            return(reportModel);
        }