I am trying to parse problem section in CCD using MDHT. The XML code I am trying to parse is:
<entry>
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.3" />
<id root="2.16.840.1.113883.3.441" extension="85cec11c26ff475fac469cc9fa7a040c" />
<code code="CONC" codeSystem="2.16.840.1.113883.5.6" />
<statusCode code="active" />
<effectiveTime nullFlavor="UNK">
<low value="20110925000000" />
<high nullFlavor="UNK" />
</effectiveTime>
<entryRelationship typeCode="SUBJ" inversionInd="false">
<observation classCode="OBS" moodCode="EVN" negationInd="false">
<templateId root="2.16.840.1.113883.10.20.22.4.4" />
<id root="2.16.840.1.113883.3.441.1.50.300011.51.26604.61" extension="1348" />
<code nullFlavor="NA" />
<text>Asthma<reference value="#ref_d910f32f622b4615970569407d739ca6_problem_name_1" />
</text>
<statusCode code="completed" />
<effectiveTime nullFlavor="UNK">
<low value="20110925000000" />
<high nullFlavor="UNK" />
</effectiveTime>
<value xsi:type="CD" nullFlavor="UNK">
<translation code="195967001" displayName="Asthma" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT">
<originalText>
<reference value="#ref_d910f32f622b4615970569407d739ca6_problem_name_1" />
</originalText>
</translation>
</value>
I want to read the translation tag (displayName="Asthma"). I want to read asthma, its code value and code system.
But in MDHT I can't get translation tag inside value tag. I am doing get as:
entry.getAct().getEntryRelationships().get(0).getObservation().getValues().get(0) //no translation tag.
One of the advantages of using MDHT versus other JAVA/XML generations is we generate domain specific classes to help you navigate the document a bit more effectively
You should avoid using specific get() and generic getObservation because the underlying CDA standard constrains what is required but producers are able to place any sort of observation etc within the document. Here is a sample snippet to walk the problem section
The observation class itself and as such the problem observation value is a collection of ANY which need to properly cast to get to the CD type which in turn would have the translation property you are looking for.
hth
Sean
ProblemSection ps = ...
for (ProblemConcernAct cpc : ps.getConsolProblemConcerns()) {
for (ProblemObservation pos : cpc.getProblemObservations()) {
for (ANY any : pos.getValues()) {
if (any instanceof CD) {
CD code = (CD) any;
for (CD translationCode : code.getTranslations()) {
System.out.println(translationCode.getCode());
}
}
}
}
}
Related
I'm converting as webforms app to MVC. The previous programmer built a class that inherits the StaticSiteMapProvider class to create his sitemap. He then placed this control on the page
<asp:SiteMapDataSource ID="sitemapSQLMenuProvider" runat="server" ShowStartingNode="False" />
and initialized it like this
Dim oSqlSiteMapProvider As New SQL.SiteMap.Provider.SQLSiteMapProvider(Session("KPISystemUserID"), PagePath)
oSqlSiteMapProvider.Initialize("MySiteMap", Nothing)
SiteMapDataSource1.Provider = oSqlSiteMapProvider.
He then used the menu control and specified the data source
<asp:Menu ID="menuMaster" runat="server" DataSourceID="sitemapSQLMenuProvider"/>
I created a class in my MVC project and copied the code over to create the SQLSiteMapProvider class. It created nodes... subnodes.. etc. Is there an easy way with the MvcSiteMapProvider package from Nuget to simply specify this class as where to get the Nodes from? All the documentation just keeps trying to get you to use a static XML file (which i can't use because our menus come from the DB).
It looks like the webform programmer set up his provider like this in the web.config
<siteMap defaultProvider="KPIMap" enabled="false">
<providers>
<clear />
<add name="KPIMap" type="System.Web.XmlSiteMapProvider" siteMapFile="~/System/MY.sitemap" />
</providers>
</siteMap>
and that xml file was simply
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="" title="" description="">
<siteMapNode url="" title="" description="" />
<siteMapNode url="" title="" description="" />
</siteMapNode>
</siteMap>
You'd think they would have added a simple way to plug in the name of a StaticSiteMapProvider class and be done with it.
I'm using Examine to search in website content,
But whenever an article is updated, it is shown more than once in the result, with same count as the number of modifications !!
<IndexSet SetName ="ArabicIndexerIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/Arabic/">
<IndexUserFields>
<add Name="id" EnableSorting="true" Type="Number" />
<add Name="content" EnableSorting="true" />
<add Name="author" EnableSorting="true" />
<add Name="title" EnableSorting="true" />
<add Name="description" EnableSorting="true" />
<add Name ="umbracoNaviHide"/>
</IndexUserFields>
</IndexSet>
<ExamineSearchProviders defaultProvider="ArabicSearcher">
<providers>
<add name="ArabicSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
indexSet="ArabicIndexerIndexSet"
supportUnpublished="false"
supportProtected="false"
analyzer="Lucene.Net.Analysis.AR.ArabicAnalyzer, Lucene.Net.Contrib.Analyzers"/>
</providers>
</ExamineSearchProviders>
and this is my query:
+((title:Test Phrase content:Test Phrase)) +(umbracoNaviHide:0)
How to solve this?
EDIT:
Rebuilding the index solves the problem temporarily, and once you modify the article again, the problem appears again.
EDIT2:
I used Luke to investigate the problem, the only difference is the update date between the duplicated results.
See the image:
EDIT3:
I found a solution that worked, but I'm not convinced with it here: Index is not updated automatically
which suggests to use the follwing code:
public class UmbracoEvents: ApplicationBase
{
/// <summary>Constructor</summary>
public UmbracoEvents()
{
umbraco.content.AfterUpdateDocumentCache += new umbraco.content.DocumentCacheEventHandler(content_AfterUpdateDocumentCache);
}
privatevoid content_AfterUpdateDocumentCache(Document sender, umbraco.cms.businesslogic.DocumentCacheEventArgs e)
{
// Rebuild SiteSearchIndexer (Search results will be updated after a few minutes)
ExamineManager.Instance.IndexProviderCollection["SiteSearchIndexer"].RebuildIndex();
}
}
The problem with this solution is that it takes a long time to rebuild the index with large amount of content! (10000 documents in my case) and during the index rebuild process, the user will get 0 result searching anything, which confuses the user.
It looks like your search query is incorrectly structured. If you are searching for the phrase "Test Phrase" in the title and content property, your query should be:
+(title:Test Phrase content:Test Phrase) +(umbracoNaviHide:0)
I am trying to change a log file name after deploying, so transform this:
<log4net>
...
<appender name="GeneralAppender" type="log4net.Appender.RollingFileAppender, log4net">
<file value="c:\logs\Co.App.log" />
...
</appender>
</log4net>
to this:
<log4net>
...
<appender name="GeneralAppender" type="log4net.Appender.RollingFileAppender, log4net">
<file value="c:\logs\Co.App.localhost.log" />
...
</appender>
</log4net>
the actual file node doesn't have any attributes, so I am trying to locate it by parent node
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<log4net>
<appender >
<file value="c:\logs\Co.App.localhost.log" xdt:Transform="Replace" xdt:Locator="XPath(../appender[#name='GeneralAppender'])" />
</appender>
</log4net>
</assemblyBinding>
</runtime>
i've also tried all permutations of absolute and relative xpath's but i don't see it having any effect in transform preview.
i tried:
xdt:Locator="XPath(//appender[#name='GeneralAppender']/file)"
and even:
xdt:Transform="Remove" xdt:Locator="XPath(//file)"
found it!
<file value="c:\logs\Co.App.local.log" xdt:Transform="Replace" xdt:Locator="Condition(../#name='GeneralAppender')" />
Slight extension:
If the parent node has TWO (or more children), then the above solution is not enough.
This is the case in log4net, when the EventLogAppend is used, which has:
<appender name="EventLogAppender" type="log4net.Appender.EventLogAppender" >
...
<param name="LogName" value="MyLog"/>
<param name="ApplicationName" value="MyApplication"/>
...
Then you need to use an 'and' + an atribute more to hit the right node:,
like xdt:Locator="Condition(../#name='EventLogAppender' and #name='LogName')
Example for the EventLogAppender, where both the params are replaced:
<param name="LogName" value="MyNewLog" xdt:Transform="Replace" xdt:Locator="Condition(../#name='EventLogAppender' and #name='LogName')" />
<param name="ApplicationName" value="MyNewApplication" xdt:Transform="Replace" xdt:Locator="Condition(../#name='EventLogAppender' and #name='ApplicationName')" />
The MSDN documentation mentions that if you use XPath, then it's going to append the expression that you pass to the current context in the transform file. So XPath is good for cases where you want to modify the current element or one of it's predecessors.
Where as if you want to traverse to parents in a relative manner, there is no XPath expression that does that. XPath starts with a parent and allows you to traverse the descendants and not ascendants. That's when condition works.
I tried to use xdt:Locator="XPath(.)" and it worked perfectly to replace the current element, and if needed it's descendants. But it doesn't for ascendants.
I have a template and in its Definition I use several forms and buttons.
The problem is the definition (define) xhtml file does not know the component hierarchy.
And for example I want to update the element "table2" in a different form in the same define file.
Template Insert:
<p:tabView id="nav"> <!-- nav -->
<ui:insert name="content_nav">content navigation</ui:insert>
</p:tabView>
defines the first level of my hierarchy "nav"
Template define:
<ui:define name="content_nav">
<h:form id="form1"> <!-- nav:form1 -->
<h:dataTable id="table1"/> <!-- nav:form1:table1 -->
<p:inputText value="#{bean.value}"/>
<p:commandButton action="..." update="nav:form2:table2"/>
</h:form>
<h:form id="form2">
<h:dataTable id="table2"/> <!-- nav:form2:table2 -->
<!-- other elements -->
</h:form>
</ui:define>
In my define part I don't want to know "nav"!
How can I do this? or how can I move one naming component upwards?, or save the highest parent complete id in a variable?
sometimes i saw something like:
update=":table2"
But I could not find any informations about this?, the JavaEE 6 documentation just mentions the # keywords.
Ugly, but this should work out for you:
<p:commandButton action="..." update=":#{component.namingContainer.parent.namingContainer.clientId}:form2:table2" />
As you're already using PrimeFaces, an alternative is to use #{p:component(componentId)}, this helper function scans the entire view root for a component with the given ID and then returns its client ID:
<p:commandButton action="..." update=":#{p:component('table2')}" />
ugly answer works well
update=":#{component.namingContainer.parent.namingContainer.clientId}:form2:table2
mainly more useful updating from opened dialog to parent datatable
You may use binding attribute to declare EL variable bound to JSF component. Then you may access absolute client id of this component by using javax.faces.component.UIComponent.getClientId(). See example below:
<t:selectOneRadio
id="yourId"
layout="spread"
value="#{yourBean.value}"
binding="#{yourIdComponent}">
<f:selectItems value="#{someBean.values}" />
</t:selectOneRadio>
<h:outputText>
<t:radio for=":#{yourIdComponent.clientId}" index="0" />
</h:outputText>
Try this:
<h:commandButton value="Click me">
<f:ajax event="click" render="table" />
</h:commandButton>
Additionally to the solutions above I had the problem, that I had to dynamically generate the to-be-updated components (many) based on server-side logic (with maybe harder to find out nesting).
So the solution on the server-side is an equivalent to update=":#{p:component('table2')}"1 which uses org.primefaces.util.ComponentUtils.findComponentClientId( String designId ):
// UiPnlSubId is an enum containing all the ids used within the webapp xhtml.
// It could easily be substituted by a string list or similar.
public static String getCompListSpaced( List< UiPnlSubId > compIds ) {
if ( compIds == null || compIds.isEmpty() )
return "" ;
StringBuffer sb = new StringBuffer( ":" ) ;
for ( UiPnlSubId cid : compIds )
sb.append( ComponentUtils.findComponentClientId( cid.name() ) ).append( " " ) ;
return sb.deleteCharAt( sb.length() - 1 ).toString() ; // delete suffixed space
}
called via some other method using it, e.g. like ... update="#{foo.getCompListComputed( 'triggeringCompId' )}".
1: first I tried without too much thinking to return public static String getCompListSpaced0() { return ":#{p:component('table2')}" ; } in an ... update="#{foo.getCompListSpaced0()} expression, which of course (after thinking about how the framework works :) ) is not resolved (returned as is) and may cause the issues with it some users experienced. Also my Eclipse / JBoss Tools environment suggested to write :#{p.component('table2')} ("." instead of ":") which did not help - of course.
I would like, that if the user says "help" that the following field doesn't get filled, and that the user gets all possible options.
<form id="test">
<field name="var1">
<prompt bargein="true" bargeintype="hotword" >say xy </prompt>
<grammar src = "grammar.grxml" type="application/srgs+xml" />
<filled>
<assign name="myProdukt" expr="var1" />
you said <value expr="myProdukt"/>
</filled>
</field>
(let's say in the external grammar is "p1", "p2" and "p3", the user says "help", and the systems says "p1","p2","p3" and the user can choose again - therefore the word "help" has to be in the external grammar as well, doesn't it?)
thanks in advance
Yes, the active grammar must contain a "help" utterance which returns the value 'help'. You then catch the event with a help tag:
<?xml version="1.0" encoding="UTF-8"?>
<vxml xmlns="http://www.w3.org/2001/vxml" version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2001/vxml http://www.w3.org/TR/voicexml20/vxml.xsd">
<form id="test">
<field name="var1">
<prompt bargein="true" bargeintype="hotword" >say xy </prompt>
<grammar src = "grammar.grxml" type="application/srgs+xml" />
<filled>
<assign name="myProdukt" expr="var1" />
you said <value expr="myProdukt"/>
</filled>
<help>
To choose a product, say,
<!-- whatever the product choices are -->
frobinator, submarine, curling iron, ..
<reprompt/>
</help>
</field>
</form>
</vxml>
Alternatively, following the DRY principle, this effect can be done globally for your application with using an application root document containing a link element. In the example app-root.vxml document below, there is a linkbinding a global grammar "help" utterance to the help event :
<?xml version="1.0"?>
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml">
<link event="help">
<grammar mode="voice" root="root_rule" tag-format="semantics/1.0"
type="application/srgs+xml" version="1.0" xml:lang="en-US">
<rule id="root_rule" scope="public">
<one-of>
<item weight="1.0">
help
</item>
</one-of>
</rule>
</grammar>
</link>
</vxml>
This grammar will be active everywhere -- effectively merged with each active field grammar. If you need more information about application root documents, the section of the VoiceXML specification Executing a Multi-Document Application explains. Also see Handling Events from the Tellme Studio documentation
Then, in pages of your application, make reference to the application root document via the application attribute of the vxml element and speak appropriately in a help catch block:
<?xml version="1.0" encoding="UTF-8"?>
<vxml xmlns="http://www.w3.org/2001/vxml" version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2001/vxml http://www.w3.org/TR/voicexml20/vxml.xsd"
application="app-root.vxml">
<form id="test">
<field name="var1">
<prompt bargein="true" bargeintype="hotword" >say xy </prompt>
<grammar src = "grammar.grxml" type="application/srgs+xml" />
<filled>
<assign name="myProdukt" expr="var1" />
you said <value expr="myProdukt"/>
</filled>
<help>
To choose a product, say,
<!-- whatever the product choices are -->
frobinator, submarine, curling iron, ..
<reprompt/>
</help>
</field>
</form>
</vxml>
You could, of course, put the link code in the same page as your form, but it is likely you will want help active for every field of your application unless there is collision with something in a particular field's grammar.