Example #1
0
        public static bool?ValidateFlavor(string flavor, ANY instance, out IResultDetail[] details)
        {
            // Does this flavor exist?
            string kFormat = string.Format(CultureInfo.InvariantCulture, "{0}.{1}", instance.GetType().FullName, flavor.ToUpper());

            // JF - Makes this much faster
            MethodInfo validatorMi = null;

            if (s_flavorValidation.TryGetValue(kFormat, out validatorMi))
            {
                details = new IResultDetail[0];
                return((bool)validatorMi.Invoke(null, new object[] { instance }));
            }

            details = new IResultDetail[0];

            // Add warning
            if (flavor != instance.GetType().Name)
            {
                details = new IResultDetail[] { new ResultDetail(ResultDetailType.Warning, string.Format(EverestFrameworkContext.CurrentCulture, "Can't find flavor '{0}'", flavor), null, null) }
            }
            ;

            return(null);
        }
 /// <summary>
 /// Add a result detail item
 /// </summary>
 internal void AddResultDetail(IResultDetail detail)
 {
     if (detail != null)
     {
         this.m_details.Add(detail);
     }
 }
Example #3
0
 public ResultController(IResult _IResult, ISubject _ISubject, IUser _IUser, IResultDetail _IResultDetail)
 {
     _Result       = _IResult;
     _Subject      = _ISubject;
     _User         = _IUser;
     _ResultDetail = _IResultDetail;
 }
Example #4
0
        internal static bool GenerateInstance(Type instanceType, Stream outputStream, out IResultDetail[] details)
        {

            string resourceName = String.Format(instanceType.FullName).Replace(".", "");

            var formatter = new MARC.Everest.Formatters.XML.ITS1.XmlIts1Formatter();
            formatter.Settings = MARC.Everest.Formatters.XML.ITS1.SettingsType.DefaultUniprocessor;
            formatter.ValidateConformance = false;
            // Testing pregen
            formatter.GraphAides.Add(new MARC.Everest.Formatters.XML.Datatypes.R1.DatatypeFormatter());
            formatter.BuildCache(Assembly.Load("MARC.Everest.RMIM.CA.R020402").GetTypes());

            IGraphable result = TypeCreator.GetCreator(instanceType).CreateInstance() as IGraphable;

            Trace.WriteLine("Starting Serialization");
            DateTime start = DateTime.Now;
            var gresult = formatter.Graph(outputStream, result);
            Trace.WriteLine(String.Format("            ->{0}", DateTime.Now.Subtract(start).TotalMilliseconds));
            Trace.WriteLine(String.Format("            ->{0} bytes", outputStream.Length));
            List<IResultDetail> dlist = new List<IResultDetail>();
            dlist.AddRange(gresult.Details);
            details = dlist.ToArray();

            return gresult.Code == MARC.Everest.Connectors.ResultCode.Accepted;
        }
