I've done this using a simple text replacement, reading in a text file of translations:
po^ by mouth^| sl^ under the tongue^| prn^ as required^| pr ^ by rectum ^| top^ placed on the skin^| opth^ eye^| od^ right eye^| os^ left eye^| ou^ both eyes^| ob^ both eyes^| otic^ ears^| sq^ subcutaneous^| sc^ subcutaneous^| im^ intramuscularly^| buc^ inside the cheek^| tab^ tablet^| tsp^ teaspoon^| tbl^ tablespoon^| gtt^ drop^| qd^ every day^| qod^ every other day^| bid^ twice a day^| tid^ three times a day^| qid^ four times a day^| qhs^ at bedtime^| qam^ in the morning^| qpm^ in the evening^| ac^ before meals^| pc^ after meals^| q4h^ every 4 hours^| q6h^ every 6 hours^| q8h^ every 8 hours^| stat^ immediately| qwk^ every week^| qmo^ every month^| pr ^ per rectum^
I also use a similar technique to deal with Uppercase to a modified Camel case translation of the medications. For example:
hcl ^ HCl ^| hcl)^ HCL)^| xr24h^ XR24h^| xr12h^ XR12h^| xr ^ XR ^| xt ^ XT ^| cr ^ CR ^| cr-^ CR-^| la ^ LA ^|hctz^HCTZ^| hct ^ HCT ^| c ^ C ^| b ^ B ^| b6 ^ B6 ^| b-12 ^ B-12 ^| d ^ D ^| d3 ^ D3 ^| e ^ E ^| e-^ E-^| cpdr ^ ^| cr)^ CR)^| tbec^ ^| ec ^ EC ^| es ^ ES ^| cd ^ CD ^| q10 ^ Q10 ^|Ester-c^Ester-C^| xl ^ XL ^|-tts^-TTS^| hfa ^ HFA ^| ds ^ DS ^| silver^ Silver^| oil ^ Oil ^| ib ^ IB ^| hct ^ HCT ^| cpep ^ ^|Msm ^MSM ^|Allegra-d ^Allegra-D ^| d-3 ^ D-3 ^| a-d ^ A-D ^| r ^ R ^| er ^ ER ^| a ^ A ^| b-6 ^ B-6 ^|Cvs ^CVS ^| 600+d ^ 600+D ^|(b ^(B ^|Ec-n^EC-N^|-msm ^-MSM ^| hcl-^ HCl-^| d-^ D-^| otc ^ OTC ^| b ^ B ^| b12 ^ B12 ^| u-^ U-^|Coq-^CoQ-^|-b ^-B ^| n ^ N ^| fe)^ Fe)^|-k ^-K ^| epa ^ EPA ^| crys ^ ^| sr ^ SR ^| dr ^ DR ^| q-10 ^ Q-10 ^
The code is in USRLib.txt as it is used by multiple routines.
/*Format Medications, list to lowercase, first letter to upper case*/
/*Case exceptions in file F:/ACG Text Components/Case Meds.txt*/
fn Meds_Format()
{
local strRx=""
local strDrug=""
local i=0
local j=0
local strAbbrv=""
local strFrom=""
local strTo=""
local strSig=""
local strGen=""
local strCase=Get_List("Case Meds.txt")
local strSigAbbrv=Get_List("Sig Abbrvs.txt")
local Case_Array=getfield(strCase,"|","")
local SigAbbrv_Array=getfield(strSigAbbrv,"|","")
local numArgs=getnargs()
for i=1,i<=size(Case_Array),i=i+1
do
Case_Array[i]=getfield(Case_Array[i],"^","")
endfor
for i=1,i<=size(SigAbbrv_Array),i=i+1
do
SigAbbrv_Array[i]=getfield(SigAbbrv_Array[i],"^","")
endfor
arrayRx=getfield(Meds_After("delimited"),"|","")
arrayCorr=getfield(strAbbrv,"|","")
for i=1,i<=size(arrayRx),i=i+1
do
arrayRx[i]=getfield(arrayRx[i],"^","")
strRx=initialcap(tolower(arrayRx[i][1]))
if numArgs=0 then
strRx=strRx+" ("+tolower(arrayRx[i][2])+")"
else
if match(arrayRx[i][1],arrayRx[i][2])=0 then
strRx=strRx+" ("+tolower(arrayRx[i][2])+")"
endif
endif
for j=1, j<=size(Case_Array),j=j+1
do
strFrom=Case_Array[j][1]
strTo=Case_Array[j][2]
strRx=replacestr(strRx,strFrom,strTo)
endfor
strSig=tolower(arrayRx[i][7])+" "
strSig=replacestr(strSig,",","")
if numArgs=1 then
for j=1, j<=size(SigAbbrv_Array),j=j+1
do
strFrom=SigAbbrv_Array[j][1]
strTo=SigAbbrv_Array[j][2]
strSig=replacestr(strSig,strFrom,strTo)
endfor
endif
strDrug=strDrug+strRx +", "+ strSig+HRET
endfor
return strDrug
}
Having the modifying strings in a text file enables easy maintenance by the staff/users.
If you have questions, contact me at [email protected].
Posted : March 4, 2016 6:00 am