/// <summary> /// /// </summary> /// <param name="groupId"></param> /// <param name="code"></param> /// <returns></returns> public bool HasCodeForGroupId(string groupId, CodePhrase code) { if (code.TerminologyId.Value != OpenEhrTerminologyIdentifiers.TerminologyIdOpenehr) { return(false); } return(TerminologyDoc.CreateNavigator().Select("/terminology/group[@name='" + groupId + "']/concept[@id='" + code.CodeString + "']").Count > 0); }
/// <summary> /// /// </summary> /// <param name="code"></param> /// <param name="lang"></param> /// <returns></returns> public string RubricForCode(string code, string lang) { var navigator = TerminologyDoc.CreateNavigator(); foreach (XPathNavigator nav in navigator.Select("/terminology/group/concept[@id='" + code + "']/@rubric")) { return(nav.Value); } return(string.Empty); }
/// <summary> /// /// </summary> /// <param name="groupId"></param> /// <returns></returns> public List <CodePhrase> CodesForGroupId(string groupId) { var results = new List <CodePhrase>(); try { var navigator = TerminologyDoc.CreateNavigator(); var expression = navigator.Compile("/terminology/group[@name='" + groupId + "']/concept/@id"); expression.AddSort("id", XmlSortOrder.Ascending, XmlCaseOrder.None, "", XmlDataType.Number); results.AddRange(from XPathNavigator idNav in navigator.Select(expression) select new CodePhrase(idNav.Value, OpenEhrTerminologyIdentifiers.TerminologyIdOpenehr)); } catch (Exception ex) { System.Diagnostics.Trace.WriteLine( string.Format("Could not read codes {0}", ex.Message)); } return(results); }