Jump to content

XPath Parse - what xPath functions are available?


 Share

This topic is 4367 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

Hi there, this is my first post to FMForums!

I'm working on Parsing a XML document called a CCD (an electronic medical record system's Continuity of Care Document). This is a structured XML document with a lot of elements and a rather complicated way of describing a person's medical history. I'm comparing the XPath functions from Scriptmaster and FMNexus' WebServices plug-ins and trying to see what will work best for me. (I've attached a sample CCD for a fictional person, in case anyone wants the ugly details....)

For now, I'd like to know if one can use ALL XPath 1.0 functions with ScriptMaster or not. For example, there are what I'd call meta-functions in XPath like Count(node) that can tell you how many nodes of a given type exist. (e.g. how many drugs is a person taking?)

I'd also like to know if/how to extract a node, but retain the internal XML tags so that I can sequentially parse an XML string, which will just make it simpler for me. For example, can I pull out the subsection for medications (and not diagnoses), then count the number of meds, then pull the individual meds in a loop. (I suppose it is possible to repeatedly reference the original XML, but not only will that be slower to function on the longer text string, it will just be a lot harder to troubleshoot.)

Any help with either part of this question is much appreciated, I'm really new to xPath, and the official web page (http://www.w3.org/TR/xpath/) doesn't tell me if ScriptMaster's XPath_Parse() will do what I want, or how to phrase it for the plugin.

Thanks in Advance,

Drew Tenenholz

------------------

Here one XPath_Parse function I've tried and what I get back:

//component/structuredBody/component[9]/section/entry (poorly formatted text for each of the drugs the person is on)

[(blank line(s)]

(many spaces)

(many spaces)Albuterol inhalant

(many spaces)

[(blank line(s)]

(many spaces)

(many spaces)Clopidogrel

(many spaces)

(many spaces)Plavix

(many spaces)

[(blank line(s)]

(many spaces)

(many spaces)Metoprolol

(many spaces)

[(blank line(s)]

(many spaces)

(many spaces)Prednisone

(many spaces)

[(blank line(s)]

(many spaces)

(many spaces)Cephalexin

(many spaces)

(many spaces)Keflex

(many spaces)

(many spaces)

What I'd really hoped for was five sections like:

<substanceAdministration classCode="SBADM" moodCode="EVN">

<templateId root="2.16.840.1.113883.10.20.1.24"/> <!-- Medication activity template -->

<id root="cdbd33f0-6cde-11db-9fe1-0800200c9a66"/>

<statusCode code="active"/>

<effectiveTime xsi:type="PIVL_TS">

<period value="6" unit="h"/>

</effectiveTime>

<routeCode code="IPINHL" codeSystem="2.16.840.1.113883.5.112" codeSystemName="RouteOfAdministration" displayName="Inhalation, oral"/>

<doseQuantity value="2"/>

<administrationUnitCode code="415215001" codeSystem="2.16.840.1.113883.6.96" displayName="Puff"/>

<consumable>

<manufacturedProduct>

<templateId root="2.16.840.1.113883.10.20.1.53"/> <!-- Product template -->

<manufacturedMaterial>

<code code="307782" codeSystem="2.16.840.1.113883.6.88" displayName="Albuterol 0.09 MG/ACTUAT inhalant solution">

<originalText>Albuterol inhalant</originalText>

</code>

</manufacturedMaterial>

</manufacturedProduct>

</consumable>

<precondition typeCode="PRCN">

<criterion>

<code code="ASSERTION" codeSystem="2.16.840.1.113883.5.4"/>

<value xsi:type="CE" code="56018004" codeSystem="2.16.840.1.113883.6.96" displayName="Wheezing"/>

</criterion>

</precondition>

</substanceAdministration>

That I cold then parse further into the drug name (./consumable/manufacturedProduct/manufacturedMaterial/code[@displayName] or ./consumable/manufacturedProduct/manufacturedMaterial/originalText), drug code (./code{@code]), dose, doseQuantity (ie.e how many times a day the persontakes the drug), method for administration, etc. etc.

SampleCCDDocument.xml

Link to comment
Share on other sites

This topic is 4367 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.