Can Messages for LBF or Encounter Forms

(Jerry P) #1

I really would like to get one more new feature into v5.0.2 before release so I have this CRUD for managing canned messages. I was looking to perhaps use a data type in LBF editor where one could add a tag that would then populate the row with the corresponding can message. Could even use a pull down from lists to select a can message then populate a text box. Or right click to select message in any form. Could be useful similar to nation notes or with SOAP forms etc.
The messages could be discipline specific like the sample below is specific to Pulmonary function testing, exams and Hearing test analytics.

Open to all ideas for implementation.

(MD Support) #2

From db perspective isn’t this same as what ZH called customlists? Not sure why you want to tie it to layouts and/or encounters? We ended up essentially rewriting custom_template stuff as TextTemplates and are progressively making it available for all textareas. Currently a Select2 component lets user search and select TextTemplate and update any text form-control. For legacy reasons we kept the table for now.

Here is root of that feature.
TextTemplate.php (2.2 KB)

(Jerry P) #3

This is part of my occupational module(which I am going to contribute, eventually). There are several workflows this is used such as, automatically building evaluation narratives from test results or double clicking any text area to build a narrative etc.
Because table layout is setup for context grouping, should pair nicely with LBF e.g.

would allow for a recommend narrative in eval letter or some simile of.

So LBF could have a data type for the context group of the row and allow populating a textarea. The import here is narrow to use case context. In the case of Hearing and PFT evaluation, this can get complicated rather quickly. I envision this could be useful for behavioral health as well.

Anyway, that’s my thinking. I’ve never paid attention to ZH customlist and am unclear how it is used but, I will take a look…

(MD Support) #4


We are looking at this more as a ui infrastructure component - kind of html5 contenteditable on steroids. From that perspective, you can base dom event handlers around data tags and/or classes. will generate those tags for now but you could invoke the same functionality throughout the application merely adding similar tags in any other form-control.

Both customlists and your table are addressing basic requirement of the UI to quickly present most appropriate block of text:

level 1 - context
Set by system, used to limit searches

level 2 - category
Setup by user based on their needs / thinking about sifting thru large number of templates

level 3 - template
Setup by user to reflect 100s of situations, documentation needs etc.

ZH implemented these in a single table with a column for level. Your table looks to be denormalized as level (1+2) = group and level 3(narrative). 3 or more tables will be engineering approach to enforce integrity but for relatively small sample either works. Would be partial to customlists purely because of flexibility to add more layers if needed but with better column names.

(Jerry P) #5

I think I can agree with using customlist. From what I know the current template setups are done through nation notes. Is that your plan ie make NN a utility menu item?
I could recreate the crud model to the customlist where my experience has been that there is a steep learning curve for setting up NN templates. Also the crud interface is restful.

(MD Support) #6

NN is probably designed to work for the sponsor. There are too many things going on and all that happens at the client. So that component should be left alone like a black box.

Considering limited time before 5.0.2, best chance is to push your code with minimal changes - hopefully using customlists format. It can then be incrementally generalized without impacting NN or your LBF integration.

Only other NN feature not mentioned in your write-up is that NN templates track creator/owner and user/subscriber. NN limits access to a record unless you subscribe. We changed that approach where owner is automatic subscriber and now use user/subscriber just to show those items first but everyone gets to use all templates throughout.

We rely heavily on db views. Here is the core view that may help :

CREATE VIEW zView_user_templates AS
SELECT cl2.cl_list_slno context_id, cl2.cl_list_item_long context_text,
cl3.cl_list_slno cat_id, cl3.cl_list_item_long cat_text, cl3.cl_creator cat_ownerid,
IFNULL(cl4.cl_list_slno,"") tmpl_id, IFNULL(cl4.cl_list_item_long,"") tmpl_text, IFNULL(cl4.cl_creator,"") tmpl_ownerid
FROM customlists cl2
INNER JOIN customlists cl3 on cl2.cl_list_slno=cl3.cl_list_id
LEFT OUTER JOIN customlists cl4 on cl3.cl_list_slno=cl4.cl_list_id and cl4.cl_list_type=4 and cl4.cl_deleted=0
WHERE cl2.cl_list_type=2 and cl2.cl_deleted=0
and cl3.cl_list_type=3 and cl3.cl_deleted=0;

Since select2 is used for picking the template, it does not have any seq columns.

Would be glad to provide any help you need.

(Jerry P) #7

Yep, views can be very useful. I just finished creating the controller/model/collections for using customlists so i’m going to go that way. This will also give me a chance to get the occupational health modules framework in place where i’ll do the complete module in first 5.0.2 patch.

I think I won’t need to touch LBF and still have templates available for any encounter form at least for the first phase of the feature.
Thanks for the feedback. Very helpful.

(MD Support) #8

Only immediate addition I have is to add a generic format field that tells if field content is html, xml or whatever as set by the source. Reverse engineering the format of a string is unreliable and also avoidable.

Will look forward to your PR.

(Jerry P) #9

That’s actually a good idea. Opens many more possibilities. @brady.miller How much time do I have before you are wanting to create the release branch?

(Jerry P) #10

Decided not to use canned templates this go around and am using nation note templating instead.
@mdsupport ya may want to pull down my branch and play with it against a populated NN template database.

(Jerry P) #11

Now in soon to release v5.0.2
Basically one may doubleclick any text area to get the Nation Notes dialog and insert a template from it into text field.
This is any encounter form or most any other text box around the app. Hope this proves useful for folks.