Beispiel #1
0
        public virtual T Get(string name)
        {
            T result = this.registryMap.SafeGet(name);

            if (result == null)
            {
                result = this.registryMap.SafeGet(Hl7DataTypeName.GetTypeWithoutParameters(name));
            }
            if (result == null)
            {
                result = this.registryMap.SafeGet(Hl7DataTypeName.Unqualify(name));
            }
            if (result == null)
            {
                result = this.registryMap.SafeGet(Hl7DataTypeName.GetTypeWithoutParameters(Hl7DataTypeName.Unqualify(name)));
            }
            return(result);
        }
Beispiel #2
0
        public virtual IList <string> DoOtherValidations(string type, NullFlavor lowNullFlavor, NullFlavor centerNullFlavor, NullFlavor
                                                         highNullFlavor, NullFlavor widthNullFlavor, Ca.Infoway.Messagebuilder.Domainvalue.UnitsOfMeasureCaseSensitive widthTimeUnits
                                                         )
        {
            IList <string>   errors                       = new List <string>();
            string           parameterizedType            = Hl7DataTypeName.GetParameterizedType(type);
            string           unqualifiedParameterizedType = Hl7DataTypeName.Unqualify(parameterizedType);
            StandardDataType innerType                    = StandardDataType.GetByTypeName(parameterizedType);
            StandardDataType baseInnerType                = StandardDataType.GetByTypeName(unqualifiedParameterizedType);

            if (!this.isUncertainRangeValidation)
            {
                if (baseInnerType == StandardDataType.PQ)
                {
                    // TODO - VALIDATION - TM - this might apply to URG<PQ.x> (check with Lloyd)
                    bool lowNull  = (lowNullFlavor != null);
                    bool highNull = (highNullFlavor != null);
                    if (lowNull && highNull)
                    {
                        errors.Add("For " + GetIntervalOrRange() + "s of type PQ.x, one of (low, high) must be non-null.");
                    }
                }
                else
                {
                    EnsureNotPinfOrNinf("low", lowNullFlavor, errors);
                    EnsureNotPinfOrNinf("high", highNullFlavor, errors);
                    EnsureNotPinfOrNinf("center", centerNullFlavor, errors);
                    EnsureNotPinfOrNinf("width", widthNullFlavor, errors);
                }
                // TS.DATE/TS.FULLDATE have width restrictions (does not seem to apply to URG; check with Lloyd)
                if (innerType == StandardDataType.TS_DATE || innerType == StandardDataType.TS_FULLDATE)
                {
                    if (widthTimeUnits != null)
                    {
                        if (!Ca.Infoway.Messagebuilder.Domainvalue.Basic.DefaultTimeUnit.IsDayBased(widthTimeUnits))
                        {
                            errors.Add("Width units must be days (d), weeks (wk), months (mo) or years (a).");
                        }
                    }
                }
            }
            return(errors);
        }
Beispiel #3
0
        public virtual IList <string> ValidateCorrectElementsProvided(string type, VersionNumber version, bool lowProvided, bool highProvided
                                                                      , bool centerProvided, bool widthProvided)
        {
            IList <string>   errors                       = new List <string>();
            StandardDataType standardDataType             = StandardDataType.GetByTypeName(type);
            bool             isCeRx                       = SpecificationVersion.IsVersion(standardDataType, version, Hl7BaseVersion.CERX);
            string           typeWithoutParameters        = Hl7DataTypeName.GetTypeWithoutParameters(type);
            string           parameterizedType            = Hl7DataTypeName.GetParameterizedType(type);
            string           unqualifiedParameterizedType = Hl7DataTypeName.Unqualify(parameterizedType);
            StandardDataType ivlType                      = StandardDataType.GetByTypeName(typeWithoutParameters);
            StandardDataType innerType                    = StandardDataType.GetByTypeName(parameterizedType);
            StandardDataType baseInnerType                = StandardDataType.GetByTypeName(unqualifiedParameterizedType);
            int numberOfCorrectlyProvidedElements         = this.CountProvidedElements(lowProvided, highProvided, centerProvided, widthProvided
                                                                                       );

            if (lowProvided && this.IsLowProhibited(ivlType))
            {
                numberOfCorrectlyProvidedElements--;
                errors.Add(this.CreateIncorrectElementErrorMessage(type, "low"));
            }
            if (highProvided && this.IsHighProhibited(ivlType))
            {
                numberOfCorrectlyProvidedElements--;
                errors.Add(this.CreateIncorrectElementErrorMessage(type, "high"));
            }
            if (widthProvided && this.IsWidthProhibited(ivlType, innerType, baseInnerType))
            {
                numberOfCorrectlyProvidedElements--;
                errors.Add(this.CreateIncorrectElementErrorMessage(type, "width"));
            }
            if (centerProvided && this.IsCenterProhibited(isCeRx, innerType))
            {
                numberOfCorrectlyProvidedElements--;
                errors.Add(this.CreateIncorrectElementErrorMessage(type, "center"));
            }
            if (this.IncorrectNumberOfElementsProvided(numberOfCorrectlyProvidedElements, ivlType))
            {
                errors.Add(this.CreateWrongNumberOfElementsProvidedErrorMessage(isCeRx, type, ivlType, innerType, baseInnerType));
            }
            return(errors);
        }
Beispiel #4
0
        public virtual void TestShouldDetermineUnqualifiedInnerTypesComplicatedName()
        {
            Hl7DataTypeName name = Hl7DataTypeName.Create("IVL.LOW<PQ.LAB>");

            Assert.AreEqual("IVL.LOW<PQ>", name.GetUnqualifiedInnerTypesVersion().ToString());
        }
Beispiel #5
0
        public virtual void TestShouldDetermineUnqualifiedComplicatedName()
        {
            Hl7DataTypeName name = Hl7DataTypeName.Create("RTO<MO.CAD,PQ.BASIC>");

            Assert.AreEqual("RTO<MO,PQ>", name.GetUnqualifiedVersion().ToString());
        }
Beispiel #6
0
        public virtual void TestShouldDetermineUnqualifiedCollectionName()
        {
            Hl7DataTypeName name = Hl7DataTypeName.Create("SET<TS.FULLDATE>");

            Assert.AreEqual("SET<TS>", name.GetUnqualifiedVersion().ToString());
        }
Beispiel #7
0
        public virtual void TestShouldRecognizeQualifiedTypes()
        {
            Hl7DataTypeName name = Hl7DataTypeName.Create("TS.FULLDATE");

            Assert.IsTrue(name.IsQualified(), "TS.FULLDATE");
        }