How to access HL7 fields in SDA extension class
Hi - I created a custom extension to the SDA3 Allergy class, but can't figure out how to access the actual data to plug it into the SDA in the OnAllergy method.
The method (in my extension of the HL7ToSDA class) has a method like this:
ClassMethod OnAllergy(){ Set cr = $c(13,10) do ..write(cr_"<Mode>") do ..write(cr_"<Code>"_"ThisWillComeFromACustomFieldInAL1"_"</Code>") do ..write(cr_"</Mode>") do ..write(cr_"<OnsetDate>") _"ThisWillComeFromACustomFieldInAL1"_"</OnsetDate>") Quit}In the superclass I see references to various macros which reference variable "s" for segment, and use syntax like this:
$$$xml($g(^||d(s,2,1)))
but I can't use that in my OnAllergy method because "s" isn't available at that point in the processing.
Does anyone know how to do this?
Lori
Comments
Hey, I figured it out!!! I just had to add [ Not ProcedureBlock ] to my custom class - then it was able to access the variables (like s) from the superclass. Phew. Case closed.
Lori
More on this - turns out that Extension fields need to be enclosed in an <Extension> element, like so:
<Allergy>
<Extension>
<Mode>SNAPSHOT</Mode>
<OnsetDate>20170412113619</OnsetDate>
<AllergyType>ALLERGY</AllergyType>
<AllergyStatus>ACTIVE</AllergyStatus>
<Asserter>10262187</Asserter>
</Extension>
<AllergyCategory>
<Code>DA</Code>
</AllergyCategory>
<Allergy>
<SDACodingStandard>DRUG</SDACodingStandard>
<Code>d00116</Code>
<Description>penicillin</Description>
</Allergy>
<Severity>
<Code>SEVERE</Code>
</Severity>
<DiscoveryTime>2017-04-12T00:00:00Z</DiscoveryTime>
<FromTime>2017-04-12T00:00:00Z</FromTime>
<Status>A</Status>
<EnteredAt>
<Code>UHC</Code>
</EnteredAt>
</Allergy>