How can I get Medications to show in "proper" case vs all caps?
We are using MEDS_NEW() to get this:
1) FLOMAX 0.4 MG ORAL CAPSULE (TAMSULOSIN HCL) 1 tab at bedtime
But would prefer the text translation to look like this (the way the CPOE-A&P-CCC form shows):
1) Flomax 0.4 Mg Oral Capsule (Tamsulosin hcl) .... 1 tab at bedtime
You would need to write a function for this using the INITIALCAP data symbol. Basically, you would break the med name into an array at the spaces and issue an initial cap command on each element of the array. You would also want to include specific exclusions to account for special cases. For example, MG is seemingly preferred over Mg today for clarity sake and the proper annotation of hydrochloric acid is HCl, not hcl or HCL.
To use this, you would need another function to parse the med list and call it for each medication name or you could include it in the code below. I would personally do the former to make it more universal (i.e. problems, allergies, other text, etc.)
Example:
{fn fnProperCase(strTxt)
{
local retStr = ""
local strTemp = ""
local strBuf = ""
local nCnt
strTemp = getfield(strTxt, " ", "")
for nCnt = 1, nCnt <= size(strTemp), nCnt = nCnt + 1 do
// Add exceptions here
cond
case strTemp[nCnt] == "MG" strBuf = strTemp[nCnt]
case strTemp[nCnt] == "HCL" strBuf = "HCl"
case ...
else strBuf = initialcap(strTemp[nCnt])
endcond
if retStr <> "" then
retStr = retStr + " " + strBuf
else
retStr = strBuf
endif
endfor
return retStr
}
}