public List <CdaObservationModel> ExtractDataElements() { List <CdaObservationModel> returnList = new List <CdaObservationModel>(); if (this.Initialize()) { if (this.documentType.Value == IheDocumentType.APE) { // Education Topic List <POCD_MT000040Procedure> edItems = this.ExtractEducationProcedures(); if (edItems != null) { foreach (var edItem in edItems) { CdaSimpleObservation cdaObs = CdaObservationFactory.CreateObservation(edItem); if ((cdaObs != null) && (cdaObs.Code != null)) { CdaObservationModel tempObs = CdaObservationModel.Create(cdaObs); returnList.Add(tempObs); } } } } else if (this.documentType.Value == IheDocumentType.NDS) { returnList = this.ExtractBabyObservationsFromNds(); } else { List <POCD_MT000040Observation> pocdObsList = this.ExtractObservations(); foreach (var pocdObs in pocdObsList) { // *** Create a simple observation *** CdaSimpleObservation cdaObs; cdaObs = CdaObservationFactory.CreateObservation(pocdObs); // *** Convert to model + add to return *** if ((cdaObs != null) && (cdaObs.Code != null)) { CdaObservationModel tempObs = CdaObservationModel.Create(cdaObs); returnList.Add(tempObs); } } } } return(returnList); }
public static AphpDocument CreateAphpDocument(CdaSource source) { // *** Creates the APHP document *** AphpDocument aphp = new AphpDocument(); // *** Set id *** Guid tempGuid = new Guid(source.DocumentId); aphp.DocumentId = tempGuid.ToString(); // *** Create Record Target Section *** aphp.RecordTarget = CdaSectionFactory.CreateRecordTarget(source.VprData.Demographics); // *** Add provider organization to record target *** aphp.RecordTarget.ProviderOrganization = CdaSectionFactory.CreateProviderOrganization(source.VprData.Demographics, source.ProviderOrganizationPhone); // *** Create Device Author *** // TODO: Skip device author...? //aphp.DeviceAuthor = new CdaDeviceAuthor(); //aphp.DeviceAuthor.AssignedAuthoringDevice.ManufacturerModelName = source.ManufacturerModelName; //aphp.DeviceAuthor.AssignedAuthoringDevice.SoftwareName = source.SoftwareName; // *** Create Author *** aphp.Author = CdaSectionFactory.CreateAuthor(source.VprData); // *** Information Recipient *** aphp.Recipient = new CdaRecipient(); aphp.Recipient.FirstName = source.Options.IntendedRecipientFirstName; aphp.Recipient.LastName = source.Options.IntendedRecipientLastName; aphp.Recipient.Organization = source.Options.IntendedRecipientOrganization; // *** Participants *** aphp.Participants = CdaSectionFactory.CreateParticipants(source.VprData); // *** Custodian *** aphp.Custodian = CdaSectionFactory.CreateCustodian(aphp.RecordTarget.ProviderOrganization); // *** Documentation Of *** aphp.DocumentationOf = CdaSectionFactory.CreateDocumentationOf(); // *** Chief Complaint *** aphp.ChiefComplaint = CdaSectionFactory.CreateChiefComplaintSection(source.Observations); // *** History of Present Illness *** aphp.HistoryOfPresentIllness = CdaSectionFactory.CreatePresentIllnessSection(source.Observations); // *** History of Past Illness *** ValueSet vs; if (source.ValueSets.TryGetValue(ValueSetType.HistoryOfPastIllness, out vs)) { aphp.HistoryOfPastIllness = CdaSectionFactory.CreatePastIllnessSection(source.Observations, (HistoryOfPastIllnessValueSet)vs); } // *** Coded History of Infection *** if (source.ValueSets.TryGetValue(ValueSetType.HistoryOfInfection, out vs)) { aphp.CodedHistoryOfInfection = CdaSectionFactory.CreateHistoryOfInfectionSection(source.Observations, (HistoryOfInfectionValueSet)vs); } // *** Allergies *** aphp.Allergies = CdaSectionFactory.CreateAllergiesSection(source.VprData.Reactions); CdaAllergy latexAllergy = CdaObservationFactory.CreateLatexAllergy(source.Observations); if (latexAllergy != null) { aphp.Allergies.Allergies.Add(latexAllergy); } // *** Pregnancy History *** aphp.PregnancyHistorySection = CdaSectionFactory.CreatePregnancyHistorySection(source.Observations, source.Patient.Pregnant, source.Pregnancies); // *** Coded Social History *** aphp.SocialHistory = CdaSectionFactory.CreateSocialHistorySection(source.Observations); // *** Coded Family Medical History *** if (source.ValueSets.TryGetValue(ValueSetType.AntepartumFamilyHistory, out vs)) { aphp.FamilyMedicalHistory = CdaSectionFactory.CreateFamilyHistorySection(source.Observations, vs); } // *** Review of Systems (+ Menstrual History) *** if (source.ValueSets.TryGetValue(ValueSetType.MenstrualHistory, out vs)) { aphp.ReviewOfSystems = CdaSectionFactory.CreateReviewOfSystemsSection(source.Observations, vs); } // *** Coded Physical Exam *** aphp.PhysicalExam = CdaSectionFactory.CreatePhysicalExamSection(source.Observations); aphp.PhysicalExam.VitalSigns = CdaSectionFactory.CreateVitalsSubSection(source.VprData); return(aphp); }
public static ApsDocument CreateApsDocument(CdaSource cdaSource) { // *** Creates the APS document *** ApsDocument aps = new ApsDocument(); // *** Set id *** Guid tempGuid = new Guid(cdaSource.DocumentId); aps.DocumentId = tempGuid.ToString(); // *** Create Record Target Section *** aps.RecordTarget = CdaSectionFactory.CreateRecordTarget(cdaSource.VprData.Demographics); // *** Add provider organization to record target *** aps.RecordTarget.ProviderOrganization = CdaSectionFactory.CreateProviderOrganization(cdaSource.VprData.Demographics, cdaSource.ProviderOrganizationPhone); // *** Create Author *** aps.Author = CdaSectionFactory.CreateAuthor(cdaSource.VprData); // *** Information Recipient *** aps.Recipient = new CdaRecipient(); aps.Recipient.FirstName = cdaSource.Options.IntendedRecipientFirstName; aps.Recipient.LastName = cdaSource.Options.IntendedRecipientLastName; aps.Recipient.Organization = cdaSource.Options.IntendedRecipientOrganization; // *** Participants *** //aphp.Participants = CreateParticipants(cdaSource.VprData); // *** Custodian *** aps.Custodian = CdaSectionFactory.CreateCustodian(aps.RecordTarget.ProviderOrganization); // *** Documentation Of *** aps.DocumentationOf = CdaSectionFactory.CreateDocumentationOf(); // *** Allergies *** aps.Allergies = CdaSectionFactory.CreateAllergiesSection(cdaSource.VprData.Reactions); CdaAllergy latexAllergy = CdaObservationFactory.CreateLatexAllergy(cdaSource.Observations); if (latexAllergy != null) { aps.Allergies.Allergies.Add(latexAllergy); } // *** Advance Directves *** aps.AdvanceDirectiveSection = CdaSectionFactory.CreateAdvanceDirectivesSection(cdaSource.Observations); // *** Care Plan *** aps.CarePlanSection = CdaSectionFactory.CreateApsCarePlanSection(cdaSource.Observations); // *** Problems *** aps.ProblemsSection = CdaSectionFactory.CreateProblemsSection(cdaSource.Observations, cdaSource.VprData.Problems); // *** Meds *** aps.MedicationsSection = CdaSectionFactory.CreateMedicationSection(cdaSource.VprData.Meds); // *** EDD *** aps.EstimatedDeliveryDatesSection = CdaSectionFactory.CreateEddSection(cdaSource.Observations); // *** Antepartum Visit Summary *** aps.AntepartumVisitSummarySection = CdaSectionFactory.CreateVisitSummarySection(cdaSource.Observations); return(aps); }
private List <CdaObservationModel> ExtractBabyObservationsFromNds() { // *** Extract section observations from the document *** List <CdaObservationModel> returnList = new List <CdaObservationModel>(); int babyNumber = 0; if (this.Initialize()) { // *** Check if we have something to work with *** if (this.PocdDocument != null) { if (this.PocdDocument.component != null) { if (this.PocdDocument.component.Item is POCD_MT000040StructuredBody) { POCD_MT000040StructuredBody body = this.PocdDocument.component.Item as POCD_MT000040StructuredBody; if (body.component != null) { if (body.component.Length > 0) { foreach (var item in body.component) { if (item.section != null) { if (item.section.code != null) { if (item.section.code.code == "57075-4") { if (item.section.component != null) { foreach (var comp in item.section.component) { if (comp.section != null) { if (comp.section.code.code == "10210-3") { if (comp.section.entry != null) { ++babyNumber; List <POCD_MT000040Observation> pocdList = new List <POCD_MT000040Observation>(); foreach (var entry in comp.section.entry) { if (entry.Item != null) { if (entry.Item is POCD_MT000040Observation) { POCD_MT000040Observation pocdObs = entry.Item as POCD_MT000040Observation; pocdList.Add(pocdObs); List <POCD_MT000040Observation> tempList = this.GetSupportingObservationsFromSection(pocdObs); pocdList.AddRange(tempList); } } } foreach (var pocdObs in pocdList) { // *** Create a simple observation *** CdaSimpleObservation cdaObs = CdaObservationFactory.CreateObservation(pocdObs); // *** Convert to model + add to return *** if ((cdaObs != null) && (cdaObs.Code != null)) { CdaObservationModel tempObs = CdaObservationModel.Create(cdaObs); tempObs.BabyNumber = babyNumber; returnList.Add(tempObs); } } } } } } } } } } } } } } } } } return(returnList); }