private void PopulateConceptFields(ImportValueSetMember importMember) { string codeSystemXpath = string.Format("/mif:vocabularyModel/mif:codeSystem[@codeSystemId='{0}']", importMember.CodeSystemOid); XmlNode codeSystemNode = this.sourceDoc.SelectSingleNode(codeSystemXpath, this.nsManager); if (codeSystemNode == null) { return; } string conceptXpath = string.Format("mif:releasedVersion/mif:concept[mif:code/@code='{0}']", importMember.Code); XmlNode conceptNode = codeSystemNode.SelectSingleNode(conceptXpath, this.nsManager); if (conceptNode == null) { return; } XmlNode codeNode = conceptNode.SelectSingleNode("mif:code", this.nsManager); XmlNode printNameNode = conceptNode.SelectSingleNode("mif:printName", this.nsManager); if (codeNode != null) { importMember.Status = codeNode.Attributes["status"].Value; } if (printNameNode != null) { importMember.DisplayName = printNameNode.Attributes["text"].Value; } importMember.CodeSystemName = codeSystemNode.Attributes["title"].Value; }
protected string DetermineValueSetMemberStatus(ImportValueSetMember importValueSetMember, ValueSetMember currentMember) { if (currentMember == null) { return("Add"); } else { bool valueSetMemberIsChanged = importValueSetMember.Code != currentMember.Code || importValueSetMember.CodeSystemOid != currentMember.CodeSystem.Oid || importValueSetMember.DisplayName != currentMember.DisplayName || importValueSetMember.Status != currentMember.Status || importValueSetMember.StatusDate != currentMember.StatusDate; if (valueSetMemberIsChanged) { return("Update"); } } return("None"); }
private void AddImportMember(ImportValueSet importValueSet, DateTime?versionDate, ValueSet currentValueSet, ImportValueSetMember importValueSetMember, bool includeHead, string relationshipType) { if (includeHead) { ValueSetMember currentMember = currentValueSet != null? currentValueSet.Members.SingleOrDefault(y => y.Code == importValueSetMember.Code && y.CodeSystem.Oid == importValueSetMember.CodeSystemOid) : null; importValueSetMember.ImportStatus = DetermineValueSetMemberStatus(importValueSetMember, currentMember); importValueSet.Members.Add(importValueSetMember); } if (!string.IsNullOrEmpty(relationshipType)) { PopulateCodeSystemMembers(importValueSet, versionDate, importValueSetMember.CodeSystemOid, currentValueSet, importValueSetMember.Code, relationshipType == "TransitiveClosure" ? "TransitiveClosure" : null); } }
private void FindOrAddValueSetMember(IObjectRepository tdb, ValueSet tdbValueSet, ImportValueSetMember valueSetMember) { if (valueSetMember.ImportStatus == "None") { return; } ValueSetMember foundValueSetMember = tdbValueSet.Members.SingleOrDefault(y => y.Code == valueSetMember.Code && y.CodeSystem.Oid == valueSetMember.CodeSystemOid); CodeSystem codeSystem = FindOrAddCodeSystem(tdb, valueSetMember.CodeSystemOid, valueSetMember.CodeSystemName); string code = TruncateString(valueSetMember.Code, 254); string displayName = TruncateString(valueSetMember.DisplayName, 254); if (foundValueSetMember == null) { foundValueSetMember = new ValueSetMember(); foundValueSetMember.ValueSet = tdbValueSet; tdb.ValueSetMembers.Add(foundValueSetMember); } if (foundValueSetMember.Code != code) { foundValueSetMember.Code = code; } if (foundValueSetMember.DisplayName != displayName) { foundValueSetMember.DisplayName = displayName; } if (foundValueSetMember.CodeSystem != codeSystem) { foundValueSetMember.CodeSystem = codeSystem; foundValueSetMember.CodeSystemId = codeSystem.Id; } if (foundValueSetMember.Status != valueSetMember.Status) { foundValueSetMember.Status = valueSetMember.Status; } if (foundValueSetMember.StatusDate != valueSetMember.StatusDate) { foundValueSetMember.StatusDate = valueSetMember.StatusDate; } }