Hello all,
This is my first CHUG post but I'm running out of ideas and I haven't been able to get in touch with my typical resources. Let me know if this is a good avenue or if I should be going about this differently. /////
{if DOCUMENT.SCHEDINST <> ""
DOCUMENT.SCHEDULE_FOR <> ""
OR DOCUMENT.OUTPATIENT <> ""
OR DOCUMENT.SDA <> ""
OR DOCUMENT.EXTENDED_RECOVERY <> ""
OR DOCUMENT.GENERAL <> ""
OR DOCUMENT.MAC <> ""
OR DOCUMENT.IV_SEDATION <> ""
OR DOCUMENT.LOCAL <> ""
OR DOCUMENT.TIME_NEEDED_ <> ""
OR DOCUMENT.OK_FOR_ASC_P <> ""
OR DOCUMENT.MD <> ""
OR DOCUMENT.MD_WHO <> ""
OR DOCUMENT.RNFA <> ""
OR DOCUMENT.RNFA_WHO <> ""
OR DOCUMENT.SECOND_SCRUB <> ""
OR DOCUMENT.NONE <> ""
OR DOCUMENT.NEED_MEDICAL <> ""
OR DOCUMENT.WHO_ <> ""
OR DOCUMENT.COUMADIN <> ""
OR DOCUMENT.PLAVIX <> ""
OR DOCUMENT.ASA <> ""
OR DOCUMENT.PRADAXA <> ""
OR DOCUMENT.SAVAYSA_LIXIANA_ELIQUIS_XARELTO <> ""
OR DOCUMENT.OTHER_MED <> ""
OR DOCUMENT.STOP_ <> ""
OR DOCUMENT.PACEMAKER <> ""
OR DOCUMENT.CPAP_BPAP <> ""
OR DOCUMENT.BOWEL_PREP <> ""
OR DOCUMENT.BOWEL_PREP_W_ENEMA <> ""
OR DOCUMENT.Z1_2_BOWEL_PREP_W_ENEMA <> ""
OR DOCUMENT.NO_PREP <> ""
OR DOCUMENT.NO_ANTIBIOTICS <> ""
OR DOCUMENT.LIQUIDS_1_DAY <> ""
OR DOCUMENT.LIQUIDS_2_DAY <> ""
OR DOCUMENT.STENT <> ""
OR DOCUMENT.NO_STENT <> ""
OR DOCUMENT.MRSA <> "" THEN OBSNOW("SURGRYNEEDED", DOCUMENT.SURGERYFORM) ELSE OBSNOW("SURGRYNEEDED","") ENDIF }
{DOCUMENT.SURGERYFORM = STR(DOCUMENT.SCHEDINST) +HRET + HRET+
"Schedule for: " +STR(DOCUMENT.SCHEDULE_FOR) +HRET +" "+ "Admission: " +STR(DOCUMENT.OUTPATIENT) +STR(DOCUMENT.SDA) +STR(DOCUMENT.EXTENDED_RECOVERY) + HRET + HRET +
"Anesthesia: " +STR(DOCUMENT.GENERAL) +STR(DOCUMENT.MAC) + STR(DOCUMENT.IV_SEDATION) +STR(DOCUMENT.LOCAL) +HRET + HRET +
STR(DOCUMENT.TIME_NEEDED_) + STR(DOCUMENT.OK_FOR_ASC_P) + HRET + HRET +
"Assistamt: " +STR(DOCUMENT.MD) +STR(DOCUMENT.MD_WHO) +STR(DOCUMENT.RNFA) +STR(DOCUMENT.RNFA_WHO) +STR(DOCUMENT.SECOND_SCRUB) +STR(DOCUMENT.NONE) +HRET + HRET+
"Needs Medical Clearance: " +STR(DOCUMENT.NEED_MEDICAL) +STR(DOCUMENT.WHO_) +HRET + HRET+
"Patient Medications: " +STR(DOCUMENT.COUMADIN) +STR(DOCUMENT.PLAVIX) +STR(DOCUMENT.ASA) +STR(DOCUMENT.PRADAXA) +STR(DOCUMENT.SAVAYSA_LIXIANA_ELIQUIS_XARELTO) +STR(DOCUMENT.OTHER_MED) +STR(DOCUMENT.STOP_) +HRET + HRET+
"Patient Devices: " +STR(DOCUMENT.PACEMAKER) +STR(DOCUMENT.CPAP_BPAP) +HRET + HRET+
"Colon Surgery: " +STR(DOCUMENT.BOWEL_PREP) +STR(DOCUMENT.BOWEL_PREP_W_ENEMA) +STR(DOCUMENT.Z1_2_BOWEL_PREP_W_ENEMA) +STR(DOCUMENT.NO_PREP) +STR(DOCUMENT.NO_ANTIBIOTICS) +STR(DOCUMENT.LIQUIDS_1_DAY) +STR(DOCUMENT.LIQUIDS_2_DAY) +STR(DOCUMENT.STENT) +STR(DOCUMENT.NO_STENT) +STR(DOCUMENT.MRSA)
}
Ideally I would get those ~37 document variables to enter into the obs term (SURGRYNEEDED) for a handout. However this is not working but I have follow this methodology on other forms. Guidance is appreciate but I will keep working on this regardless.
Max characters per obs term is 2048. I have a pre-op surgical clearance form that you could look at for ideas if you are interested. Contact me directly.
In looking at your code, it looks like you are missing the 'OR' between the first and second conditions.
{if DOCUMENT.SCHEDINST <> “” NEED AN OR CLAUSE RIGHT HERE
DOCUMENT.SCHEDULE_FOR <> “”
OR DOCUMENT.OUTPATIENT <> “”
OR DOCUMENT.SDA <> “”
Two areas of optimization:
1) Because you appear to only be interested in at least one of the document variables being populated, instead of all of the OR statements in the first part, you can combine it all in a single str() evaluation for more efficiency:
if str(DOCUMENT.VAR1,DOCUMENT.VAR2,...) <> "" then
OBSNOW(...)
else
OBSNOW(...)
endif
2) DOCUMENT. variables, are by default, strings, meaning there is no need to execute the str() function on them. This also will improve efficiency by reducing clock cycles on the CPU.
You might also want to evaluate the use of a watcher vs. a function to build the statement. A function can serve as a watcher but afford cleaner presentation and more controlled coding over a simple statement.
Lastly, ensure that you have adequate spacing between values. While it looks like you account for hard returns, I do not see evidence of spaces between possible values, meaning the text could be formatted in a manner you do not want (assuming that your selections do not contain said spacing).
If you have other questions, feel free to post. I'd be happy to follow up and get you there.
Thanks for the response! With this:
if str(DOCUMENT.VAR1,DOCUMENT.VAR2,...) <> "" then OBSNOW(...)
Would each document.var be evaluated separately than the others? E.g. Admission having an answer doesn't necessarily require Patient Medications or Devices to have an answer.
I would definitely be interested in learning more about watcher vs function but to this point:
"Lastly, ensure that you have adequate spacing between values. While it looks like you account for hard returns, I do not see evidence of spaces between possible values, meaning the text could be formatted in a manner you do not want (assuming that your selections do not contain said spacing)."
I just wanted to see if I could combine them and after adding the first OR to a newly added document.var I was able to. I'll be working on the formatting for the OBS term now and will likely post.
Thanks for your help! I didn't realize how good of a resource CHUG would be for this.
That was the trick! I appreciate your help. I'll most likely respond again looking for formatting tips.
Thanks for the reply! I would definitely enjoy looking at the form. Do we have a repository of useful form builds to either add to or peruse for ideas?
Indeed, each response is included. Basically, the command simply adds all variable values into a single string. If any one of the included variables are populated, the string is not empty. Since your original code did not include specific groupings, the str() approach is ideal and saves code cycles by not evaluating the numerous OR statements.
The CHUG is very community oriented, making it an excellent resource. 🙂