예제 #1
0
        /// <summary>
        /// Validates this CDA Context for a ICDAContextPrescriptionAndDispenseView
        /// </summary>
        /// <param name="path">The path to this object as a string</param>
        /// <param name="messages">the validation messages, these may be added to within this method</param>
        void ICDAContextPrescriptionAndDispenseView.Validate(string path, List <ValidationMessage> messages)
        {
            var vb = new ValidationBuilder(path, messages);

            if (LegalAuthenticator != null)
            {
                LegalAuthenticator.Validate(vb.Path + "LegalAuthenticator", vb.Messages);
            }

            if (InformationRecipients != null)
            {
                for (var x = 0; x < InformationRecipients.Count; x++)
                {
                    InformationRecipients[x].Validate(vb.Path + string.Format("InformationRecipients[{0}]", x), vb.Messages);
                }
            }

            if (vb.ArgumentRequiredCheck("Custodian", Custodian))
            {
                if (Custodian != null)
                {
                    Custodian.Validate(vb.Path + "Custodian", vb.Messages);
                }

                // Check for PAI-O
                if (Custodian.Participant.Organisation != null && Custodian.Participant.Organisation.Identifiers != null)
                {
                    if (!Custodian.Participant.Organisation.Identifiers.Select(identifiers => identifiers.AssigningAuthorityName).Contains(HealthIdentifierType.PAIO.GetAttributeValue <NameAttribute, string>(x => x.Code)))
                    {
                        vb.AddValidationMessage(vb.PathName, null, "At leat one PAI-O Required");
                    }
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Validates this CDA Context
        /// </summary>
        /// <param name="path">The path to this object as a string</param>
        /// <param name="messages">the validation messages, these may be added to within this method</param>
        void ICDAContextEPrescription.Validate(string path, List <ValidationMessage> messages)
        {
            var vb = new ValidationBuilder(path, messages);

            if (LegalAuthenticator != null)
            {
                LegalAuthenticator.ValidateATS(vb.Path + "LegalAuthenticator", vb.Messages);
            }

            if (InformationRecipients != null)
            {
                for (var x = 0; x < InformationRecipients.Count; x++)
                {
                    InformationRecipients[x].Validate(vb.Path + string.Format("InformationRecipients[{0}]", x), vb.Messages);
                }
            }

            if (vb.ArgumentRequiredCheck("Custodian", Custodian))
            {
                if (Custodian != null)
                {
                    Custodian.ValidateATS(vb.Path + "Custodian", vb.Messages);
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Validates this CDA Context
        /// </summary>
        /// <param name="path">The path to this object as a string</param>
        /// <param name="messages">the validation messages, these may be added to within this method</param>
        void ICDAContextMedicareOverview.Validate(string path, List <ValidationMessage> messages)
        {
            var vb = new ValidationBuilder(path, messages);

            if (LegalAuthenticator != null)
            {
                LegalAuthenticator.Validate(vb.Path + "LegalAuthenticator", vb.Messages);
            }

            if (InformationRecipients != null)
            {
                for (var x = 0; x < InformationRecipients.Count; x++)
                {
                    InformationRecipients[x].Validate(vb.Path + string.Format("InformationRecipients[{0}]", x), vb.Messages);
                }
            }

            if (vb.ArgumentRequiredCheck("Custodian", Custodian))
            {
                if (Custodian != null)
                {
                    Custodian.Validate(vb.Path + "Custodian", vb.Messages);
                }

                // Check for PAI-O
                if (Custodian.Participant.Organisation != null && Custodian.Participant.Organisation.Identifiers != null)
                {
                    var foundIdentifier = false;
                    foreach (var identifiers in Custodian.Participant.Organisation.Identifiers)
                    {
                        if (identifiers.AssigningAuthorityName == HealthIdentifierType.PAIO.GetAttributeValue <NameAttribute, string>(x => x.Code))
                        {
                            foundIdentifier = true;
                        }
                    }

                    if (!foundIdentifier)
                    {
                        vb.AddValidationMessage(vb.PathName, null, "At leat one PAI-O Required");
                    }
                }
            }
        }
예제 #4
0
 /// <summary>
 /// Ctor for all elements
 /// </summary>
 public PLClinicalDocument(II id, CE <string> code, ST title, TS effectiveTime, CE <x_BasicConfidentialityKind> confidentialityCode, CS <string> languageCode, II setId, INT versionNumber, TS copyTime, RecordTarget recordTarget, Author author, DataEnterer dataEnterer, Informant12 informant, Custodian custodian, InformationRecipient informationRecipient, LegalAuthenticator legalAuthenticator, Authenticator authenticator, Participant1 participant, InFulfillmentOf inFulfillmentOf, DocumentationOf documentationOf, RelatedDocument relatedDocument, Authorization authorization, Component1 componentOf, Component2 component)
     : base(id, code, title, effectiveTime, confidentialityCode, languageCode, setId, versionNumber, copyTime, recordTarget, author, dataEnterer, informant, custodian, informationRecipient, legalAuthenticator, authenticator, participant, inFulfillmentOf, documentationOf, relatedDocument, authorization, componentOf, component)
 {
     this.PertinentInformation = new List <PertinentInformation>();
 }
예제 #5
0
        private static void MakeLegalAuthenticatorNode(ClinicalDocument ccda)
        {
            LegalAuthenticator la = new LegalAuthenticator();
            la.Time = DateTime.Now;
            la.SignatureCode = new CS<string>("S");
            la.AssignedEntity = MakeAssignedEntity("Legal Authentication");

            ccda.LegalAuthenticator = new LegalAuthenticator();
            ccda.LegalAuthenticator = la;
        }
예제 #6
0
        /// <summary>
        /// Validates a CDA Context document with a parent document
        /// </summary>
        /// <param name="path">The path to this object as a string</param>
        /// <param name="documentType">The parent document type</param>
        /// <param name="messages">the validation messages, these may be added to within this method</param>
        public void ValidateWithParentDocument(string path, CDADocumentType documentType, List <ValidationMessage> messages)
        {
            var vb = new ValidationBuilder(path, messages);

            if (vb.ArgumentRequiredCheck("LegalAuthenticator", LegalAuthenticator))
            {
                LegalAuthenticator.Validate(vb.Path + "LegalAuthenticator", vb.Messages);
            }

            if (vb.ArgumentRequiredCheck("ParentDocuments", ParentDocuments))
            {
                for (var x = 0; x < ParentDocuments.Count; x++)
                {
                    ParentDocuments[x].Validate(vb.Path + string.Format("ParentDocuments[{0}]", x), vb.Messages);

                    if ((ParentDocuments[x].ReleatedDocumentType == ReleatedDocumentType.Transform))
                    {
                        if (ParentDocuments[x].DocumentType.HasValue && ParentDocuments[x].DocumentType != documentType)
                        {
                            vb.AddValidationMessage(vb.PathName, null, string.Format("ParentDocuments of type 'XFRM' must have a document type of {0}", documentType.ToString()));
                        }

                        if (ParentDocuments[x].SetId != null && SetId != null && (SetId.Extension == ParentDocuments[x].SetId.Extension && SetId.Root == ParentDocuments[x].SetId.Root))
                        {
                            vb.AddValidationMessage(vb.PathName, null, "ParentDocuments of type 'XFRM' SHALL contain a new value for setId.");
                        }
                    }
                    else
                    {
                        if (ParentDocuments[x].DocumentType.HasValue && ParentDocuments[x].DocumentType != documentType)
                        {
                            vb.AddValidationMessage(vb.PathName, null, string.Format("ParentDocuments of type 'RPLC' must have a document type of {0}", documentType.ToString()));
                        }

                        if (ParentDocuments[x].SetId != null && SetId != null && (SetId.Extension != ParentDocuments[x].SetId.Extension || SetId.Root != ParentDocuments[x].SetId.Root))
                        {
                            vb.AddValidationMessage(vb.PathName, null, "ParentDocuments of type 'RPLC' the ClinicalDocument/versionNumber SHALL match the setId of the current document");
                        }

                        if (ParentDocuments[x].VersionNumber != null && !Version.IsNullOrEmptyWhitespace() && Version == ParentDocuments[x].VersionNumber)
                        {
                            vb.AddValidationMessage(vb.PathName, null, "ParentDocuments of type 'RPLC' SHALL contain an incremented value of ClinicalDocument/VersionNumber");
                        }
                    }
                }

                if (ParentDocuments.Any() && ParentDocuments.Count > 1)
                {
                    if (ParentDocuments.Count > 2)
                    {
                        vb.AddValidationMessage(vb.PathName, null, "ParentDocument can only have the following combinations 'XFRM', 'XFRM' and 'RPLC'");
                    }

                    if (ParentDocuments.Count == 2)
                    {
                        if (!(ParentDocuments.Any(u => u.ReleatedDocumentType == ReleatedDocumentType.Transform) || ParentDocuments.Any(u => u.ReleatedDocumentType == ReleatedDocumentType.Replace)))
                        {
                            vb.AddValidationMessage(vb.PathName, null, "ParentDocument can only have the following combinations 'XFRM', 'XFRM' and 'RPLC'");
                        }
                    }

                    if (ParentDocuments.Count == 1)
                    {
                        if (!(ParentDocuments.Any(u => u.ReleatedDocumentType == ReleatedDocumentType.Transform)))
                        {
                            vb.AddValidationMessage(vb.PathName, null, "ParentDocument can only have the following combinations 'XFRM', 'XFRM' and 'RPLC'");
                        }
                    }
                }
            }

            if (vb.ArgumentRequiredCheck("Custodian", Custodian))
            {
                if (Custodian != null)
                {
                    Custodian.Validate(vb.Path + "Custodian", vb.Messages);
                }
            }

            vb.ArgumentRequiredCheck("DocumentId", DocumentId);
        }