Example #5
0
        /// <summary>
        /// Map detail to error code
        /// </summary>
        /// <param name="dtl"></param>
        /// <returns></returns>
        public static string MapErrCode(IResultDetail dtl)
        {
            string errCode = string.Empty;
            string errSys  = "2.16.840.1.113883.5.1100";

            if (dtl is InsufficientRepetitionsResultDetail)
            {
                errCode = "100";
            }
            else if (dtl is MandatoryElementMissingResultDetail)
            {
                errCode = "101";
            }
            else if (dtl is NotImplementedElementResultDetail)
            {
                errCode = "207";
            }
            else if (dtl is RequiredElementMissingResultDetail)
            {
                errCode = "101";
            }
            else if (dtl.Exception is DataException)
            {
                errCode = "207";
            }
            else if (dtl is VocabularyIssueResultDetail)
            {
                errCode = "103";
            }
            else if (dtl is FixedValueMisMatchedResultDetail)
            {
                errCode = "103";
            }
            else if (dtl is FormalConstraintViolationResultDetail)
            {
                errCode = "207";
            }
            else if (dtl.Exception is VersionNotFoundException)
            {
                errCode = "203";
            }
            else if (dtl.Exception is NotImplementedException)
            {
                errCode = "200";
            }
            else if (dtl.Exception is KeyNotFoundException)
            {
                errCode = "204";
            }
            else if (dtl is SecurityException)
            {
                errCode = "901";
            }
            else
            {
                errCode = "207";
            }
            return(errCode);
        }
 /// <summary>
 /// Datatype formatter graph result
 /// </summary>
 internal DatatypeR2FormatterGraphResult(ResultCode code, IResultDetail[] details, bool validateConformance) : this(validateConformance)
 {
     this.Code = code;
     if (details != null)
         this.m_details = new List<IResultDetail>(details);
     else
         this.m_details = new List<IResultDetail>(10);
 }
 /// <summary>
 /// Datatype formatter graph result
 /// </summary>
 internal XmlIts1FormatterGraphResult(ResultCode code, IResultDetail[] details)
 {
     this.Code = code;
     if (details == null)
         this.m_details = new List<IResultDetail>(10);
     else
         this.m_details = new List<IResultDetail>(details);
 }
 /// <summary>
 /// Add a result detail item
 /// </summary>
 public void AddResultDetail(IResultDetail detail)
 {
     if (detail.Type == ResultDetailType.Warning && this.Code < ResultCode.AcceptedNonConformant)
         this.Code = ResultCode.AcceptedNonConformant;
     else if (detail.Type == ResultDetailType.Error && this.Code < ResultCode.Rejected)
         this.Code = ResultCode.Rejected;
     this.m_details.Add(detail);
 }
 /// <summary>
 /// Add a result detail item
 /// </summary>
 public void AddResultDetail(IResultDetail detail)
 {
     if (detail.Type == ResultDetailType.Warning && this.Code < ResultCode.AcceptedNonConformant)
     {
         this.Code = ResultCode.AcceptedNonConformant;
     }
     else if (detail.Type == ResultDetailType.Error && this.Code < ResultCode.Rejected)
     {
         this.Code = ResultCode.Rejected;
     }
     this.m_details.Add(detail);
 }
Example #10
0
        /// <summary>
        /// Grap the object to a stream
        /// </summary>
        public void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result)
        {
            ENXP instance = o as ENXP;

            // Start with part type and code attributes
            ANYFormatter baseFormatter = new ANYFormatter();

            baseFormatter.Graph(s, o, result);

            IResultDetail[] partTypeDetails = new IResultDetail[0];

            if (instance.NullFlavor != null)
            {
                return;
            }

            // Now format our data
            if (instance.Type != null && result.CompatibilityMode != DatatypeFormatterCompatibilityMode.ClinicalDocumentArchitecture)
            {
                s.WriteAttributeString("partType", Util.ToWireFormat(instance.Type));
            }
            if (instance.Qualifier != null && !instance.Qualifier.IsEmpty)
            {
                s.WriteAttributeString("qualifier", Util.ToWireFormat(instance.Qualifier));
            }
            if (instance.Code != null)
            {
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Code", "ADXP", s.ToString()));
            }
            //s.WriteAttributeString("code", instance.Code);
            if (instance.Value != null)
            {
                s.WriteValue(instance.Value);
            }
            if (instance.CodeSystem != null) // Warn if there is no way to represent this in R1
            {
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "CodeSystem", "ENXP", s.ToString()));
            }
            if (instance.CodeSystemVersion != null)
            {
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "CodeSystemVersion", "ENXP", s.ToString()));
            }
        }
