示例#1
0
        public virtual void TestIntervalLow()
        {
            Interval <Int32?> ivl    = IntervalFactory.CreateLow <Int32?>(1);
            string            result = this.formatter.Format(GetContext("name"), new IVLImpl <QTY <Int32?>, Interval <Int32?> >(ivl));

            AssertXml("result", "<name><low value=\"1\"/></name>", result);
        }
示例#2
0
        public virtual void TestIntervalLow()
        {
            Interval <PhysicalQuantity> low = IntervalFactory.CreateLow <PhysicalQuantity>(PHYSICAL_QUANTITY_LOW);
            string result = this.formatter.Format(GetContext("name"), new IVLImpl <QTY <PhysicalQuantity>, Interval <PhysicalQuantity> >(
                                                      low));

            AssertXml("result", "<name><low unit=\"mL\" value=\"1000\"/></name>", result);
        }
示例#3
0
        public virtual void TestIntervalLow()
        {
            Interval <PlatformDate> interval = IntervalFactory.CreateLow <PlatformDate>(ParseDate("2006-12-25"));
            string result = this.formatter.Format(GetContext("name", "IVL.LOW<TS.FULLDATE>", SpecificationVersion.R02_04_03), new IVLImpl
                                                  <QTY <PlatformDate>, Interval <PlatformDate> >(interval));

            Assert.IsTrue(this.result.IsValid());
            AssertXml("result", "<name><low value=\"20061225\"/></name>", result);
        }
示例#4
0
        public virtual void TestInvalidIntervalLow()
        {
            Interval <PlatformDate> interval = IntervalFactory.CreateLow <PlatformDate>(ParseDate("2006-12-25"));
            string result = this.formatter.Format(GetContext("name"), new IVLImpl <QTY <PlatformDate>, Interval <PlatformDate> >(interval
                                                                                                                                 ));

            Assert.IsFalse(this.result.IsValid());
            Assert.AreEqual(1, this.result.GetHl7Errors().Count);
            AssertXml("result", "<name><low value=\"20061225\"/></name>", result);
        }
示例#5
0
        public virtual void TestInvalidIntervalLow2()
        {
            Interval <PlatformDate> interval = IntervalFactory.CreateLow <PlatformDate>(ParseDate("2006-12-25"));
            string result = this.formatter.Format(GetContext("name", "IVL.HIGH<TS.FULLDATE>", SpecificationVersion.R02_04_02), new IVLImpl
                                                  <QTY <PlatformDate>, Interval <PlatformDate> >(interval));

            Assert.IsFalse(this.result.IsValid());
            Assert.AreEqual(2, this.result.GetHl7Errors().Count);
            // low invalid; must supply high
            AssertXml("result", "<name><low value=\"20061225\"/></name>", result);
        }
示例#6
0
        public virtual void TestIntervalLowMissingOther2()
        {
            Interval <PlatformDate> interval = IntervalFactory.CreateLow <PlatformDate>(ParseDate("2007-02-20T15:34:22"));
            string result = this.formatter.Format(GetContext("name"), new IVLImpl <QTY <PlatformDate>, Interval <PlatformDate> >(interval
                                                                                                                                 ));

            Assert.IsFalse(this.result.IsValid());
            Assert.AreEqual(1, this.result.GetHl7Errors().Count);
            // must have 2 of width/low/high
            AssertXml("result", "<name><low value=\"20070220\"/></name>", result);
        }
示例#7
0
        private TriggerEvent <ParameterList> CreateControlActEvent()
        {
            TriggerEvent <ParameterList> cae = new TriggerEvent <ParameterList>();

            cae.Id            = new Identifier("2.16.840.1.113883.1.6", "8141234");
            cae.Code          = HL7TriggerEventCode.LAB_TEST_RESULTS_QUERY;
            cae.EffectiveTime = IntervalFactory.CreateLow(new PlatformDate());
            cae.Author        = this.CreateAuthor_1();
            cae.DataEntryLocationServiceDeliveryLocation = this.CreateServiceLocation2();
            return(cae);
        }
        private ParameterList CreateQueryParameters()
        {
            ParameterList parameterList = new ParameterList();

            parameterList.MostRecentByDrugIndicatorValue = false;
            parameterList.IssueFilterCodeValue           = IssueFilterCode.ALL;
            Interval <PlatformDate> fromDate = IntervalFactory.CreateLow(new PlatformDate(0));

            parameterList.AdministrationEffectivePeriodValue = fromDate;
            return(parameterList);
        }
