/// MDHT operation: TBD public bool validateTargetOfEntryRelationship(POCD_MT000040Observation statusObservation) { if (getContainer(statusObservation) is POCD_MT000040EntryRelationship) { POCD_MT000040EntryRelationship entryRelationship = (POCD_MT000040EntryRelationship)getContainer(statusObservation); return(x_ActRelationshipEntryRelationship.REFR == entryRelationship.typeCode); } return(false); }
/// MDHT operation: returns the clinical statement of the given entryRelationship public Object getClinicalStatement(POCD_MT000040EntryRelationship entryRelationship) { if (entryRelationship.act != null) { return(entryRelationship.act); } if (entryRelationship.encounter != null) { return(entryRelationship.encounter); } if (entryRelationship.observation != null) { return(entryRelationship.observation); } if (entryRelationship.observationMedia != null) { return(entryRelationship.observationMedia); } if (entryRelationship.organizer != null) { return(entryRelationship.organizer); } if (entryRelationship.procedure != null) { return(entryRelationship.procedure); } if (entryRelationship.regionOfInterest != null) { return(entryRelationship.regionOfInterest); } if (entryRelationship.substanceAdministration != null) { return(entryRelationship.substanceAdministration); } if (entryRelationship.supply != null) { return(entryRelationship.supply); } return(null); }
public POCD_MT000040Entry ToPocdEntry() { // *** Create allergy section *** POCD_MT000040Entry entry = new POCD_MT000040Entry(); // *** Required Allergies and Intolerances Concern element *** //entry.templateId = new II[] { // new II { root = "1.3.6.1.4.1.19376.1.5.3.1.4.5.3" }, // new II { root = "2.16.840.1.113883.10.20.1.27" }, // new II { root = "1.3.6.1.4.1.19376.1.5.3.1.4.5.1" }, //}; POCD_MT000040Act act = new POCD_MT000040Act(); act.id = new II[] { new II { root = Guid.NewGuid().ToString() } }; act.classCode = x_ActClassDocumentEntryAct.ACT; act.moodCode = x_DocumentActMood.EVN; act.templateId = new II[] { new II { root = "2.16.840.1.113883.10.20.1.27" }, new II { root = "1.3.6.1.4.1.19376.1.5.3.1.4.5.1" }, new II { root = "1.3.6.1.4.1.19376.1.5.3.1.4.5.3" } }; act.code = new CD() { nullFlavor = "NA" }; act.statusCode = GetStatusCode(); List <POCD_MT000040EntryRelationship> entryRelationships = new List <POCD_MT000040EntryRelationship>(); POCD_MT000040EntryRelationship entryRel = new POCD_MT000040EntryRelationship(); entryRel.typeCode = x_ActRelationshipEntryRelationship.SUBJ; entryRel.inversionInd = false; entryRel.inversionIndSpecified = true; POCD_MT000040Observation obs = new POCD_MT000040Observation(); obs.id = new II[] { new II { root = Guid.NewGuid().ToString() } }; obs.classCode = "OBS"; obs.moodCode = x_ActMoodDocumentObservation.EVN; obs.templateId = new II[] { new II() { root = "1.3.6.1.4.1.19376.1.5.3.1.4.5" }, new II() { root = "1.3.6.1.4.1.19376.1.5.3.1.4.6" }, new II() { root = "2.16.840.1.113883.10.20.1.28" } }; obs.negationInd = this.NegationIndicator; obs.negationIndSpecified = true; string intoleranceTypeCode = GetIntoleranceType(); obs.code = new CD() { code = intoleranceTypeCode, codeSystem = "2.16.840.1.113883.5.4", codeSystemName = "ObservationIntoleranceType" }; obs.text = new ED() { Text = new string[] { this.Id } }; if (this.Value == null) { obs.value = new ANY[] { new CD() { originalText = new ED() { Text = new string[] { this.AllergyText } } } } } ; else { obs.value = new ANY[] { this.Value.ToCD() } }; obs.participant = new POCD_MT000040Participant2[] { new POCD_MT000040Participant2() { typeCode = "CSM", participantRole = new POCD_MT000040ParticipantRole() { classCode = "MANU", Item = new POCD_MT000040PlayingEntity() { classCode = "MMAT", code = new CE() { code = this.Id, codeSystemName = CdaCode.VhaSystemName, codeSystem = CdaCode.VhaSystemId, originalText = new ED() { reference = new TEL() { value = this.Substance } } } } } } }; if (this.EffectiveTime != null) { act.effectiveTime = this.EffectiveTime.ToIvlTs(); obs.effectiveTime = act.effectiveTime; } obs.statusCode = new CS() { code = "completed" }; // TODO: Optional entry relationships for reactions // TODO: Optional entry relationships for severity entryRel.Item = obs; entryRelationships.Add(entryRel); // *** Add entry relationships *** act.entryRelationship = entryRelationships.ToArray(); // ** Add act *** entry.Item = act; return(entry); }
public POCD_MT000040Observation ToPocd() { POCD_MT000040Observation returnObservation = new POCD_MT000040Observation(); // *** Elements that are the same for all *** returnObservation.classCode = "OBS"; returnObservation.moodCode = this.Mood; returnObservation.templateId = this.TemplateIds.ToPocd(); // *** Actual data from observation *** if (this.NegationIndicator) { returnObservation.negationInd = this.NegationIndicator; returnObservation.negationIndSpecified = true; } returnObservation.id = new II[] { new II() { root = this.Id } }; returnObservation.code = this.Code.ToCE(); returnObservation.text = new ED() { reference = new TEL() { value = string.Format("#{0}", this.ReferenceId) } }; returnObservation.statusCode = new CS() { code = this.Status.ToString() }; returnObservation.effectiveTime = this.EffectiveTime.ToIvlTs(); //new IVL_TS() { value = this.EffectiveTime.ToString(RawCdaDocument.CdaDateFormat) }; returnObservation.value = this.BaseValue; // *** Supporting Observations *** if (this.SupportingObservations != null) { if (this.SupportingObservations.Count > 0) { List <POCD_MT000040EntryRelationship> relList = new List <POCD_MT000040EntryRelationship>(); foreach (var item in this.SupportingObservations) { POCD_MT000040EntryRelationship rel = new POCD_MT000040EntryRelationship(); rel.typeCode = x_ActRelationshipEntryRelationship.SPRT; rel.Item = item.ToPocd(); relList.Add(rel); } returnObservation.entryRelationship = relList.ToArray(); } } if (this.Author != null) { returnObservation.author = new POCD_MT000040Author[] { this.Author.ToPocdAuthor() } } ; if (this.ReferenceRange != null) { returnObservation.referenceRange = new POCD_MT000040ReferenceRange[] { this.ReferenceRange.ToPocd() } } ; if (!string.IsNullOrWhiteSpace(this.InterpretationCode)) { returnObservation.interpretationCode = new CE[] { new CE { code = this.InterpretationCode, codeSystem = "2.16.840.1.113883.5.83", codeSystemName = "ObservationInterpretation" } } } ; return(returnObservation); } } }
public List <POCD_MT000040Entry> ToPocdEntryList() { List <POCD_MT000040Entry> entryList = new List <POCD_MT000040Entry>(); if (this.Observations != null) { foreach (CdaCodeObservation cdaObservation in this.Observations) { // *** Create the entry *** POCD_MT000040Entry tempEntry = new POCD_MT000040Entry(); // *** Create an act *** POCD_MT000040Act act = new POCD_MT000040Act(); act.id = new II[] { new II { root = Guid.NewGuid().ToString() } }; act.classCode = x_ActClassDocumentEntryAct.ACT; act.moodCode = x_DocumentActMood.EVN; // *** Add template ids for this act *** CdaTemplateIdList templateIdList = new CdaTemplateIdList( "1.3.6.1.4.1.19376.1.5.3.1.4.5.2", "1.3.6.1.4.1.19376.1.5.3.1.4.5.1", "2.16.840.1.113883.10.20.1.27"); act.templateId = templateIdList.ToPocd(); // *** No code here *** act.code = new CD() { nullFlavor = "NA" }; // *** The concern is active, even though the problem itself may be resolved or inactive *** act.statusCode = new CS() { code = "active" }; // *** This concern uses the observation date/time *** //CdaEffectiveTime effTime = new CdaEffectiveTime() { Low = cdaObservation.EffectiveTime }; //act.effectiveTime = effTime.ToIvlTs(); act.effectiveTime = cdaObservation.EffectiveTime.ToIvlTs(); // *** Create entry relationship *** List <POCD_MT000040EntryRelationship> entryRelationships = new List <POCD_MT000040EntryRelationship>(); POCD_MT000040EntryRelationship tempEntryRelationship = new POCD_MT000040EntryRelationship(); tempEntryRelationship.typeCode = x_ActRelationshipEntryRelationship.SUBJ; tempEntryRelationship.inversionInd = false; tempEntryRelationship.inversionIndSpecified = true; // *** Create pocd observation *** POCD_MT000040Observation observation = cdaObservation.ToPocd(); // *** Add the observation to the entry relationship *** tempEntryRelationship.Item = observation; // *** Add the entry relationship to the list *** entryRelationships.Add(tempEntryRelationship); // *** Add entry relationships to the act *** act.entryRelationship = entryRelationships.ToArray(); // *** Add act to entry *** tempEntry.Item = act; // *** Add entry to list *** entryList.Add(tempEntry); } } return(entryList); }