Example #11
0
        /// <summary>
        /// Update an ERR
        /// </summary>
        public static int UpdateERR(NHapi.Model.V231.Segment.ERR err, IResultDetail dtl)
        {
            var locale = ApplicationContext.Current.GetService(typeof(ILocalizationService)) as ILocalizationService;

            // Determine the type of acknowledgement

            var errCode = MessageUtil.MapErrCode(dtl);

            var eld = err.GetErrorCodeAndLocation(err.ErrorCodeAndLocationRepetitionsUsed);

            eld.CodeIdentifyingError.Text.Value          = locale.GetString(String.Format("HL7{0}", errCode));
            eld.CodeIdentifyingError.AlternateText.Value = dtl.Message;
            eld.CodeIdentifyingError.Identifier.Value    = errCode;

            if (dtl.Location != null && dtl.Location.Contains("^"))
            {
                var cmp = dtl.Location.Split('^');
                for (int i = 0; i < cmp.Length; i++)
                {
                    var st = eld.SegmentID as NHapi.Model.V231.Datatype.ST;

                    if (string.IsNullOrEmpty(st.Value))
                    {
                        st.Value = cmp[i];
                    }
                    else
                    {
                        var nm = eld.FieldPosition as NHapi.Model.V231.Datatype.NM;

                        if (nm != null)
                        {
                            nm.Value = cmp[i];
                        }
                    }
                }
            }

            return(Int32.Parse(errCode[0].ToString()));
        }
Example #12
0
        /// <summary>
        /// Updates an error segment of a message.
        /// </summary>
        /// <param name="err">The error segment to be updated.</param>
        /// <param name="dtl">The result details.</param>
        /// <returns>Returns the error code.</returns>
        public static int UpdateERR(NHapi.Model.V25.Segment.ERR err, IResultDetail dtl)
        {
            var locale = ApplicationContext.Current.GetService(typeof(ILocalizationService)) as ILocalizationService;

            err.Severity.Value = dtl.Type.ToString()[0].ToString();

            // Determine the type of acknowledgement
            var errCode = MapErrCode(dtl);

            err.HL7ErrorCode.Identifier.Value = errCode;
            err.HL7ErrorCode.Text.Value       = locale?.GetString($"HL7{errCode}");

            if (dtl.Location != null && dtl.Location.Contains("^"))
            {
                var cmp = dtl.Location.Split('^');
                for (int i = 0; i < cmp.Length; i++)
                {
                    var st = err.GetErrorLocation(0).Components[i] as ST;

                    if (st != null)
                    {
                        st.Value = cmp[i];
                    }
                    else
                    {
                        var nm = err.GetErrorLocation(0).Components[i] as NM;

                        if (nm != null)
                        {
                            nm.Value = cmp[i];
                        }
                    }
                }
            }

            err.UserMessage.Value = dtl.Message;

            return(int.Parse(errCode[0].ToString()));
        }
        /// <summary>
        /// Graphs object <paramref name="o"/> onto <paramref name="s"/>
        /// </summary>
        /// <param name="s">The stream to graph to</param>
        /// <param name="o">The object to graph</param>
        /// <returns>A formatter graphing result</returns>
        public IFormatterGraphResult Graph(XmlWriter s, IGraphable o)
        {
            if (o == null)
            {
                return(new DatatypeFormatterGraphResult(this.CompatibilityMode, ResultCode.Accepted, null, this.ValidateConformance));
            }

            Details = new IResultDetail[0];

            try
            {
                IDatatypeFormatter formatter = GetFormatter(o.GetType());

                if (formatter == null)
                {
                    return(new DatatypeFormatterGraphResult(this.CompatibilityMode, ResultCode.NotAvailable, new IResultDetail[] {
                        new NotImplementedResultDetail(ResultDetailType.Error, String.Format("Could not find formatter for '{0}'", o.GetType().FullName), null)
                    }, this.ValidateConformance));
                }

                // Set the host
                formatter.Host = (IXmlStructureFormatter)(this.Host ?? this);

                var result = new DatatypeFormatterGraphResult(this.CompatibilityMode, ResultCode.Accepted, null, this.ValidateConformance);

                formatter.Graph(s, o, result);

                return(result);
            }
            catch (Exception e)
            {
                return(new DatatypeFormatterGraphResult(this.CompatibilityMode, ResultCode.Error, new IResultDetail[] {
                    new ResultDetail(ResultDetailType.Error, e.Message, s.ToString(), e)
                }, this.ValidateConformance));
            }
        }
 /// <summary>
 /// Add a result detail item
 /// </summary>
 internal void AddResultDetail(IResultDetail detail)
 {
     this.m_details.Add(detail);
 }
 private static string FormatDetailRow(IResultDetail detail)
 {
     return string.Format(testDetailRow,
         GetRowClass(detail.Type), detail.Type.ToString(), detail.Name, detail.Description);
 }
 /// <summary>
 /// Add a result detail item
 /// </summary>
 internal void AddResultDetail(IResultDetail detail)
 {
     if (detail != null)
         this.m_details.Add(detail);
 }
