/// <summary>
        /// Creates an observation where the value is a boolean
        /// </summary>
        /// <param name="observation"></param>
        /// <returns></returns>
        public static CdaBoolObservation CreateBoolObservation(Observation observation)
        {
            CdaBoolObservation returnVal;

            // *** Try to parse the boolean value ***
            bool val = false;

            if (bool.TryParse(observation.Value, out val))
            {
                // *** If parsed ***

                // *** Create boolean observation ***
                returnVal       = new CdaBoolObservation();
                returnVal.Value = val;

                // *** Add Id, Status ***
                returnVal.Id     = Guid.NewGuid().ToString(); //observation.Ien;
                returnVal.Status = Hl7ProblemActStatus.completed;

                // *** Create code ***
                returnVal.Code = new CdaCode()
                {
                    CodeSystem = observation.CodeSystem, Code = observation.Code, DisplayName = observation.Description
                };
            }
            else
            {
                returnVal = null;
            }

            return(returnVal);
        }
        public static CdaBoolObservation CreatePregnancyHistoryBoolObservation(Observation observation)
        {
            CdaBoolObservation returnVal = CreateBoolObservation(observation);

            if (returnVal != null)
            {
                returnVal.TemplateIds   = new CdaTemplateIdList(SimpleObservationTemplateId, PregnancyObservationTemplateId);
                returnVal.EffectiveTime = new CdaEffectiveTime()
                {
                    Value = observation.EntryDate
                };
            }

            return(returnVal);
        }
        public static CdaBoolObservation CreateAdvanceDirectiveObservation(Observation observation)
        {
            CdaBoolObservation returnVal = CdaObservationFactory.CreateBoolObservation(observation);

            // *** NOTE: These are ID's in the specification but do not validate with the NIST tool
            //returnVal.TemplateIds.AddId("2.16.840.1.113883.10.20.1.17");
            //returnVal.TemplateIds.AddId("1.3.6.1.4.1.19376.1.5.3.1.4.13.7");

            if (returnVal != null)
            {
                // *** NOTE: This template ID validates with NIST ***
                returnVal.TemplateIds.AddId("2.16.840.1.113883.10.20.1.25");

                returnVal.Mood = x_ActMoodDocumentObservation.RQO;

                returnVal.EffectiveTime = new CdaEffectiveTime()
                {
                    Value = observation.EntryDate
                };
            }

            return(returnVal);
        }