Sidebar

Check and Replace text in OBX-3.2

0 votes
284 views
asked Nov 9, 2022 by troy-l-7522 (120 points)
retagged Nov 9, 2022 by troy-l-7522
I need to check all OBXs and replace OBX-3.2 with a value, if it has another value.

For example, if OBX(2)-3.2 has ALPHA 1 as a value, I need to change OBX(2)-3.2 to ALPHA 1 GLOBULIN and leave all other OBXs alone. If OBX(3)-3.2 has ALPHA 1 in it, I need to change that to ALPHA 1 GLOBULIN. etc.

OBX numbers may differ as there may be CBCs or other labs in the same message.

Loop through message, if OBX(x)-3.2 has 'Alpha 1', change value in OBX(x)-3.2 to 'ALPHA 1 GLOBULIN'

OBX|4|NM|015^Total Protein^Local^2885-2^Total Protein^LN|||g/dl|||||P|||20221109122900|||||||||||
OBX|5|NM|SPALB^Albumin - SPEP^Local^2862-1^Albumin - SPEP^LN|||G/DL|3.70-4.90||||P|||20221109122900|||||||||||
OBX|6|NM|SPAL1^Alpha 1^Local^2865-4^Alpha 1^LN|||G/DL|0.20-0.40||||P|||20221109122900|||||||||||
OBX|7|NM|SPAL2^Alpha 2^Local^2868-8^Alpha 2^LN|||G/DL|0.50-0.90||||P|||20221109122900|||||||||||

 

OBX|1|NM|20372^PROTEIN TOTAL^LabLRRout^2885-2^Prot SerPl-mCnc^LN||7.0|g/dL|6.0-8.0||||F||LAB COLLECT|20221104131125||77777^MONTY^KATHY^W|||20221108172935||||SLAB^D|357 JOHNSON ST NE^^GRAND CAYAN^NJ^00000^US^B^^41
OBX|2|NM|20679^ALBUMIN FOR PROTEIN ELECTRO^LabLRRout^2862-1^Albumin SerPl Elph-mCnc^LN||3.3|g/dL|3.7-4.9|L|||F||LAB COLLECT|20221104131125||77777^MONTY^KATHY^W|||20221108172935||||SLAB^D|357 JOHNSON ST NE^^GRAND CAYAN^NJ^00000^US^B^^41
OBX|3|NM|20021^ALPHA 1 GLOBULIN^LabLRRout^2865-4^Alpha1 Glob SerPl Elph-mCnc^LN||0.4|g/dL|0.2-0.4||||F||LAB COLLECT|20221104131125||77777^MONTY^KATHY^W|||20221108172935||||SLAB^D|357 JOHNSON ST NE^^GRAND CAYAN^NJ^00000^US^B^^41
OBX|4|NM|20022^ALPHA 2 GLOBULIN^LabLRRout^2868-8^Alpha2 Glob SerPl Elph-mCnc^LN||0.9|g/dL|0.5-0.9||||F||LAB COLLECT|20221104131125||75032^MONTGOMERY^KATHLEEN^W|||20221108172935||||SPECTRUM HEALTH REGIONAL LABORATORY^D|35 MICHIGAN ST NE^^GRAND RAPIDS^MI^49503^US^B^^41

1 Answer

+2 votes

This can be accomplished with QIE's HPath expression.  Using the following will replace all values:

message.setAllNodes('OBX[@3.2=ALPHA 1]-3.2', 'ALPHA 1 GLOBULIN'); 

For more information on using HPath expressions, see the QIE Reference Manual found in the Help menu of QIE. 

answered Nov 9, 2022 by jon-t-7005 (7,590 points)
edited Nov 9, 2022 by jon-t-7005
commented Nov 10, 2022 by troy-l-7522 (120 points)
How would I go about doing this using a table lookup for OBX-3.2?
Populating 4 columns
Column 1 = Our Test Name
Column 2 = Affiliate Hospital Test Name
Column 3 = Affiliate Hospital 2 Test Name
Column 4 = LOINC for reference

If OBX-3.2 matches either Column 2 or 3, change OBX-3.2 to what is populated in Column 1.
Is this even possible? We have about 10 tests that would be in the table initially but it may grow over time.
commented Nov 10, 2022 by jon-t-7005 (7,590 points)
In that scenario, I think a for loop would be the best choice.  You would loop through the OBX segments, and do a qie.doTableLookup() on the OBX-3.2 field to see if it was in the table, and set the value for that OBX segment based on if anything was found.

Send an email in to support@qvera.com, or give us a call at 801-335-5101 x2 and we'll give you a hand getting that set up.
commented Nov 10, 2022 by troy-l-7522 (120 points)
Thank you. My primary responsibilities are network management (servers, switches, routers) and this is something I have been roped into by the lab. Was a programmer 30 years ago and am a bit rusty. A bit of WD-40 may be in order. :D
...