Example #17
0
        /// <summary>
        /// Update an ERR
        /// </summary>
        private static int UpdateERR(NHapi.Model.V231.Segment.ERR err, IResultDetail dtl, IServiceProvider context)
        {
            var locale = context.GetService(typeof(ILocalizationService)) as ILocalizationService;



            // Determine the type of acknowledgement
            string errCode = String.Empty;
            string errSys  = "2.16.840.1.113883.5.1100";

            if (dtl is InsufficientRepetitionsResultDetail)
            {
                errCode = "100";
            }
            else if (dtl is MandatoryElementMissingResultDetail)
            {
                errCode = "101";
            }
            else if (dtl is NotImplementedElementResultDetail)
            {
                errCode = "207";
            }
            else if (dtl is RequiredElementMissingResultDetail)
            {
                errCode = "101";
            }
            else if (dtl is PersistenceResultDetail)
            {
                errCode = "207";
            }
            else if (dtl is VocabularyIssueResultDetail)
            {
                errCode = "103";
            }
            else if (dtl is FixedValueMisMatchedResultDetail)
            {
                errCode = "103";
            }
            else if (dtl is UnsupportedProcessingModeResultDetail)
            {
                errCode = "202";
            }
            else if (dtl is UnsupportedResponseModeResultDetail)
            {
                errCode = "207";
            }
            else if (dtl is UnsupportedVersionResultDetail)
            {
                errCode = "203";
            }
            else if (dtl.Exception is NotImplementedException)
            {
                errCode = "200";
            }
            else if (dtl is UnrecognizedTargetDomainResultDetail ||
                     dtl is UnrecognizedPatientDomainResultDetail ||
                     dtl is PatientNotFoundResultDetail)
            {
                errCode = "204";
            }
            else if (dtl is UnrecognizedSenderResultDetail)
            {
                errCode = "901";
            }
            else
            {
                errCode = "207";
            }

            var eld = err.GetErrorCodeAndLocation(err.ErrorCodeAndLocationRepetitionsUsed);

            eld.CodeIdentifyingError.Text.Value          = locale.GetString(String.Format("HL7{0}", errCode));
            eld.CodeIdentifyingError.AlternateText.Value = dtl.Message;
            eld.CodeIdentifyingError.Identifier.Value    = errCode;

            if (dtl.Location != null && dtl.Location.Contains("^"))
            {
                var cmp = dtl.Location.Split('^');
                for (int i = 0; i < cmp.Length; i++)
                {
                    var st = eld.SegmentID as NHapi.Model.V231.Datatype.ST;
                    if (string.IsNullOrEmpty(st.Value))
                    {
                        st.Value = cmp[i];
                    }
                    else
                    {
                        var nm = eld.FieldPosition as NHapi.Model.V231.Datatype.NM;
                        if (nm != null)
                        {
                            nm.Value = cmp[i];
                        }
                    }
                }
            }

            return(Int32.Parse(errCode[0].ToString()));
        }
        /// <summary>
        /// Grap the object to a stream
        /// </summary>
        public void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result)
        {
            ENXP instance = o as ENXP;

            // Start with part type and code attributes
            ANYFormatter baseFormatter = new ANYFormatter();
            baseFormatter.Graph(s, o, result);

            IResultDetail[] partTypeDetails = new IResultDetail[0];

            if (instance.NullFlavor != null)
                return;

            // Now format our data
            if (instance.Type != null && result.CompatibilityMode != DatatypeFormatterCompatibilityMode.ClinicalDocumentArchitecture)
                s.WriteAttributeString("partType", Util.ToWireFormat(instance.Type));
            if (instance.Qualifier != null && !instance.Qualifier.IsEmpty)
                s.WriteAttributeString("qualifier", Util.ToWireFormat(instance.Qualifier));
            if (instance.Code != null)
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Code", "ADXP", s.ToString()));
                //s.WriteAttributeString("code", instance.Code);
            if (instance.Value != null)
                s.WriteValue(instance.Value);
            if (instance.CodeSystem != null) // Warn if there is no way to represent this in R1
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "CodeSystem", "ENXP", s.ToString()));
            if(instance.CodeSystemVersion != null)
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "CodeSystemVersion", "ENXP", s.ToString()));
        }
