public static List <AllergyAdverseEvent> GetAllergyAdverseEvents(this POCD_MT000040ClinicalDocument cda, Client client) { var structuredBody = cda?.component?.Item as POCD_MT000040StructuredBody; return(structuredBody?.component?.FirstOrDefault(c => c.section?.code?.code == LoincConstants.ALLERGIES) ?.section?.GetAllergyAdverseEventsFromComponentSection(client)); }
public static List <DiagnosisProblem> GetDiagnosisProblems(this POCD_MT000040ClinicalDocument cda, Client client) { var structuredBody = cda?.component?.Item as POCD_MT000040StructuredBody; return(structuredBody?.component?.FirstOrDefault(c => c.section?.code?.code == LoincConstants.PROBLEMLIST) ?.section?.GetDiagnosisProblemsFromComponentSection(client)); }
public RawAplDocument ToRawDocument() { RawAplDocument returnDoc = new RawAplDocument(); // *** Get base type *** POCD_MT000040ClinicalDocument arg = returnDoc as POCD_MT000040ClinicalDocument; // *** Populate from base *** arg = this.AddRawDocumentData(arg); // *** This is the list of body sections List <POCD_MT000040Component3> components = new List <POCD_MT000040Component3>(); // *** After all sections are added, add as array *** POCD_MT000040StructuredBody body = arg.component.Item as POCD_MT000040StructuredBody; // *** Add existing *** components.AddRange(body.component); // *** Add lab results *** foreach (var section in this.Sections) { POCD_MT000040Component3 labResults = section.ToPocdComponent(); if (labResults != null) { components.Add(labResults); } } body.component = components.ToArray(); return(returnDoc); }
public RawApeDocument ToRawDocument() { RawApeDocument returnDoc = new RawApeDocument(); // *** Get base type *** POCD_MT000040ClinicalDocument arg = returnDoc as POCD_MT000040ClinicalDocument; // *** Populate from base *** arg = this.AddRawDocumentData(arg); // *** This is the list of body sections List <POCD_MT000040Component3> components = new List <POCD_MT000040Component3>(); // *** After all sections are added, add as array *** POCD_MT000040StructuredBody body = arg.component.Item as POCD_MT000040StructuredBody; // *** Add existing *** components.AddRange(body.component); // *** Add patient education *** POCD_MT000040Component3 patientEducation = this.PatientEducationSection.ToPocdComponent(); if (patientEducation != null) { components.Add(patientEducation); } body.component = components.ToArray(); return(returnDoc); }
public static List <Encounter> GetEncounters(this POCD_MT000040ClinicalDocument cda, Client client) { var structuredBody = cda?.component?.Item as POCD_MT000040StructuredBody; return(structuredBody?.component?.FirstOrDefault(c => c.section?.code?.code == LoincConstants.ENCOUNTERS) ?.section?.GetEncountersFromComponentSection(client)); }
private string ExtractRecipient(POCD_MT000040ClinicalDocument doc) { // *** Gets the recipient string from a clinical doc *** string returnValue = ""; // *** Create a working recipient *** CdaRecipient tempRecipient = new CdaRecipient(); // *** Check for existence and drill down *** if (doc.informationRecipient != null) { if (doc.informationRecipient.Length > 0) { if (doc.informationRecipient[0].intendedRecipient != null) { // *** Organization*** if (doc.informationRecipient[0].intendedRecipient.receivedOrganization != null) { if (doc.informationRecipient[0].intendedRecipient.receivedOrganization.name != null) { if (doc.informationRecipient[0].intendedRecipient.receivedOrganization.name.Length > 0) { if (doc.informationRecipient[0].intendedRecipient.receivedOrganization.name[0].Text != null) { tempRecipient.Organization = doc.informationRecipient[0].intendedRecipient.receivedOrganization.name[0].Text[0]; } } } } // *** Person Name *** if (doc.informationRecipient[0].intendedRecipient.informationRecipient != null) { if (doc.informationRecipient[0].intendedRecipient.informationRecipient.name != null) { string[] names = GetName(doc.informationRecipient[0].intendedRecipient.informationRecipient.name); tempRecipient.FirstName = names[0]; tempRecipient.LastName = names[1]; } } // *** Set result *** returnValue = tempRecipient.ToString(); } } } return(returnValue); }
public RawXdriDocument ToRawDocument() { RawXdriDocument returnDoc = new RawXdriDocument(); // *** Get base type *** POCD_MT000040ClinicalDocument arg = returnDoc as POCD_MT000040ClinicalDocument; // *** Populate from base *** arg = this.AddRawDocumentData(arg); // *** Add image report *** arg.component = this.ImageReport.ToPocdComponent(); return(returnDoc); }
public static List <Medication> GetMedications(this POCD_MT000040ClinicalDocument cda, Client client) { var allergyAdverseEvents = cda.GetAllergyAdverseEvents(client); var encounters = cda.GetEncounters(client); var dischargeDateRange = (from encounter in encounters where !string.IsNullOrWhiteSpace(encounter.DischargeDisposition?.Value) select encounter.VisitDateRange).FirstOrDefault(); var structuredBody = cda?.component?.Item as POCD_MT000040StructuredBody; return(structuredBody?.component?.FirstOrDefault(c => c.section?.code?.code == LoincConstants.MEDICATIONS) ?.section?.GetMedicationsFromComponentSection(client, allergyAdverseEvents, dischargeDateRange)); }
private POCD_MT000040ClinicalDocument DeserializeContent(string content) { POCD_MT000040ClinicalDocument returnDocument = null; // *** Create a generic CDA serializer *** XmlSerializer serializer = new XmlSerializer(typeof(POCD_MT000040ClinicalDocument)); // *** Create an xml reader *** using (XmlReader xmlReader = XmlReader.Create(new StringReader(content))) { // *** Check if it can deserialize *** if (serializer.CanDeserialize(xmlReader)) { // *** Deserialize *** returnDocument = (POCD_MT000040ClinicalDocument)serializer.Deserialize(xmlReader); } } return(returnDocument); }
/// MDHT operation: returns all sections public List <POCD_MT000040Section> getAllSections(POCD_MT000040ClinicalDocument clinicalDocument) { List <POCD_MT000040Section> allSections = new List <POCD_MT000040Section>(); POCD_MT000040Component2 component2 = clinicalDocument.component; if (component2 != null) { POCD_MT000040StructuredBody structuredBody = component2.structuredBody; if (structuredBody != null) { foreach (POCD_MT000040Component3 component3 in structuredBody.component) { POCD_MT000040Section section = component3.section; if (section != null) { allSections.AddRange(getSections(section)); } } } } return(allSections); }
public RawApsDocument ToRawDocument() { RawApsDocument returnDoc = new RawApsDocument(); // *** Get base type *** POCD_MT000040ClinicalDocument arg = returnDoc as POCD_MT000040ClinicalDocument; // *** Populate from base *** arg = this.AddRawDocumentData(arg); // *** This is the list of body sections List <POCD_MT000040Component3> components = new List <POCD_MT000040Component3>(); // *** After all sections are added, add as array *** POCD_MT000040StructuredBody body = arg.component.Item as POCD_MT000040StructuredBody; // *** Add existing *** components.AddRange(body.component); // *** Add advance directive *** POCD_MT000040Component3 advanceDirective = this.AdvanceDirectiveSection.ToPocdComponent(); if (advanceDirective != null) { components.Add(advanceDirective); } // *** Add care plan *** POCD_MT000040Component3 carePlan = this.CarePlanSection.ToPocdComponent(); if (carePlan != null) { components.Add(carePlan); } // *** Add problems *** POCD_MT000040Component3 problems = this.ProblemsSection.ToPocdComponent(); if (problems != null) { components.Add(problems); } // *** Add medications *** POCD_MT000040Component3 meds = this.MedicationsSection.ToPocdComponent(); if (meds != null) { components.Add(meds); } // *** Add edd *** POCD_MT000040Component3 edd = this.EstimatedDeliveryDatesSection.ToPocdComponent(); if (edd != null) { components.Add(edd); } // *** Add antepartum visit summary *** POCD_MT000040Component3 visit = this.AntepartumVisitSummarySection.ToPocdComponent(); if (visit != null) { components.Add(visit); } body.component = components.ToArray(); return(returnDoc); }
public RawAphpDocument ToRawDocument() { // *** Converts this object to a raw APHP document *** RawAphpDocument returnDoc = new RawAphpDocument(); // *** Get base type *** POCD_MT000040ClinicalDocument arg = returnDoc as POCD_MT000040ClinicalDocument; // *** Populate from base *** arg = this.AddRawDocumentData(arg); // *** This is the list of body sections List <POCD_MT000040Component3> components = new List <POCD_MT000040Component3>(); // *** After all sections are added, add as array *** POCD_MT000040StructuredBody body = arg.component.Item as POCD_MT000040StructuredBody; // *** Add existing *** components.AddRange(body.component); // *** Add chief complaint *** POCD_MT000040Component3 chiefComplaint = this.ChiefComplaint.ToPocdComponent(); if (chiefComplaint != null) { components.Add(chiefComplaint); } // *** Add history of present illness *** POCD_MT000040Component3 presentIllness = this.HistoryOfPresentIllness.ToPocdComponent(); if (presentIllness != null) { components.Add(presentIllness); } // *** Add history of past illness *** POCD_MT000040Component3 pastIllness = this.HistoryOfPastIllness.ToPocdComponent(); if (presentIllness != null) { components.Add(pastIllness); } // *** Add coded history of infection *** POCD_MT000040Component3 infection = this.CodedHistoryOfInfection.ToPocdComponent(); if (infection != null) { components.Add(infection); } // *** Add pregnancy history *** POCD_MT000040Component3 pregHist = this.PregnancyHistorySection.ToPocdComponent(); if (pregHist != null) { components.Add(pregHist); } // *** Add coded social history *** POCD_MT000040Component3 socialHistory = this.SocialHistory.ToPocdComponent(); if (socialHistory != null) { components.Add(socialHistory); } // *** Add coded family medical history *** POCD_MT000040Component3 familyMedicalHistory = this.FamilyMedicalHistory.ToPocdComponent(); if (familyMedicalHistory != null) { components.Add(familyMedicalHistory); } // *** Add review of systems *** POCD_MT000040Component3 reviewOfSystems = this.ReviewOfSystems.ToPocdComponent(); if (reviewOfSystems != null) { components.Add(reviewOfSystems); } // *** Add coded physical exam *** POCD_MT000040Component3 physicalExam = this.PhysicalExam.ToPocdComponent(); if (physicalExam != null) { components.Add(physicalExam); } body.component = components.ToArray(); return(returnDoc); }
public RawPpvsDocument ToRawDocument() { RawPpvsDocument returnDoc = new RawPpvsDocument(); // *** Get base type *** POCD_MT000040ClinicalDocument arg = returnDoc as POCD_MT000040ClinicalDocument; // *** Populate from base *** arg = this.AddRawDocumentData(arg); // *** This is the list of body sections List <POCD_MT000040Component3> components = new List <POCD_MT000040Component3>(); // *** After all sections are added, add as array *** POCD_MT000040StructuredBody body = arg.component.Item as POCD_MT000040StructuredBody; // *** Add existing *** components.AddRange(body.component); // *** Add Labor & Delivery Events *** POCD_MT000040Component3 laborDelivery = this.LaborDeliveryEvents.ToPocdComponent(); if (laborDelivery != null) { components.Add(laborDelivery); } // *** Add PP Hosp Tx *** POCD_MT000040Component3 ppHospTx = this.PostpartumHospitalizationTreatment.ToPocdComponent(); if (ppHospTx != null) { components.Add(ppHospTx); } // *** Add care plan *** POCD_MT000040Component3 carePlan = this.CarePlanSection.ToPocdComponent(); if (carePlan != null) { components.Add(carePlan); } // *** Add problems *** POCD_MT000040Component3 problems = this.ProblemsSection.ToPocdComponent(); if (problems != null) { components.Add(problems); } // *** Add history of present illness *** POCD_MT000040Component3 presentIllness = this.HistoryOfPresentIllness.ToPocdComponent(); if (presentIllness != null) { components.Add(presentIllness); } // *** Add coded social history *** POCD_MT000040Component3 socialHistory = this.SocialHistory.ToPocdComponent(); if (socialHistory != null) { components.Add(socialHistory); } // *** Add coded physical exam *** POCD_MT000040Component3 physicalExam = this.PhysicalExam.ToPocdComponent(); if (physicalExam != null) { components.Add(physicalExam); } // *** Add medications *** POCD_MT000040Component3 meds = this.MedicationsSection.ToPocdComponent(); if (meds != null) { components.Add(meds); } // *** Add Newborn Status *** if (this.NewbornStatusSections.Count > 0) { foreach (var item in this.NewbornStatusSections.Values) { POCD_MT000040Component3 stat = item.ToPocdComponent(); components.Add(stat); } } // *** Add Newborn Delivery Info *** if (this.NewbornDeliveryInfoSections.Count > 0) { foreach (var item in this.NewbornDeliveryInfoSections.Values) { POCD_MT000040Component3 stat = item.ToPocdComponent(); components.Add(stat); } } // *** Add Newborn Care Plan *** if (this.NewbornCarePlanSections.Count > 0) { foreach (var item in this.NewbornCarePlanSections.Values) { POCD_MT000040Component3 stat = item.ToPocdComponent(); components.Add(stat); } } body.component = components.ToArray(); return(returnDoc); }
//public abstract string ToCdaXml(); protected POCD_MT000040ClinicalDocument AddRawDocumentData(POCD_MT000040ClinicalDocument rawDoc) { // *** Set the realm to US *** //rawDoc.realmCode = new List<CS>(); //rawDoc.realmCode.Add(new CS() { code = "US" }); // *** All documents will have this type *** rawDoc.typeId = new POCD_MT000040InfrastructureRoottypeId() { root = "2.16.840.1.113883.1.3", extension = "POCD_HD000040" }; // *** Date/Time of Creation *** //<effectiveTime value='20000407130000+0500'/> rawDoc.effectiveTime = new TS() { value = DateTime.Now.ToString(RawCdaDocument.CdaDateFormat) }; // *** Confidentiality *** //<confidentialityCode code='N' codeSystem='2.16.840.1.113883.5.25'/> rawDoc.confidentialityCode = new CE() { code = "N", codeSystem = "2.16.840.1.113883.5.25" }; // *** Language *** //<languageCode code='en-US'/> rawDoc.languageCode = new CS() { code = "en-US" }; // *** Set id *** rawDoc.id = new II() { root = this.DocumentId }; // *** Record Target *** POCD_MT000040RecordTarget rt = this.RecordTarget.ToPocdRecordTarget(); rawDoc.recordTarget = new POCD_MT000040RecordTarget[] { rt }; // *** Information Recipient *** rawDoc.informationRecipient = this.Recipient.ToPocdRecipient(); // *** Participants *** rawDoc.participant = this.Participants.ToPocdParticpantArray(); // *** Authors *** List <POCD_MT000040Author> authorList = new List <POCD_MT000040Author>(); // *** Device Author *** if (!this.DeviceAuthor.IsEmpty) { POCD_MT000040Author pocdDevAuthor = this.DeviceAuthor.ToPocdAuthor(); authorList.Add(pocdDevAuthor); } // *** Author - Current User *** POCD_MT000040Author pocdAuthor = this.Author.ToPocdAuthor(); authorList.Add(pocdAuthor); rawDoc.author = authorList.ToArray(); // *** Custodian *** rawDoc.custodian = this.Custodian.ToPocdCustodian(); // *** Documentation Of *** rawDoc.documentationOf = new POCD_MT000040DocumentationOf[] { this.DocumentationOf.ToPocdDocumentationOf() }; // *** Document Body *** rawDoc.component = new POCD_MT000040Component2(); POCD_MT000040StructuredBody body = new POCD_MT000040StructuredBody(); // *** Create list of component/sections *** List <POCD_MT000040Component3> componentList = new List <POCD_MT000040Component3>(); // *** Add allergy section *** POCD_MT000040Component3 allergySection = this.Allergies.ToPocdComponent(); if (allergySection != null) { componentList.Add(allergySection); } // TODO: Add additional sections here... // *** Add the sections/component to body *** body.component = componentList.ToArray(); // *** Add body *** rawDoc.component.Item = body; return(rawDoc); }
public static Client GetClient(this POCD_MT000040ClinicalDocument cda) { return(cda?.recordTarget?.FirstOrDefault()?.patientRole?.GetClientFromPatientRole()); }