示例#9
0
        private SenderValueHolder PopulateSender()
        {
            SenderValueHolder sender = new SenderValueHolder();

            sender.SetTelecom(new TelecommunicationAddress(Ca.Infoway.Messagebuilder.Domainvalue.Basic.URLScheme.HTTP, "192.168.2.2")
                              );
            sender.SetDeviceId(new Identifier("1.1.4", "ext4"));
            sender.SetDeviceManufacturerModelName("1.0");
            sender.SetDeviceSoftwareName("MBT Pharmacy");
            sender.SetDeviceDesc("Configuration information");
            sender.SetDeviceName("Sending Application Name");
            sender.SetDeviceExistenceTime(IntervalFactory.CreateLow <PlatformDate>(new PlatformDate()));
            sender.SetDeviceAgentAgentOrganizationId(new Identifier("1.1.5", "ext5"));
            return(sender);
        }
示例#10
0
        private TriggerEvent <ImmunizationQueryParameters> CreateControlActEvent()
        {
            TriggerEvent <ImmunizationQueryParameters> controlActEvent = new TriggerEvent <ImmunizationQueryParameters>();

            controlActEvent.Code = HL7TriggerEventCode.IMMUNIZATION_QUERY;

            controlActEvent.Id            = new Identifier(Guid.NewGuid().ToString());
            controlActEvent.EffectiveTime = IntervalFactory.CreateLow(new PlatformDate());

            controlActEvent.RecordTargetPatient1 = this.CreateRecordTarget();
            controlActEvent.Author = this.CreateAuthor_1();
            controlActEvent.DataEntryLocationServiceDeliveryLocation = this.CreateServiceLocation2();

            return(controlActEvent);
        }
示例#11
0
 public virtual Interval <PlatformDate> GetEffectiveTimeAsInterval()
 {
     return(this.effectiveTime.Null ? null : IntervalFactory.CreateLow <PlatformDate>(this.effectiveTime.Value));
 }