Example #19
0
        public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result)
        {
            ANY instance = o as ANY;

            IResultDetail[] enumer = new IResultDetail[0], flavor = new IResultDetail[0],
            invalidAttributes = new IResultDetail[0];

            // Now render
            if (instance == null)
            {
                throw new InvalidOperationException("Could not cast object to the ANY data type");
            }

            if (instance.Flavor != null &&
                (instance.NullFlavor == null ||
                 (instance is ICodedSimple && ((NullFlavor)instance.NullFlavor).IsChildConcept(NullFlavor.Other)) ||
                 (instance is IQuantity && ((NullFlavor)instance.NullFlavor).IsChildConcept(NullFlavor.Derived))
                )
                )
            {
                s.WriteAttributeString("flavorId", instance.Flavor);
            }

            if (instance.NullFlavor != null)
            {
                s.WriteAttributeString("nullFlavor", Util.ToWireFormat(instance.NullFlavor));
            }
            else
            {
                // Warn if items can't be represented in R2
                if (instance.ControlActExt != null)
                {
                    s.WriteAttributeString("controlInformationExtension", instance.ControlActExt);
                }
                if (instance.ControlActRoot != null)
                {
                    s.WriteAttributeString("controlInformationRoot", instance.ControlActRoot);
                }
                if (instance.ValidTimeHigh != null && !instance.ValidTimeHigh.IsNull)
                {
                    s.WriteAttributeString("validTimeHigh", instance.ValidTimeHigh.Value);
                }
                if (instance.ValidTimeLow != null && !instance.ValidTimeLow.IsNull)
                {
                    s.WriteAttributeString("validTimeLow", instance.ValidTimeLow.Value);
                }
                if (instance.UpdateMode != null && !instance.UpdateMode.IsNull)
                {
                    s.WriteAttributeString("updateMode", Util.ToWireFormat(instance.UpdateMode));
                }
            }

            string currentElementName = "";

            if (s is MARC.Everest.Xml.XmlStateWriter)
            {
                currentElementName = (s as MARC.Everest.Xml.XmlStateWriter).CurrentPath;
            }

            // Validate
            if (result.ValidateConformance && !instance.Validate())
            {
                foreach (var r in instance.ValidateEx())
                {
                    r.Location = currentElementName;
                    result.AddResultDetail(r);
                }
            }
            //{
            //    result.AddResultDetail(new DatatypeValidationResultDetail(ResultDetailType.Error, o.GetType().Name, currentElementName));
            //}

            // Disabled for test
            // Validate flavor...
            if (result.ValidateConformance && instance.Flavor != null && Util.ValidateFlavor(instance.Flavor.ToUpper(), instance, out flavor) == false)
            {
                result.AddResultDetail(new DatatypeFlavorValidationResultDetail(ResultDetailType.Warning, instance.GetType().Name, instance.Flavor, currentElementName));
                result.AddResultDetail(flavor);
            }
        }
        /// <summary>
        /// Graphs object <paramref name="o"/> onto <paramref name="s"/>
        /// </summary>
        /// <param name="s">The stream to graph to</param>
        /// <param name="o">The object to graph</param>
        /// <returns>A formatter graphing result</returns>
        public IFormatterGraphResult Graph(XmlWriter s, IGraphable o)
        {
            if (o == null)
                return new DatatypeFormatterGraphResult(this.CompatibilityMode, ResultCode.Accepted, null, this.ValidateConformance);

            Details = new IResultDetail[0];

            try
            {
                IDatatypeFormatter formatter = GetFormatter(o.GetType());

                if (formatter == null)
                    return new DatatypeFormatterGraphResult(this.CompatibilityMode, ResultCode.NotAvailable, new IResultDetail[] {
                        new NotImplementedResultDetail(ResultDetailType.Error, String.Format("Could not find formatter for '{0}'", o.GetType().FullName), null)
                    }, this.ValidateConformance);

                // Set the host
                formatter.Host = (IXmlStructureFormatter)(this.Host ?? this);

                var result = new DatatypeFormatterGraphResult(this.CompatibilityMode, ResultCode.Accepted, null, this.ValidateConformance);

                formatter.Graph(s, o, result);

                return result;
            }
            catch (Exception e)
            {
                return new DatatypeFormatterGraphResult(this.CompatibilityMode, ResultCode.Error, new IResultDetail[] {
                    new ResultDetail(ResultDetailType.Error, e.Message, s.ToString(), e)
                }, this.ValidateConformance);
            }
        }
