InterSystems AllergyIntolerance FHIR resource DTL shows Severity value as SV and Category Food Allergy as FA
Hi Community
I am using a standard DTL for Allergy Intolerance but it shows codes for Category and Severity Columns on cliinical viewer.
I have copied the standard DTL to my custom folder and I want to modify it to show descriptions for these two columns but I don't know how to do it.
Please see the below DTLs for Category and severity and advise how I can change them to get descriptions.
Category DTL section
<true>
<if condition='source.category.Count()>0'>
<true>
<assign value='##class(HS.FHIR.DTL.Util.Lookup).Code("vR4","SDA3","allergy-intolerance-category|4.0.1","HS.SDA3.CodeTableDetail.AllergyCategory",source.category.GetAt(1))' property='value' action='set' />
<if condition='value'=""'>
<true>
<assign value='value' property='target.AllergyCategory.Code' action='set' >
<annotation>
<![CDATA[ The external code, e.g. "M"
--- This mapping entry seeks a lookup table entry that can match a source value with a target value for this field. If the mapping cannot find the lookup table, or cannot find a matching entry in the lookup table, and it has a non-empty Default Value defined, it places its Default Value into the target field. Otherwise, the target receive no value from this mapping.
--- FHIR4 AllergyIntolerance:category is a *List*, and SDA3 HS.SDA3.Allergy:AllergyCategory.Code is *Single*.
--- For a list of objects mapped to a single object, when the transformation is FHIR to SDA, the transformation maps the first object from the source list to the target, and discards the others. ]]>
</annotation>
</assign></true>
</if> </true>
</if>
</true>
</if>
Severity DTL section
<true>
<if condition='source.reaction.(1).severity'=""'>
<true>
<assign value='##class(HS.FHIR.DTL.Util.Lookup).Code("vR4","SDA3","reaction-event-severity|4.0.1","HS.SDA3.CodeTableDetail.Severity",source.reaction.(1).severity)' property='value' action='set' />
<if condition='value'=""'>
<true>
<assign value='value' property='target.Severity.Code' action='set' >
<annotation>
<![CDATA[ The external code, e.g. "M"
--- This mapping entry seeks a lookup table entry that can match a source value with a target value for this field. If the mapping cannot find the lookup table, or cannot find a matching entry in the lookup table, and it has a non-empty Default Value defined, it places its Default Value into the target field. Otherwise, the target receive no value from this mapping. ]]>
</annotation>
</assign></true>
</if>
</true>
</if>
</true>
</if>
Well, Code function is validating if the code in source.Severity has a match in the target ValueSet and if it has then return the code. Maybe you can add a new line after each null validation of value var with something like these to get the description value:
^HS.XF.LookupTable("SDA3","vSTU3","HS.SDA3.CodeTableDetail.AllergyCategory","allergy-intolerance-category",value) ^HS.XF.LookupTable("SDA3","vR4","HS.SDA3.CodeTableDetail.Severity","reaction-event-severity|4.0.1",value)
And update the assign with something like this:
<assign value='^HS.XF.LookupTable("SDA3","vSTU3","HS.SDA3.CodeTableDetail.AllergyCategory","allergy-intolerance-category",value)' property='target.category' action='set'>
But not sure if it's correct to overwrite the codes of the resource with the description...try it and if you don't break anything keep it!
Thanks, I will give it a try.
@Luis Angel Pérez Ramos
I think I initially put the wrong DTL on my post, the correct default one is updated.
I can see it sets target.Severity.Code, I can just update it with target.Severity.Description right?
Sure, try informing target.Serverity.Description.