Exemplo n.º 1
0
        protected virtual IDictionary <string, string> CreateSpecializationTypeAttibutesIfNecessary(FormatContext context)
        {
            IDictionary <string, string> attributes = new Dictionary <string, string>();

            if (context.IsSpecializationType())
            {
                string typeAsString = context.Type;
                AddSpecializationType(attributes, typeAsString);
            }
            return(attributes);
        }
Exemplo n.º 2
0
        protected override string FormatNonNullDataType(FormatContext context, BareANY dataType, int indentLevel)
        {
            UncertainRange <PhysicalQuantity> value = (UncertainRange <PhysicalQuantity>)dataType.BareValue;
            // convert URG to an IVL and use IVL formatter (loses any inclusive info; we'll pull that out later)
            Interval <PhysicalQuantity> convertedInterval = IntervalFactory.CreateFromUncertainRange(value);
            IVLImpl <PQ, Interval <PhysicalQuantity> > convertedHl7Interval = new IVLImpl <PQ, Interval <PhysicalQuantity> >(convertedInterval
                                                                                                                             );
            FormatContext ivlContext = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(context.Type.Replace
                                                                                                                     ("URG", "IVL"), context.IsSpecializationType(), context);
            string xml = this.formatter.Format(ivlContext, convertedHl7Interval, indentLevel);

            xml = ChangeAnyIvlRemnants(xml);
            xml = AddOriginalText(xml, dataType, indentLevel);
            // add in inclusive attributes if necessary
            if (value.LowInclusive != null)
            {
                xml = AddInclusiveAttribute(xml, "low", value.LowInclusive);
            }
            if (value.HighInclusive != null)
            {
                xml = AddInclusiveAttribute(xml, "high", value.HighInclusive);
            }
            return(xml);
        }
Exemplo n.º 3
0
        protected override string FormatNonNullValue(FormatContext context, UncertainRange <PlatformDate> value, int indentLevel)
        {
            // convert URG to an IVL and use IVL formatter
            Interval <PlatformDate> convertedInterval = IntervalFactory.CreateFromUncertainRange(value);
            IVLImpl <TS, Interval <PlatformDate> > convertedHl7Interval = new IVLImpl <TS, Interval <PlatformDate> >(convertedInterval);
            FormatContext ivlContext = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(context.Type.Replace
                                                                                                                     ("URG", "IVL"), context.IsSpecializationType(), context);
            string xml = this.formatter.Format(ivlContext, convertedHl7Interval, indentLevel);

            xml = ChangeAnyIvlRemnants(xml);
            // inclusive attributes not allowed for URG<TS>
            if (value.LowInclusive != null || value.HighInclusive != null)
            {
                context.GetModelToXmlResult().AddHl7Error(new Hl7Error(Hl7ErrorCode.DATA_TYPE_ERROR, "High/Low inclusive fields should not be set; these attributes are not allowed for "
                                                                       + context.Type + " types", context.GetPropertyPath()));
            }
            return(xml);
        }
Exemplo n.º 4
0
        protected override string FormatDenominator(FormatContext context, PhysicalQuantity denominator, int indentLevel)
        {
            string        denominatorType = Hl7DataTypeName.Create(context.Type).GetInnerTypes()[1].ToString();
            FormatContext newContext      = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(denominatorType, context
                                                                                                                      .IsSpecializationType(), Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.MANDATORY, Cardinality.Create("1"), "denominator"
                                                                                                                      , context);

            return(this.pqFormatter.Format(newContext, new PQImpl(denominator), indentLevel));
        }
Exemplo n.º 5
0
        //http://www.hl7.org/v3ballot/html/infrastructure/itsxml/datatypes-its-xml.htm#dtimpl-RTO
        protected override string FormatNumerator(FormatContext context, Money numerator, int indentLevel)
        {
            string        numeratorType = Hl7DataTypeName.Create(context.Type).GetInnerTypes()[0].ToString();
            FormatContext newContext    = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(numeratorType, context
                                                                                                                    .IsSpecializationType(), Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.MANDATORY, Cardinality.Create("1"), "numerator",
                                                                                                                    context);

            return(this.moFormatter.Format(newContext, new MOImpl(numerator), indentLevel));
        }
Exemplo n.º 6
0
 // only checking II constraints for now
 protected virtual FormatContext CreateSubContext(FormatContext context)
 {
     return(new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(context.GetModelToXmlResult(), context.GetPropertyPath
                                                                                          (), context.GetElementName(), GetSubType(context), context.GetDomainType(), context.GetConformanceLevel(), context.GetCardinality
                                                                                          (), context.IsSpecializationType(), context.GetVersion(), context.GetDateTimeZone(), context.GetDateTimeTimeZone(), null
                                                                                      , null, context.IsCda()));
 }
Exemplo n.º 7
0
        private void FormatFrequency(StringBuilder buffer, Int32?repetitions, PhysicalQuantity quantity, int indentLevel, FormatContext
                                     context)
        {
            FormatContext formatContext = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl("INT.NONNEG", context
                                                                                                                    .IsSpecializationType(), Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.MANDATORY, Cardinality.Create("1"), "numerator",
                                                                                                                    context);

            buffer.Append(this.intNonNegPropertyFormatter.Format(formatContext, new INTImpl(repetitions), indentLevel));
            IDictionary <string, string> tempAttributes = GetAttributes(new DateDiff(quantity), context);
            string value = tempAttributes.SafeGet(PqPropertyFormatter.ATTRIBUTE_VALUE);
            string units = tempAttributes.SafeGet(PqPropertyFormatter.ATTRIBUTE_UNIT);
            IDictionary <string, string> attributes = ToStringMap(VALUE, value, UNIT, units);

            context = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl("PQ.TIME", context.IsSpecializationType
                                                                                                    (), Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.MANDATORY, Cardinality.Create("1"), "denominator", context);
            buffer.Append(CreateElement(context, attributes, indentLevel, true, true));
        }
Exemplo n.º 8
0
        private void AppendSk(StringBuilder buffer, Int32?repetitions, Interval <PhysicalQuantity> quantity, int indentLevel, FormatContext
                              context)
        {
            INTImpl       intImpl       = new INTImpl(repetitions);
            FormatContext formatContext = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl("INT.NONNEG", context
                                                                                                                    .IsSpecializationType(), Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.MANDATORY, Cardinality.Create("1"), "numerator",
                                                                                                                    context);

            buffer.Append(this.intNonNegPropertyFormatter.Format(formatContext, intImpl, indentLevel));
            IVLImpl <PQ, Interval <PhysicalQuantity> > ivlImpl = new IVLImpl <PQ, Interval <PhysicalQuantity> >(quantity);

            formatContext = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl("IVL<PQ.BASIC>", context.IsSpecializationType
                                                                                                          (), Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.MANDATORY, Cardinality.Create("1"), "denominator", context);
            buffer.Append(this.ivlPqPropertyFormatter.Format(formatContext, ivlImpl, indentLevel));
        }