Example #21
0
        /// <summary>
        /// Update err
        /// </summary>
        public static int UpdateERR(NHapi.Model.V25.Segment.ERR err, IResultDetail dtl, IServiceProvider context)
        {
            var locale = context.GetService(typeof(ILocalizationService)) as ILocalizationService;

            err.Severity.Value = dtl.Type.ToString()[0].ToString();

            // Determine the type of acknowledgement
            string errCode = String.Empty;
            string errSys  = "2.16.840.1.113883.5.1100";

            if (dtl is InsufficientRepetitionsResultDetail)
            {
                errCode = "100";
            }
            else if (dtl is MandatoryElementMissingResultDetail)
            {
                errCode = "101";
            }
            else if (dtl is NotImplementedElementResultDetail)
            {
                errCode = "207";
            }
            else if (dtl is RequiredElementMissingResultDetail)
            {
                errCode = "101";
            }
            else if (dtl is PersistenceResultDetail)
            {
                errCode = "207";
            }
            else if (dtl is VocabularyIssueResultDetail)
            {
                errCode = "103";
            }
            else if (dtl is FixedValueMisMatchedResultDetail)
            {
                errCode = "103";
            }
            else if (dtl is UnsupportedProcessingModeResultDetail)
            {
                errCode = "202";
            }
            else if (dtl is UnsupportedResponseModeResultDetail)
            {
                errCode = "207";
            }
            else if (dtl is UnsupportedVersionResultDetail)
            {
                errCode = "203";
            }
            else if (dtl.Exception is NotImplementedException)
            {
                errCode = "200";
            }
            else if (dtl is UnrecognizedTargetDomainResultDetail ||
                     dtl is UnrecognizedPatientDomainResultDetail ||
                     dtl is PatientNotFoundResultDetail)
            {
                errCode = "204";
            }
            else
            {
                errCode = "207";
            }

            err.HL7ErrorCode.Identifier.Value = errCode;
            err.HL7ErrorCode.Text.Value       = locale.GetString(String.Format("HL7{0}", errCode));

            if (dtl.Location != null && dtl.Location.Contains("^"))
            {
                var cmp = dtl.Location.Split('^');
                for (int i = 0; i < cmp.Length; i++)
                {
                    var st = err.GetErrorLocation(0).Components[i] as NHapi.Model.V25.Datatype.ST;
                    if (st != null)
                    {
                        st.Value = cmp[i];
                    }
                    else
                    {
                        var nm = err.GetErrorLocation(0).Components[i] as NHapi.Model.V25.Datatype.NM;
                        if (nm != null)
                        {
                            nm.Value = cmp[i];
                        }
                    }
                }
            }

            // Mesage
            err.UserMessage.Value = dtl.Message;


            return(Int32.Parse(errCode[0].ToString()));
        }
