public string FillReasonForVisit(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo) { string clinicdetais = string.Empty; ptreason = new ReasonForVisitModel(); hl7Body = clinicalDoc.Component.AsStructuredBody; functionalStatus = hl7Body.Component.Append(); hl7III = functionalStatus.Section.TemplateId.Append(); hl7III.Root = ptreason.root; functionalStatus.Section.Code.CodeSystem = ptreason.codeSystem; functionalStatus.Section.Code.Code = ptreason.code; functionalStatus.Section.Code.CodeSystemName = ptreason.codeSystemName; functionalStatus.Section.Code.DisplayName = ptreason.displayName; functionalStatus.Section.Title.Text = ptreason.title; var paragraph = hl7factory.CreateStrucDocParagraph(); if (patientinfo.ptReason != null) { paragraph.Items.Add(Convert.ToString(patientinfo.ptReason.Description)); } else { paragraph.Items.Add("N/A"); } functionalStatus.Section.Text.Items.Add(paragraph); return(clinicalDoc.Xml); }
public void EV_1102_DefaultSerializationDefaultLegacy() { ClinicalDocument document = new ClinicalDocument(); document.Component = new Component2(); document.Component.SetBodyChoice(new StructuredBody()); document.Component.GetBodyChoiceIfStructuredBody().Component.Add(new Component3()); document.Component.GetBodyChoiceIfStructuredBody().Component[0].Section = new Section(); document.Component.GetBodyChoiceIfStructuredBody().Component[0].Section.Entry.Add(new Entry()); document.Component.GetBodyChoiceIfStructuredBody().Component[0].Section.Entry[0].SetClinicalStatement( new ObservationWithConfidentialityCode() { ConfidentialityCode = x_BasicConfidentialityKind.Restricted } ); XmlIts1Formatter formatter = new XmlIts1Formatter(); formatter.GraphAides.Add(new ClinicalDocumentDatatypeFormatter()); formatter.ValidateConformance = false; formatter.Settings = SettingsType.DefaultLegacy; StringWriter sw = new StringWriter(); using (XmlWriter xw = XmlWriter.Create(sw)) { var result = formatter.Graph(xw, document); xw.Flush(); String data = sw.ToString(); Assert.IsNotNull(result.Details.FirstOrDefault(o => o is NotSupportedChoiceResultDetail)); } }
public string FillInformantInfo(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo) { string informantdetais = string.Empty; var informant = clinicalDoc.Informant.Append(); //assignedEntity.Time.AsDateTime = DateTime.Now; //var assignedAuthor = assignedEntity.AssignedAuthor; hl7III = informant.AsAssignedEntity.Id.Append(); hl7III.Init("2.16.840.1.113883.4.6", "KP00017"); IPN AsName = hl7factory.CreatePN(); addressphno = new GenerateAddressPhNo(); addressinfo = new AddressModel();///Fill Clinic Address addressinfo.street = patientinfo.ptClinicInformation.ClinicStreeet; addressinfo.city = patientinfo.ptClinicInformation.ClinicCity; addressinfo.state = patientinfo.ptClinicInformation.ClinicState; addressinfo.country = patientinfo.ptClinicInformation.ClinicCountry; addressinfo.pinCode = patientinfo.ptClinicInformation.ClinicZip.ToString(); informant.AsAssignedEntity.Addr.Add(addressphno.GenerateAddress(addressinfo, hl7factory)); ///END contactinfo = new PhNoModel(); ///FIll Clinic Contact Number contactinfo.telcomUse = "WP"; contactinfo.telcomValue = patientinfo.ptClinicInformation.ClinicPhoneNumber; contactinfo.nullFlavor = "UNK"; informant.AsAssignedEntity.Telecom.Add(addressphno.GeneratePhNo(contactinfo, hl7factory)); ///END AsName = informant.AsAssignedEntity.AssignedPerson.Name.Append(); ///Manage Clinic Name nameinfo = new NameModel(); nameinfo.Createengiven = patientinfo.ptClinicInformation.ClinicName; addressphno.FillName(nameinfo, AsName, hl7factory);///FIll Clinic Name informantdetais = clinicalDoc.Xml; return(informantdetais); }
private void CreateComponent(ProcedureModel ptProcedureModel, ClinicalDocument clinicalDoc, III hl7III) { hl7Body = clinicalDoc.Component.AsStructuredBody; functionalStatus = hl7Body.Component.Append(); hl7III = functionalStatus.Section.TemplateId.Append(); if (ptProcedureModel.root != null) { hl7III.Init(ptProcedureModel.root); } if (ptProcedureModel.code != null) { functionalStatus.Section.Code.Code = ptProcedureModel.code; } if (ptProcedureModel.codeSystem != null) { functionalStatus.Section.Code.CodeSystem = ptProcedureModel.codeSystem; } if (ptProcedureModel.codeSystemName != null) { functionalStatus.Section.Code.CodeSystemName = ptProcedureModel.codeSystemName; } if (ptProcedureModel.displayName != null) { functionalStatus.Section.Code.DisplayName = ptProcedureModel.displayName; } if (ptProcedureModel.title != null) { functionalStatus.Section.Title.Text = ptProcedureModel.title; } }
public void EV_1102_AlwaysCheckForOverridesReflection() { ClinicalDocument document = new ClinicalDocument(); document.Component = new Component2(); document.Component.SetBodyChoice(new StructuredBody()); document.Component.GetBodyChoiceIfStructuredBody().Component.Add(new Component3()); document.Component.GetBodyChoiceIfStructuredBody().Component[0].Section = new Section(); document.Component.GetBodyChoiceIfStructuredBody().Component[0].Section.Entry.Add(new Entry()); document.Component.GetBodyChoiceIfStructuredBody().Component[0].Section.Entry[0].SetClinicalStatement( new ObservationWithConfidentialityCode() { ConfidentialityCode = x_BasicConfidentialityKind.Restricted } ); XmlIts1Formatter formatter = new XmlIts1Formatter(); formatter.GraphAides.Add(new ClinicalDocumentDatatypeFormatter()); formatter.ValidateConformance = false; formatter.Settings = SettingsType.DefaultUniprocessor; formatter.RegisterXSITypeName("POCD_MT000040.Observation", typeof(ObservationWithConfidentialityCode)); formatter.Settings |= SettingsType.AlwaysCheckForOverrides; StringWriter sw = new StringWriter(); using (XmlWriter xw = XmlWriter.Create(sw)) { var result = formatter.Graph(xw, document); xw.Flush(); String data = sw.ToString(); Assert.IsNull(result.Details.FirstOrDefault(o => o is NotSupportedChoiceResultDetail)); } }
public string FillCustodianInfo(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo) { string custodianInfo = string.Empty; var assignedCustodian = clinicalDoc.Custodian.AssignedCustodian.RepresentedCustodianOrganization; hl7III = assignedCustodian.Id.Append(); hl7III.Init("2.16.840.1.113883.4.6"); var CName = hl7factory.CreateON(); CName.Text = patientinfo.ptClinicInformation.ClinicName; assignedCustodian.Name = CName; addressphno = new GenerateAddressPhNo(); addressinfo = new AddressModel();///Fill Clinic Address addressinfo.street = patientinfo.ptClinicInformation.ClinicStreeet; addressinfo.city = patientinfo.ptClinicInformation.ClinicCity; addressinfo.state = patientinfo.ptClinicInformation.ClinicState; addressinfo.country = patientinfo.ptClinicInformation.ClinicCountry; addressinfo.pinCode = patientinfo.ptClinicInformation.ClinicZip.ToString(); GenerateAddress(addressinfo, assignedCustodian, hl7factory); ///END contactinfo = new PhNoModel(); ///FIll Clinic Contact Number contactinfo.telcomUse = "WP"; contactinfo.telcomValue = patientinfo.ptClinicInformation.ClinicPhoneNumber; contactinfo.nullFlavor = "UNK"; GeneratePhNo(contactinfo, assignedCustodian, hl7factory); ///END custodianInfo = clinicalDoc.Xml; return(custodianInfo); }
public void EV_1102_DefaultSerializationDefaultLegacy() { ClinicalDocument document = new ClinicalDocument(); document.Component = new Component2(); document.Component.SetBodyChoice(new StructuredBody()); document.Component.GetBodyChoiceIfStructuredBody().Component.Add(new Component3()); document.Component.GetBodyChoiceIfStructuredBody().Component[0].Section = new Section(); document.Component.GetBodyChoiceIfStructuredBody().Component[0].Section.Entry.Add(new Entry()); document.Component.GetBodyChoiceIfStructuredBody().Component[0].Section.Entry[0].SetClinicalStatement( new ObservationWithConfidentialityCode() { ConfidentialityCode = x_BasicConfidentialityKind.Restricted } ); XmlIts1Formatter formatter = new XmlIts1Formatter(); formatter.GraphAides.Add(new ClinicalDocumentDatatypeFormatter()); formatter.ValidateConformance = false; formatter.Settings = SettingsType.DefaultLegacy; StringWriter sw = new StringWriter(); using (XmlWriter xw = XmlWriter.Create(sw)) { var result = formatter.Graph(xw, document); xw.Flush(); String data = sw.ToString(); Assert.IsNotNull(result.Details.FirstOrDefault(o=>o is NotSupportedChoiceResultDetail)); } }
public void EV_1101_DefaultSerializationLegacy() { String expected = "<?xml version=\"1.0\" encoding=\"utf-16\"?><ClinicalDocument xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" classCode=\"DOCCLIN\" moodCode=\"EVN\" xmlns=\"urn:hl7-org:v3\"><author nullFlavor=\"NI\" xsi:nil=\"true\" /></ClinicalDocument>"; ClinicalDocument document = new ClinicalDocument(); Author a = new Author(); a.Time = DateTime.Now; a.AssignedAuthor = new AssignedAuthor(SET <II> .CreateSET(Guid.NewGuid())); document.Author.Add(a); a.NullFlavor = NullFlavor.NoInformation; XmlIts1Formatter formatter = new XmlIts1Formatter(); formatter.GraphAides.Add(new ClinicalDocumentDatatypeFormatter()); formatter.ValidateConformance = false; formatter.Settings = SettingsType.DefaultLegacy; StringWriter sw = new StringWriter(); using (XmlWriter xw = XmlWriter.Create(sw)) { formatter.Graph(xw, document); xw.Flush(); String data = sw.ToString(); R2SerializationHelper.XmlIsEquivalent(expected, data); } }
public void EV_1101_SuppressXsiNilMultiprocessor() { String expected = "<?xml version=\"1.0\" encoding=\"utf-16\"?><ClinicalDocument xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" classCode=\"DOCCLIN\" moodCode=\"EVN\" xmlns=\"urn:hl7-org:v3\"><author typeCode=\"AUT\" nullFlavor=\"NI\" contextControlCode=\"OP\"><time value=\"20140116103733.292-0500\" /><assignedAuthor classCode=\"ASSIGNED\"><id root=\"2BCF1373-9199-4574-A254-0E7558DE9825\" /></assignedAuthor></author></ClinicalDocument>"; ClinicalDocument document = new ClinicalDocument(); Author a = new Author(); a.Time = (TS)"20140116103733.292-0500"; a.AssignedAuthor = new AssignedAuthor(SET <II> .CreateSET(Guid.Parse("2BCF1373-9199-4574-A254-0E7558DE9825"))); document.Author.Add(a); a.NullFlavor = NullFlavor.NoInformation; XmlIts1Formatter formatter = new XmlIts1Formatter(); formatter.Settings = SettingsType.DefaultMultiprocessor; formatter.Settings |= SettingsType.SuppressXsiNil | SettingsType.SuppressNullEnforcement; formatter.GraphAides.Add(new ClinicalDocumentDatatypeFormatter()); formatter.ValidateConformance = false; StringWriter sw = new StringWriter(); using (XmlWriter xw = XmlWriter.Create(sw)) { var results = formatter.Graph(xw, document); xw.Flush(); String data = sw.ToString(); R2SerializationHelper.XmlIsEquivalent(expected, data); } }
public string FillEncounters(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo) { string clinicdetais = string.Empty; ptEncounter = new EncounterModel(); CreateComponent(ptEncounter, clinicalDoc, hl7III);// Manage Allergy Component FillEncounterContent(patientinfo, hl7III, hl7factory); return(clinicalDoc.Xml); }
public string FillFunctionalStatus(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo) { string clinicdetais = string.Empty; ptFunctionalStatus = new FunctionalStatusModel(); CreateComponent(ptFunctionalStatus, clinicalDoc, hl7III);// Manage Allergy Component FillFunctionalStatusContent(patientinfo, hl7III, hl7factory); return(clinicalDoc.Xml); }
public string FillPatientLabResult(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo) { string clinicdetais = string.Empty; ptLabResultModel = new LabResultModel(); CreateComponent(ptLabResultModel, clinicalDoc, hl7III);// Manage Problem Component FillLabResults(patientinfo, hl7factory, hl7III); return(clinicalDoc.Xml); }
public string FillPatientMedication(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo) { string clinicdetais = string.Empty; ptMedication = new MedicationInformation(); CreateComponent(ptMedication, clinicalDoc, hl7III);// Manage Problem Component FillMedicationContent(patientinfo, hl7factory, hl7III); return(clinicalDoc.Xml); }
static void Main(string[] args) { // We can speed up initial serialization by loading a cached formatter assembly MARC.Everest.Formatters.XML.ITS1.Formatter fmtr = new MARC.Everest.Formatters.XML.ITS1.Formatter(); // If you want to experiment and see the difference in serialization times, try commenting these lines out // and seeing the effect. fmtr.GraphAides.Add(new DatatypeFormatter()); fmtr.ValidateConformance = false; // Create the CDA ClinicalDocument cda = new ClinicalDocument( new II("2.16.840.1.113883.19.4", "c266"), // Create an identifier for the document new CE <String>("33049-3", "2.16.840.1.113883.6.1", "LOINC", null, "Consultation note", null), // Specify the type of document DateTime.Now, // Effective time of the document (now) x_BasicConfidentialityKind.Normal, // Confidentiality code of N = Normal CreateRecordTarget(), // Create a record target, this is good for code reuse CreateAuthor(), // Create the author node CreateCustodian(), // Create custodian node CreateComponent() // Create component Node ) { Title = UserPrompt <ST>("Document Title:") }; Console.Clear(); Console.WriteLine("Here is your CDA:"); // Prepare the output XmlStateWriter xsw = new XmlStateWriter(XmlWriter.Create(Console.OpenStandardOutput(), new XmlWriterSettings() { Indent = true })); DateTime start = DateTime.Now; var result = fmtr.Graph(xsw, cda); xsw.Flush(); Console.WriteLine("Took {0} ms to render", DateTime.Now.Subtract(start).TotalMilliseconds); // We can serialize again to see the learning pattern of Everest for (int i = 2; i < 20; i++) { xsw = new XmlStateWriter(XmlWriter.Create(new MemoryStream(), new XmlWriterSettings() { Indent = true })); start = DateTime.Now; result = fmtr.Graph(xsw, cda); xsw.Flush(); Console.WriteLine("Render #{1} Took {0} ms to render", DateTime.Now.Subtract(start).TotalMilliseconds, i); } Console.ReadKey(); }
public void ClinicalDocumentInheritance() { string expectedXml = @"<ClinicalDocument xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:type=""custom:ClinicalDocument"" classCode=""DOCCLIN"" moodCode=""EVN"" xmlns=""urn:hl7-org:v3"" xmlns:custom=""urn:custom""><custom:element value=""true"" /></ClinicalDocument>"; var document = new ClinicalDocument { Element = true, }; XmlIsEquivalentAndDeserializable(expectedXml, document); }
private IClinicalDocument CreateDocument() { var cd = new ClinicalDocument(); var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("HL7SDK.Test.SampleCDADocument.xml"); stream.Position = 0; cd.Load(stream); cd.Lazy = false; stream.Close(); return(cd); }
public string FillPlanOfCare(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo) { string clinicdetais = string.Empty; ptPlanOfCareModel = new PlanOfCareModel(); CreateComponent(ptPlanOfCareModel, clinicalDoc, hl7III);// Manage Allergy Component FillImmunizationContent(patientinfo, hl7factory, hl7III); if (patientinfo.ptAppointment != null) { FillAppointmentContent(patientinfo, hl7factory, hl7III); } return(clinicalDoc.Xml); }
public string FillComponentInfo(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo) { string documentationOfdetais = string.Empty; hl7III = clinicalDoc.ComponentOf.EncompassingEncounter.Id.Append(); hl7III.Init("2.16.840.1.113883.4.6"); clinicalDoc.ComponentOf.EncompassingEncounter.Code.Code = patientinfo.EncounterCode; clinicalDoc.ComponentOf.EncompassingEncounter.Code.CodeSystem = "2.16.840.1.113883.6.96"; clinicalDoc.ComponentOf.EncompassingEncounter.Code.DisplayName = patientinfo.EncounterDescription; IVXB_TS low = new IVXB_TS(); if (patientinfo.EncounterNoteDate != null && patientinfo.EncounterNoteDate != "") { low.Init(Convert.ToDateTime(patientinfo.EncounterNoteDate)); clinicalDoc.ComponentOf.EncompassingEncounter.EffectiveTime = new IVL_TS().Init(low: low); } else { var times = hl7factory.CreateIVXB_TS(); clinicalDoc.ComponentOf.EncompassingEncounter.EffectiveTime.Init(null, times, times); } hl7III = clinicalDoc.ComponentOf.EncompassingEncounter.ResponsibleParty.AssignedEntity.Id.Append(); hl7III.Init("2.16.840.1.113883.4.6"); var EnName = clinicalDoc.ComponentOf.EncompassingEncounter.ResponsibleParty.AssignedEntity.AssignedPerson.Name.Append(); addressphno = new GenerateAddressPhNo(); nameinfo = new NameModel(); nameinfo.Createenfamily = patientinfo.EncounterStaffName; addressphno.FillName(nameinfo, EnName, hl7factory); var EncounterParticipant = clinicalDoc.ComponentOf.EncompassingEncounter.EncounterParticipant.Append(); hl7III = EncounterParticipant.AssignedEntity.Id.Append(); hl7III.Init("2.16.840.1.113883.4.6"); var ParticipantName = EncounterParticipant.AssignedEntity.AssignedPerson.Name.Append(); addressphno.FillName(nameinfo, ParticipantName, hl7factory); clinicalDoc.ComponentOf.EncompassingEncounter.DischargeDispositionCode.CodeSystem = "2.16.840.1.113883.12.112"; clinicalDoc.ComponentOf.EncompassingEncounter.DischargeDispositionCode.Code = "01"; clinicalDoc.ComponentOf.EncompassingEncounter.DischargeDispositionCode.DisplayName = "Routine Discharge"; clinicalDoc.ComponentOf.EncompassingEncounter.DischargeDispositionCode.CodeSystemName = "HL7 Discharge Disposition"; hl7III = clinicalDoc.ComponentOf.EncompassingEncounter.Location.HealthCareFacility.Id.Append(); hl7III.Init("2.16.540.1.113883.19.2"); documentationOfdetais = clinicalDoc.Xml; return(documentationOfdetais); }
private void InternalLoadDocument(string fileName) { try { Cursor.Current = Cursors.WaitCursor; document = new ClinicalDocument(); document.Load(fileName); document.Lazy = false; InternalResetView(); } finally { Cursor.Current = Cursors.Default; } }
public string FillRecipientInfo(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo) { string recipientInfodetais = string.Empty; var informationRecipient = clinicalDoc.InformationRecipient.Append(); IPN AsName = hl7factory.CreatePN(); AsName = informationRecipient.IntendedRecipient.InformationRecipient.Name.Append();///Manage Clinic Name addressphno = new GenerateAddressPhNo(); nameinfo = new NameModel(); nameinfo.Createengiven = patientinfo.ptClinicInformation.ClinicName; addressphno.FillName(nameinfo, AsName, hl7factory);///FIll Clinic Name var CName = hl7factory.CreateON(); CName.Text = patientinfo.ptClinicInformation.ClinicName; informationRecipient.IntendedRecipient.ReceivedOrganization.Name.Add(CName); recipientInfodetais = clinicalDoc.Xml; return(recipientInfodetais); }
public string FillReasonForReferral(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo) { ptReasonForReferralModel = new ReasonForReferralModel(); CreateComponent(ptReasonForReferralModel, clinicalDoc, hl7III); paragraph = hl7factory.CreateStrucDocParagraph(); if (patientinfo.reasonforTransfer != null && patientinfo.reasonforTransfer != "") { paragraph.Items.Add(patientinfo.reasonforTransfer); } else { paragraph.Items.Add("N/A"); } functionalStatus.Section.Text.Items.Add(paragraph); return(clinicalDoc.Xml); }
public string FillAuthorInfo(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo) { string authordetais = string.Empty; //var targetrole = clinicalDoc.RecordTarget.Append(); var authors = clinicalDoc.Author.Append(); authors.Time.AsDateTime = DateTime.Now; var assignedAuthor = authors.AssignedAuthor; hl7III = assignedAuthor.Id.Append(); hl7III.Init("2.16.840.1.113883.4.6", "999999"); assignedAuthor.Code.Code = "200000000X"; assignedAuthor.Code.CodeSystem = "2.16.840.1.113883.6.101"; assignedAuthor.Code.CodeSystemName = "NUCC"; assignedAuthor.Code.DisplayName = "Allopathic & Osteopathic Physicians"; IPN AsName = hl7factory.CreatePN(); IENXP Ienxn = hl7factory.CreateENXP(); addressphno = new GenerateAddressPhNo(); addressinfo = new AddressModel();///Fill Clinic Address addressinfo.street = patientinfo.ptClinicInformation.ClinicStreeet; addressinfo.city = patientinfo.ptClinicInformation.ClinicCity; addressinfo.state = patientinfo.ptClinicInformation.ClinicState; addressinfo.country = patientinfo.ptClinicInformation.ClinicCountry; addressinfo.pinCode = patientinfo.ptClinicInformation.ClinicZip.ToString(); assignedAuthor.Addr.Add(addressphno.GenerateAddress(addressinfo, hl7factory)); ///END contactinfo = new PhNoModel(); ///FIll Clinic Contact Number contactinfo.telcomUse = "WP"; contactinfo.telcomValue = patientinfo.ptClinicInformation.ClinicPhoneNumber; contactinfo.nullFlavor = "UNK"; assignedAuthor.Telecom.Add(addressphno.GeneratePhNo(contactinfo, hl7factory)); ///END AsName = assignedAuthor.AsPerson.Name.Append(); ///Manage Clinic Name nameinfo = new NameModel(); nameinfo.Createengiven = patientinfo.ptClinicInformation.ClinicName; //nameinfo.Createenfamily = patientinfo.LastName; addressphno.FillName(nameinfo, AsName, hl7factory);///FIll Clinic Name authordetais = clinicalDoc.Xml; return(authordetais); }
public string FillSocialHistory(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo) { string clinicdetais = string.Empty; ptSocialHistory = new SocialHistory(); CreateComponent(ptSocialHistory, clinicalDoc, hl7III);// Manage Problem Component FillSocialHistoryContent(patientinfo.ptSocialHistory, hl7factory); //CreateSocialHistoryBody(patientinfo.ptSocialHistory); // Creating Social History Table Body with Table Structure int idCount = 1; ///''' For Smoking Status '''''' if (patientinfo.ptSocialHistory != null) { GenerateSocialHistoryEntry(patientinfo.ptSocialHistory.Smoker, ref idCount, "Smoking", hl7III, hl7factory); } else { GenerateSocialHistoryEmpty(hl7III, hl7factory); } ///''' For Alcohol Status ''''' if (patientinfo.ptSocialHistory != null) { if (!string.IsNullOrEmpty(patientinfo.ptSocialHistory.Alcohol)) { GenerateSocialHistoryEntry(patientinfo.ptSocialHistory.Alcohol, ref idCount, "Alcohol", hl7III, hl7factory); } if (!string.IsNullOrEmpty(patientinfo.ptSocialHistory.Drugs)) { GenerateSocialHistoryEntry(patientinfo.ptSocialHistory.Drugs, ref idCount, "Drugs", hl7III, hl7factory); } if (!string.IsNullOrEmpty(patientinfo.ptSocialHistory.Tobacoo)) { GenerateSocialHistoryEntry(patientinfo.ptSocialHistory.Tobacoo, ref idCount, "Tobacoo", hl7III, hl7factory); } } return(clinicalDoc.Xml); }
public string FillPatientAllergies(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo) { string clinicdetais = string.Empty; ptallergy = new Allergy(); CreateComponent(ptallergy, clinicalDoc, hl7III);// Manage Allergy Component FillAllergiesContent(patientinfo, hl7factory); if (patientinfo.ptAllergies.Count > 0) { foreach (PatientAllergies item in patientinfo.ptAllergies) { GenerateAllergyEntry(item, hl7III, hl7factory); } } else { GenerateAllergyEntryEmpty(hl7III, hl7factory); } return(clinicalDoc.Xml); }
private void CreateComponent(SocialHistory ptSocialHistory, ClinicalDocument clinicalDoc, III hl7III) { hl7Body = clinicalDoc.Component.AsStructuredBody; functionalStatus = hl7Body.Component.Append(); hl7III = functionalStatus.Section.TemplateId.Append(); if (ptSocialHistory.root != null) { hl7III.Init(ptSocialHistory.root); } //if (dictionary.ContainsKey(Root2)) //{ // hl7III = functionalStatus.Section.TemplateId.Append; // hl7III.Init(dictionary.Item(Root2)); //} if (ptSocialHistory.code != null) { functionalStatus.Section.Code.Code = ptSocialHistory.code; } if (ptSocialHistory.codeSystem != null) { functionalStatus.Section.Code.CodeSystem = ptSocialHistory.codeSystem; } if (ptSocialHistory.codeSystemName != null) { functionalStatus.Section.Code.CodeSystemName = ptSocialHistory.codeSystemName; } if (ptSocialHistory.displayName != null) { functionalStatus.Section.Code.DisplayName = ptSocialHistory.displayName; } if (ptSocialHistory.title != null) { functionalStatus.Section.Title.Text = ptSocialHistory.title; } }
private void ValidateCCD(string fileName) { TextReader reader = null; bool qrda = false; try { XmlRootAttribute xRoot = new XmlRootAttribute(); xRoot.ElementName = "ClinicalDocument"; xRoot.IsNullable = true; xRoot.Namespace = "urn:hl7-org:v3"; XmlSerializer deserializer = new XmlSerializer(typeof(ClinicalDocument), xRoot); reader = new StreamReader(fileName); ClinicalDocument document = (ClinicalDocument)deserializer.Deserialize(reader); qrda = document.title.ToLower().Contains("qrda") || document.title.ToLower().Contains("quality"); Console.WriteLine("File is valid " + (qrda ? "QRDA" : "CCD")); reader.Close(); if (treeTrue.Checked) { BuildXML(qrda ? "QRDA: " + fileName : fileName); } else { coll.Add(String.Format((qrda ? "QRDA " : "") + "{0} is valid!", Helper.noPath(fileName))); } } catch (Exception e) { reader.Close(); Console.WriteLine("File is not valid!"); Console.WriteLine(e.StackTrace); TreeNode exceptionNode = new TreeNode(String.Format((qrda ? "QRDA " : "") + "{0}: {1} - {2}", Helper.noPath(fileName), e.Message, e.InnerException != null ? e.InnerException.Message : "")); exceptionNode.ForeColor = Color.Red; coll.Add(exceptionNode); } }
public string FillPatientProcedure(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo) { string clinicdetais = string.Empty; ptProcedureModel = new ProcedureModel(); CreateComponent(ptProcedureModel, clinicalDoc, hl7III);// Manage Allergy Component //FillProcedureContent(patientinfo, hl7factory); int i = 0; if (patientinfo.ptAllergies.Count > 0) { foreach (ProcedureList item in patientinfo.ptProcedure) { GenerateProcedureEntry(item, (i + 1), patientinfo, hl7III, hl7factory); } } else { GenerateProcedureEntryEmpty(hl7III, hl7factory); } return(clinicalDoc.Xml); }
public string FillVitalSigns(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo) { string clinicdetais = string.Empty; ptvitalSigns = new VitalSignsCode(); CreateComponent(ptvitalSigns, clinicalDoc, hl7III);// Manage Allergy Component FillVitalSignsContent(patientinfo, hl7factory); int count = 1; if (patientinfo.ptAllergies.Count > 0) { foreach (VitalSigns item in patientinfo.ptVitalSigns) { GenerateVitalSignsEntry(item, hl7III, hl7factory, ref count); } } else { GenerateVitalSignsEntryEmpty(hl7III, hl7factory); } return(clinicalDoc.Xml); }
public string FillLegalAuthenticatorInfo(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo) { string legalAuthenticatordetais = string.Empty; var assignedEntity = clinicalDoc.LegalAuthenticator.AssignedEntity; clinicalDoc.LegalAuthenticator.Time.Init(DateTime.Now); clinicalDoc.LegalAuthenticator.SignatureCode.Init("S"); hl7III = assignedEntity.Id.Append(); hl7III.Init("2.16.840.1.113883.4.6", "KP00017"); assignedEntity.Code.Code = "207QA0505X"; assignedEntity.Code.CodeSystem = "2.16.840.1.113883.6.101"; assignedEntity.Code.CodeSystemName = "NUCC"; assignedEntity.Code.DisplayName = "Adult Medicine"; IPN AsName = hl7factory.CreatePN(); addressphno = new GenerateAddressPhNo(); addressinfo = new AddressModel();///Fill Clinic Address addressinfo.street = patientinfo.ptClinicInformation.ClinicStreeet; addressinfo.city = patientinfo.ptClinicInformation.ClinicCity; addressinfo.state = patientinfo.ptClinicInformation.ClinicState; addressinfo.country = patientinfo.ptClinicInformation.ClinicCountry; addressinfo.pinCode = patientinfo.ptClinicInformation.ClinicZip.ToString(); assignedEntity.Addr.Add(addressphno.GenerateAddress(addressinfo, hl7factory)); ///END contactinfo = new PhNoModel(); ///FIll Clinic Contact Number contactinfo.telcomUse = "WP"; contactinfo.telcomValue = patientinfo.ptClinicInformation.ClinicPhoneNumber; contactinfo.nullFlavor = "UNK"; assignedEntity.Telecom.Add(addressphno.GeneratePhNo(contactinfo, hl7factory)); ///END AsName = assignedEntity.AssignedPerson.Name.Append(); ///Manage Clinic Name nameinfo = new NameModel(); nameinfo.Createengiven = patientinfo.ptClinicInformation.ClinicName; addressphno.FillName(nameinfo, AsName, hl7factory);///FIll Clinic Name legalAuthenticatordetais = clinicalDoc.Xml; return(legalAuthenticatordetais); }
public string FillPatientImmunization(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo) { string clinicdetais = string.Empty; ptImmunizationModel = new ImmunizationModel(); CreateComponent(ptImmunizationModel, clinicalDoc, hl7III);// Manage Allergy Component FillImmunizationContent(patientinfo, hl7factory); int i = 0; if (patientinfo.ptImmunization != null) { foreach (Immunization item in patientinfo.ptImmunization) { GenerateImmunizationEntry(item, (i + 1), hl7III, hl7factory); i++; } } else { GenerateImmunizationEntryEmpty(hl7III, hl7factory); } return(clinicalDoc.Xml); }
public string FillPatientProblemes(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo) { string clinicdetais = string.Empty; ptProblem = new PatientProblem(); CreateComponent(ptProblem, clinicalDoc, hl7III);// Manage Problem Component FillProblemContent(patientinfo, hl7factory); int i = 0; if (patientinfo.ptProblemes.Count > 0) { foreach (PatientProblemes item in patientinfo.ptProblemes) { GenerateProblemEntry(item, "#Problem" + (i + 1), Convert.ToDateTime(patientinfo.ptDemographicDetail.DateofBirth), hl7III, hl7factory); i++; } } else { GenerateProblemEntryEmpty("#noproblems1", hl7III, hl7factory); } return(clinicalDoc.Xml); }
private static void MakeCustodianNode(ClinicalDocument ccda) { CustodianOrganization rco = new CustodianOrganization(); rco.Id = new SET<II>(new II("1.1.1.1.1.1.1.1.2")); ON on = new ON(); on.Part.Add(new ENXP("Primo Adult Health")); rco.Name = on; rco.Telecom = new TEL("tel:+1(571)555-0179;ext=222", TelecommunicationAddressUse.WorkPlace); rco.Addr = new AD( new ADXP[]{ new ADXP("1400 Main Street Ste G", AddressPartType.StreetAddressLine), new ADXP("Springfield", AddressPartType.City), new ADXP("VA", AddressPartType.State), new ADXP("22150", AddressPartType.PostalCode), new ADXP("US", AddressPartType.Country)}); AssignedCustodian ac = new AssignedCustodian(); ac.RepresentedCustodianOrganization = rco; Custodian custodian = new Custodian(); custodian.AssignedCustodian = ac; ccda.Custodian = custodian; }
private static void MakeCCDABody(ClinicalDocument ccda) { StructuredBody sb = new StructuredBody(); AddAdvancedDirectivesComponent(sb); AddDischargeInstructionsComponent(sb); AddAllergiesComponent(sb); AddReasonForVisitComponent(sb); AddFamilyHistoryComponent(sb); AddFucntionalAndConginitiveStatusComponent(sb); AddImmunizationComponent(sb); AddInstructionComponent(sb); AddMedicationComponent(sb); AddPlanOfCareComonent(sb); AddProblemListComponent(sb); AddProcedureComponent(sb); AddReasonForReferralComponent(sb); AddResultsSection(sb); AddSocialHistoryComponent(sb); AddVitalSignsComponent(sb); Component2 comp2 = new Component2(ActRelationshipHasComponent.HasComponent, true); comp2.SetBodyChoice(sb); ccda.Component = comp2; }
public void EV_1101_DefaultSerializationLegacy() { String expected = "<?xml version=\"1.0\" encoding=\"utf-16\"?><ClinicalDocument xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" classCode=\"DOCCLIN\" moodCode=\"EVN\" xmlns=\"urn:hl7-org:v3\"><author nullFlavor=\"NI\" xsi:nil=\"true\" /></ClinicalDocument>"; ClinicalDocument document = new ClinicalDocument(); Author a = new Author(); a.Time = DateTime.Now; a.AssignedAuthor = new AssignedAuthor(SET<II>.CreateSET(Guid.NewGuid())); document.Author.Add(a); a.NullFlavor = NullFlavor.NoInformation; XmlIts1Formatter formatter = new XmlIts1Formatter(); formatter.GraphAides.Add(new ClinicalDocumentDatatypeFormatter()); formatter.ValidateConformance = false; formatter.Settings = SettingsType.DefaultLegacy; StringWriter sw = new StringWriter(); using (XmlWriter xw = XmlWriter.Create(sw)) { formatter.Graph(xw, document); xw.Flush(); String data = sw.ToString(); R2SerializationHelper.XmlIsEquivalent(expected, data); } }
public void EV_1101_SuppressXsiNilMultiprocessor() { String expected = "<?xml version=\"1.0\" encoding=\"utf-16\"?><ClinicalDocument xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" classCode=\"DOCCLIN\" moodCode=\"EVN\" xmlns=\"urn:hl7-org:v3\"><author typeCode=\"AUT\" nullFlavor=\"NI\" contextControlCode=\"OP\"><time value=\"20140116103733.292-0500\" /><assignedAuthor classCode=\"ASSIGNED\"><id root=\"2BCF1373-9199-4574-A254-0E7558DE9825\" /></assignedAuthor></author></ClinicalDocument>"; ClinicalDocument document = new ClinicalDocument(); Author a = new Author(); a.Time = (TS)"20140116103733.292-0500"; a.AssignedAuthor = new AssignedAuthor(SET<II>.CreateSET(Guid.Parse("2BCF1373-9199-4574-A254-0E7558DE9825"))); document.Author.Add(a); a.NullFlavor = NullFlavor.NoInformation; XmlIts1Formatter formatter = new XmlIts1Formatter(); formatter.Settings = SettingsType.DefaultMultiprocessor; formatter.Settings |= SettingsType.SuppressXsiNil | SettingsType.SuppressNullEnforcement; formatter.GraphAides.Add(new ClinicalDocumentDatatypeFormatter()); formatter.ValidateConformance = false; StringWriter sw = new StringWriter(); using (XmlWriter xw = XmlWriter.Create(sw)) { var results = formatter.Graph(xw, document); xw.Flush(); String data = sw.ToString(); R2SerializationHelper.XmlIsEquivalent(expected, data); } }
private static void MakeCCDA() { // We can speed up initial serialization by loading a cached formatter assembly MARC.Everest.Formatters.XML.ITS1.Formatter fmtr = new MARC.Everest.Formatters.XML.ITS1.Formatter(); fmtr.GraphAides.Add(new DatatypeFormatter()); fmtr.ValidateConformance = false; ClinicalDocument ccda = new ClinicalDocument(); MakeCCDAHeader(ccda); MakeCCDABody(ccda); Console.Clear(); Console.WriteLine("CCD Generated"); Console.ReadKey(); //ValidateCCDA(ccda); XmlStateWriter xsw = new XmlStateWriter(XmlWriter.Create("D:\\EverestPoC.xml", new XmlWriterSettings() { Indent = true })); DateTime start = DateTime.Now; var result = fmtr.Graph(xsw, ccda); xsw.Flush(); }
public void ClinicalDocumentInheritanceWithCustomTypeTest() { string expectedXml = @"<ClinicalDocument xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:type=""custom:ClinicalDocument"" classCode=""DOCCLIN"" moodCode=""EVN"" xmlns=""urn:hl7-org:v3"" xmlns:custom=""urn:custom""><custom:additionalInformation><custom:element value=""true"" /></custom:additionalInformation></ClinicalDocument>"; var document = new ClinicalDocument { AdditionalInformation = new AdditionalInformation { Element = true, } }; XmlIsEquivalentAndDeserializable(expectedXml, document); }
private static void MakeStaticSection(ClinicalDocument ccda) { //CONF 16791 ccda.RealmCode = new SET<CS<BindingRealm>>(new CS<BindingRealm>(BindingRealm.UnitedStatesOfAmerica)); //CONF 5361 ccda.TypeId = new II( StaticCCDAData["ClinicalDocumentTypeIdRoot"], StaticCCDAData["ClinicalDocumentTypeIdExtension"]); //CONF 5252 ccda.TemplateId = new LIST<II>(); ccda.TemplateId.Add(new II( "2.16.840.1.113883.10.20.22.1.1")); //The next templateId, code and title will differ depending on what type of document is being sent. //Confirms to the document specific requirements ccda.TemplateId.Add(new II( "2.16.840.1.113883.10.20.22.1.2")); //CONF 5363 ccda.Id = new II( "1.1.1.1.1.1.1.1.1", "Test CCDA"); //CONF 5253 "CCD document" ccda.Code = new CE<string>( "34133-9", "2.16.840.1.113883.6.1", "LOINC", null, "Summarization of Episode Note", null); //CONF 5254 ccda.Title = new ST("Primo Adult Health: Health Summary"); //CONF 5256 ccda.EffectiveTime = DateTime.Now; //CONF 5259 ccda.ConfidentialityCode = new CE<x_BasicConfidentialityKind>( x_BasicConfidentialityKind.Normal, "2.16.840.1.113883.5.25"); //CONF 5372 ccda.LanguageCode = new CS<string>("en-US"); }
private static void MakeDataEntererNode(ClinicalDocument ccda) { ccda.DataEnterer = new DataEnterer(); ccda.DataEnterer.AssignedEntity = MakeAssignedEntity("Data Enterer"); }
private static void MakeDocumentationOfNode(ClinicalDocument ccda) { ServiceEvent se = new ServiceEvent(); se.EffectiveTime = new IVL<TS>(new TS(DateTime.Now), new TS(DateTime.Now)); Performer1 performer = new Performer1(); performer.AssignedEntity = MakeAssignedEntity("DocumentationOf"); performer.TypeCode = new CS<x_ServiceEventPerformer>(x_ServiceEventPerformer.PRF); DocumentationOf docOf = new DocumentationOf(); docOf.ServiceEvent = new ServiceEvent(); docOf.ServiceEvent = se; ccda.DocumentationOf = new List<DocumentationOf>(); ccda.DocumentationOf.Add(docOf); }
private static void MakeComponentOfNode(ClinicalDocument ccda) { AssignedEntity ae = MakeAssignedEntity("ComponentOf"); EncompassingEncounter ee = new EncompassingEncounter(); ee.Id = new SET<II>(new II(new Guid())); ee.EffectiveTime = new IVL<TS>(new TS(DateTime.Now), new TS(DateTime.Now)); ee.ResponsibleParty = new ResponsibleParty(); ee.ResponsibleParty.AssignedEntity = ae; Location loc = new Location(); loc.HealthCareFacility = MakeHealthCareFacility(); ee.Location = new Location(); ee.Location = loc; Component1 componentOf = new Component1(); componentOf.EncompassingEncounter = new EncompassingEncounter(); componentOf.EncompassingEncounter = ee; ccda.ComponentOf = new Component1(); ccda.ComponentOf = componentOf; }
private static void MakeAuthorNode(ClinicalDocument ccda) { AssignedAuthor aa = new AssignedAuthor(); //NPI 12345 aa.Id = new SET<II>(new II("2.16.840.1.113883.4.6", "12345")); aa.Code = new CE<string>("207QA0505X", "2.16.840.1.113883.6.101", "NUCC", null, "Adult Medicine", null); aa.Addr = new SET<AD>( new AD( new ADXP[]{ new ADXP("1400 Main Street Ste G", AddressPartType.StreetAddressLine), new ADXP("Springfield", AddressPartType.City), new ADXP("VA", AddressPartType.State), new ADXP("22150", AddressPartType.PostalCode), new ADXP("US", AddressPartType.Country)})); aa.Telecom = new SET<TEL>( new TEL("tel:+1(571)555-0179;ext=221", TelecommunicationAddressUse.WorkPlace)); aa.SetAssignedAuthorChoice(new SET<PN>( new PN( new List<ENXP>{ new ENXP("Raymond",EntityNamePartType.Given), new ENXP("Boccino",EntityNamePartType.Family), new ENXP("MD",EntityNamePartType.Suffix)}))); Author a = new Author(); a.Time = DateTime.Now; a.AssignedAuthor = aa; ccda.Author.Add(a); }
private static void MakeParticipantNode(ClinicalDocument ccda) { Participant1 participant = new Participant1(); participant.TypeCode = new CS<ParticipationType>(ParticipationType.IND); participant.AssociatedEntity = new AssociatedEntity(); participant.AssociatedEntity.ClassCode = new CS<RoleClassAssociative>(RoleClassAssociative.PersonalRelationship); participant.AssociatedEntity.Addr = new SET<AD>( new AD( new ADXP[]{ new ADXP("100 Marshall Lane", AddressPartType.StreetAddressLine), new ADXP("Springfield", AddressPartType.City), new ADXP("VA", AddressPartType.State), new ADXP("22153", AddressPartType.PostalCode), new ADXP("US", AddressPartType.Country)})); participant.AssociatedEntity.Telecom = new SET<TEL>(new TEL("tel:+1(571)555-0179;ext=221")); participant.AssociatedEntity.AssociatedPerson = new Person(); participant.AssociatedEntity.AssociatedPerson.Name = new SET<PN>( new PN( new List<ENXP>{ new ENXP("Kathleen", EntityNamePartType.Given), new ENXP("McReary", EntityNamePartType.Family)})); ccda.Participant = new List<Participant1>(); ccda.Participant.Add(participant); }
private static void MakeRecordTargetNode(ClinicalDocument ccda) { //CONF 5266 - Record Target RecordTarget rt = new RecordTarget(); rt.ContextControlCode = ContextControl.OverridingPropagating; //CONF 5267 MakePatientRoleNode(rt); ccda.RecordTarget.Add(rt); }
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; }
private static void ValidateCCDA(ClinicalDocument ccda) { throw new NotImplementedException(); }
private static void MakeInformationRecipientNode(ClinicalDocument ccda) { IntendedRecipient ir = new IntendedRecipient(); //NPI 23456 ir.Id = new SET<II>(new II( "2.16.840.1.113883.4.6", "23456")); ir.InformationRecipient = new Person(new SET<PN>( new PN( new List<ENXP>{ new ENXP("Bernard",EntityNamePartType.Given), new ENXP("Crane",EntityNamePartType.Family), new ENXP("MD",EntityNamePartType.Suffix)}))); ON on = new ON(); on.Part.Add(new ENXP("Springfield Geriatric Associates")); Organization org = new Organization( null, new SET<ON>(on), new SET<TEL>(new TEL("tel:+1(571)555-0165", TelecommunicationAddressUse.WorkPlace)), new SET<AD>(new AD( new ADXP[]{ new ADXP("202 County Line Rd", AddressPartType.StreetAddressLine), new ADXP("Springfield", AddressPartType.City), new ADXP("VA", AddressPartType.State), new ADXP("22150", AddressPartType.PostalCode), new ADXP("US", AddressPartType.Country)})), new CE<string>("207QG0300X", "2.16.840.1.113883.6.101", "NUCC", null, "Geriatric Medicine", null), null); ir.ReceivedOrganization = org; InformationRecipient infor = new InformationRecipient(); infor.IntendedRecipient = ir; ccda.InformationRecipient = new List<InformationRecipient>(); ccda.InformationRecipient.Add(infor); }
private static void MakeCCDAHeader(ClinicalDocument ccda) { MakeStaticSection(ccda); MakeRecordTargetNode(ccda); MakeAuthorNode(ccda); MakeDataEntererNode(ccda); MakeCustodianNode(ccda); MakeInformationRecipientNode(ccda); MakeLegalAuthenticatorNode(ccda); MakeParticipantNode(ccda); MakeDocumentationOfNode(ccda); MakeComponentOfNode(ccda); }