示例#12
0
        protected override Interval <T> ParseNonNullNode(ParseContext context, XmlNode node, BareANY parseResult, Type expectedReturnType
                                                         , XmlToModelResult xmlToModelResult)
        {
            // go back and revert TS.FULLDATEWITHTIME validation check? (is there anything to revert?)
            context = HandleSpecializationType(context, node, xmlToModelResult);
            Interval <T> result = null;
            XmlElement   low    = (XmlElement)GetNamedChildNode(node, "low");
            XmlElement   high   = (XmlElement)GetNamedChildNode(node, "high");
            XmlElement   center = (XmlElement)GetNamedChildNode(node, "center");
            XmlElement   width  = (XmlElement)GetNamedChildNode(node, "width");

            ValidateCorrectElementsProvided(low != null, high != null, center != null, width != null, (XmlElement)node, context, xmlToModelResult
                                            );
            BareANY  lowAny     = low == null ? null : CreateType(context, low, xmlToModelResult);
            object   lowType    = lowAny == null ? null : lowAny.BareValue;
            BareANY  highAny    = high == null ? null : CreateType(context, high, xmlToModelResult);
            object   highType   = highAny == null ? null : highAny.BareValue;
            BareANY  centerAny  = center == null ? null : CreateType(context, center, xmlToModelResult);
            object   centerType = centerAny == null ? null : centerAny.BareValue;
            BareDiff widthType  = width == null ? null : CreateDiffType(context, width, xmlToModelResult);

            DoOtherValidations(lowAny, highAny, centerAny, widthType, (XmlElement)node, context, xmlToModelResult);
            if (lowAny != null && highAny != null)
            {
                result = IntervalFactory.CreateLowHigh <T>((T)lowType, (T)highType, lowAny.NullFlavor, highAny.NullFlavor);
            }
            else
            {
                if (lowAny != null && widthType != null)
                {
                    result = IntervalFactory.CreateLowWidth <T>((T)lowType, (Diff <T>)widthType, lowAny.NullFlavor);
                }
                else
                {
                    if (highAny != null && widthType != null)
                    {
                        result = IntervalFactory.CreateWidthHigh <T>((Diff <T>)widthType, (T)highType, highAny.NullFlavor);
                    }
                    else
                    {
                        if (centerAny != null && widthType != null)
                        {
                            result = IntervalFactory.CreateCentreWidth <T>((T)centerType, (Diff <T>)widthType, centerAny.NullFlavor);
                        }
                        else
                        {
                            if (centerAny != null && lowAny != null)
                            {
                                result = IntervalFactory.CreateLowCentre <T>((T)lowType, (T)centerType, lowAny.NullFlavor, centerAny.NullFlavor);
                            }
                            else
                            {
                                if (centerAny != null && highAny != null)
                                {
                                    result = IntervalFactory.CreateCentreHigh <T>((T)centerType, (T)highType, centerAny.NullFlavor, highAny.NullFlavor);
                                }
                                else
                                {
                                    if (lowAny != null)
                                    {
                                        result = IntervalFactory.CreateLow <T>((T)lowType, lowAny.NullFlavor);
                                    }
                                    else
                                    {
                                        if (highAny != null)
                                        {
                                            result = IntervalFactory.CreateHigh <T>((T)highType, highAny.NullFlavor);
                                        }
                                        else
                                        {
                                            if (centerAny != null)
                                            {
                                                result = IntervalFactory.CreateCentre <T>((T)centerType, centerAny.NullFlavor);
                                            }
                                            else
                                            {
                                                if (widthType != null)
                                                {
                                                    result = IntervalFactory.CreateWidth <T>((Diff <T>)widthType);
                                                }
                                                else
                                                {
                                                    if (low == null && high == null && center == null && width == null)
                                                    {
                                                        // only treat this as a "simple" interval if no other interval elements were provided (even if they were in error)
                                                        // try to parse a "simple" interval; this does not seem a valid approach for MR2009, MR2007, or CeRx (perhaps allowed within the XSDs?)
                                                        object type = CreateType(context, (XmlElement)node, xmlToModelResult).BareValue;
                                                        if (type == null)
                                                        {
                                                            xmlToModelResult.AddHl7Error(new Hl7Error(Hl7ErrorCode.SYNTAX_ERROR, "\"Simple interval node: " + XmlDescriber.DescribePath
                                                                                                          (node) + " does not allow a null value\"", (XmlElement)node));
                                                        }
                                                        else
                                                        {
                                                            result = IntervalFactory.CreateSimple <T>((T)type);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(result);
        }
示例#13
0
        public virtual void ShouldAdaptCorrectly()
        {
            IVLImpl <TS, Interval <PlatformDate> > ivl = new IVLImpl <TS, Interval <PlatformDate> >(IntervalFactory.CreateLow <PlatformDate>
                                                                                                        (new PlatformDate()));
            BareANY adapted = this.adapter.Adapt(typeof(TS), ivl);

            Assert.IsTrue(adapted is TS);
            Assert.AreEqual(((TS)adapted).Value, ivl.Value.Low, "low");
        }
示例#14
0
        protected override Interval <T> ParseNonNullNode(ParseContext context, XmlNode node, BareANY parseResult, Type expectedReturnType
                                                         , XmlToModelResult xmlToModelResult)
        {
            Interval <T> result = null;
            XmlElement   low    = (XmlElement)GetNamedChildNode(node, "low");
            XmlElement   high   = (XmlElement)GetNamedChildNode(node, "high");
            XmlElement   center = (XmlElement)GetNamedChildNode(node, "center");
            XmlElement   width  = (XmlElement)GetNamedChildNode(node, "width");

            ValidateCorrectElementsProvided(low != null, high != null, center != null, width != null, (XmlElement)node, context, xmlToModelResult
                                            );
            BareANY  lowAny        = low == null ? null : CreateType(context, low, xmlToModelResult, false);
            object   lowType       = ExtractValue(lowAny);
            Boolean? lowInclusive  = ExtractInclusive(context, low, xmlToModelResult);
            BareANY  highAny       = high == null ? null : CreateType(context, high, xmlToModelResult, false);
            object   highType      = ExtractValue(highAny);
            Boolean? highInclusive = ExtractInclusive(context, high, xmlToModelResult);
            BareANY  centerAny     = center == null ? null : CreateType(context, center, xmlToModelResult, false);
            object   centerType    = ExtractValue(centerAny);
            BareDiff widthType     = width == null ? null : CreateDiffType(context, width, xmlToModelResult);

            if (lowAny != null && highAny != null)
            {
                result = IntervalFactory.CreateLowHigh <T>((T)lowType, (T)highType, lowAny.NullFlavor, highAny.NullFlavor);
            }
            else
            {
                if (lowAny != null && widthType != null)
                {
                    result = IntervalFactory.CreateLowWidth <T>((T)lowType, (Diff <T>)widthType, lowAny.NullFlavor);
                }
                else
                {
                    if (highAny != null && widthType != null)
                    {
                        result = IntervalFactory.CreateWidthHigh <T>((Diff <T>)widthType, (T)highType, highAny.NullFlavor);
                    }
                    else
                    {
                        if (centerAny != null && widthType != null)
                        {
                            result = IntervalFactory.CreateCentreWidth <T>((T)centerType, (Diff <T>)widthType, centerAny.NullFlavor);
                        }
                        else
                        {
                            if (centerAny != null && lowAny != null)
                            {
                                result = IntervalFactory.CreateLowCentre <T>((T)lowType, (T)centerType, lowAny.NullFlavor, centerAny.NullFlavor);
                            }
                            else
                            {
                                if (centerAny != null && highAny != null)
                                {
                                    result = IntervalFactory.CreateCentreHigh <T>((T)centerType, (T)highType, centerAny.NullFlavor, highAny.NullFlavor);
                                }
                                else
                                {
                                    if (lowAny != null)
                                    {
                                        result = IntervalFactory.CreateLow <T>((T)lowType, lowAny.NullFlavor);
                                    }
                                    else
                                    {
                                        if (highAny != null)
                                        {
                                            result = IntervalFactory.CreateHigh <T>((T)highType, highAny.NullFlavor);
                                        }
                                        else
                                        {
                                            if (centerAny != null)
                                            {
                                                result = IntervalFactory.CreateCentre <T>((T)centerType, centerAny.NullFlavor);
                                            }
                                            else
                                            {
                                                if (widthType != null)
                                                {
                                                    result = IntervalFactory.CreateWidth <T>((Diff <T>)widthType);
                                                }
                                                else
                                                {
                                                    if (low == null && high == null && center == null && width == null)
                                                    {
                                                        // only treat this as a "simple" interval if no other interval elements were provided (even if they were in error)
                                                        // try to parse a "simple" interval
                                                        BareANY simpleAny = CreateType(context, (XmlElement)node, xmlToModelResult, true);
                                                        object  type      = ExtractValue(simpleAny);
                                                        if (type == null)
                                                        {
                                                            xmlToModelResult.AddHl7Error(new Hl7Error(Hl7ErrorCode.SYNTAX_ERROR, "\"Simple interval node: " + XmlDescriber.DescribePath
                                                                                                          (node) + " does not allow a null value\"", (XmlElement)node));
                                                        }
                                                        else
                                                        {
                                                            result = IntervalFactory.CreateSimple <T>((T)type, ((ANYMetaData)simpleAny).Operator);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (result != null)
            {
                result.LowInclusive  = lowInclusive;
                result.HighInclusive = highInclusive;
            }
            return(result);
        }