Example #22
0
        public void Graph(XmlWriter s, object o, DatatypeFormatterGraphResult result)
        {
            II instance = o as II;

            // Base graph
            ANYFormatter baseFormatter = new ANYFormatter();
            baseFormatter.Graph(s, o as ANY, result);
            IResultDetail[] useDetails = new IResultDetail[0];

            // Handle II graphing
            if(instance.Root != null) // root
                s.WriteAttributeString("root", instance.Root);
            if (instance.Extension != null) // extension
                s.WriteAttributeString("extension", instance.Extension);
            if (instance.AssigningAuthorityName != null) // assigning authority
                s.WriteAttributeString("assigningAuthorityName", instance.AssigningAuthorityName);

            // NHS Extension : Start
            if (instance.PatientIdStatus != null) // assigning authority
                s.WriteAttributeString("patientIdStatus", instance.PatientIdStatus);
            // NHS Extension : Finish

            if(instance.Displayable != null)
                s.WriteAttributeString("displayable", instance.Displayable.ToString().ToLower());

            // JF - Use is not permitted
            if (instance.Scope != null && instance.Scope.HasValue)
            {
                if (result.CompatibilityMode == DatatypeFormatterCompatibilityMode.Canadian)
                    switch (instance.Scope.Value)
                    {
                        case IdentifierScope.VersionIdentifier:
                            s.WriteAttributeString("use", "VER");
                            break;
                        case IdentifierScope.BusinessIdentifier:
                            s.WriteAttributeString("use", "BUS");
                            break;
                        default:
                            result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "scope", "II", s.ToString()));
                            break;
                    }
                else
                    result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Scope", "II", s.ToString()));
            }

            // Non supported features
            if (instance.IdentifierName != null)
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "IdentifierName", "II", s.ToString()));
            if(instance.Reliability != null)
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Reliability", "II", s.ToString()));
        }
Example #23
0
        public void Graph(XmlWriter s, object o, DatatypeFormatterGraphResult result)
        {
            II instance = o as II;

            // Base graph
            ANYFormatter baseFormatter = new ANYFormatter();

            baseFormatter.Graph(s, o as ANY, result);
            IResultDetail[] useDetails = new IResultDetail[0];

            // Handle II graphing
            if (instance.Root != null) // root
            {
                s.WriteAttributeString("root", instance.Root);
            }
            if (instance.Extension != null) // extension
            {
                s.WriteAttributeString("extension", instance.Extension);
            }
            if (instance.AssigningAuthorityName != null) // assigning authority
            {
                s.WriteAttributeString("assigningAuthorityName", instance.AssigningAuthorityName);
            }

            // NHS Extension : Start
            if (instance.PatientIdStatus != null) // assigning authority
            {
                s.WriteAttributeString("patientIdStatus", instance.PatientIdStatus);
            }
            // NHS Extension : Finish

            if (instance.Displayable != null)
            {
                s.WriteAttributeString("displayable", instance.Displayable.ToString().ToLower());
            }

            // JF - Use is not permitted
            if (instance.Scope != null && instance.Scope.HasValue)
            {
                if (result.CompatibilityMode == DatatypeFormatterCompatibilityMode.Canadian)
                {
                    switch (instance.Scope.Value)
                    {
                    case IdentifierScope.VersionIdentifier:
                        s.WriteAttributeString("use", "VER");
                        break;

                    case IdentifierScope.BusinessIdentifier:
                        s.WriteAttributeString("use", "BUS");
                        break;

                    default:
                        result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "scope", "II", s.ToString()));
                        break;
                    }
                }
                else
                {
                    result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Scope", "II", s.ToString()));
                }
            }

            // Non supported features
            if (instance.IdentifierName != null)
            {
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "IdentifierName", "II", s.ToString()));
            }
            if (instance.Reliability != null)
            {
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Reliability", "II", s.ToString()));
            }
        }
 /// <summary>
 /// Datatype formatter parse result
 /// </summary>
 internal DatatypeFormatterParseResult(DatatypeFormatterCompatibilityMode mode, ResultCode code, IResultDetail[] details, bool validating) :this(mode) 
 {
     this.Code = code;
     this.ValidateConformance = validating;
     if (details != null)
         this.m_details = new List<IResultDetail>(details);
     else
         this.m_details = new List<IResultDetail>(10);
 }