Description of modifications made to TMG-CPRS
	Last Modified: 01-07-10

Following is a list of modifications in the TMG-CPRS version:

•	Customizable Splash Screens
•	CPRS can now have a customized splash screen. To achieve this, simply place the desired image into the directory where CPRSChart.exe resides, titled splash.jpg and it will automatically be shown.	
•	Add New Patients
•	On the patient selection screen, if the TMG patch has been applied to the server and the user does not have the TMG CPRS HIDE ADD PATIENT security key, then Add Patient button will be displayed.  This will allow the user to enter a minimal amount of demographics to create the new patient.
•	Edit Patient’s Demographics
•	To edit the patient’s demographics go to File -> Edit Patient Demographics. Alternatively, by clicking on the patient’s name at the upper left hand corner of CPRS a window will open listing the patient’s demographics. Click the “Edit Patient Demographics” button to edit the patient’s demographics.
•	The Edit screen has two tabs, a Demographics tab and an Advanced tab. The Demographics tab has then most common fields. The Advanced tab contains all possible fields in the Patient file.
•	Bug With Patient List
•	Corrected the Exception Error that was triggered when selecting any radio button in the Patient List group on the Patient Selection form.
•	Added functionality for Patient Lookup	
•	Patient lookup was enhanced to lookup: Phone number (work, home, cell), Date of Birth, and Partial Names. e.g. 10/1/67, October 1, 1967, 555-555-5555, (555)222-2222, Smi,Jo, Cutsha,C.
•	Colored Tabs (Not MS Vista compatible)
•	Each of the tabs can have their own color. These colors can be customized in Tools -> Options -> Other Parameters -> Adjust Tab Colors.
•	Tab Position
•	Tabs can now be moved from the standard bottom to the top, left, or right hand side. To move them, go to  Tools -> Options -> Other Parameters -> Select Tab Positioning
•	Multi Language support
•	CPRS can be changed to any language, provided a translation file is available. To change the language go to Tools -> Options -> Language. Three other languages are currently on the TracServer: Danish, Spanish (Traditional Sort), and Portugese (Brazil). 
•	To create a new language translation file, first download the free language editor at http://www.dk-soft.org/products/dklang/ . Once opened, use the file CPRSChart.dklang as the Language source file (located in the same folder as CPRSChart.exe). This displays all static text in CPRS and allow you to add a translation for each. Save this file with the other .lng files and it will then show in the Languages tab with the others.
•	HTML Note Rendering
•	If a document is saved with <HTML> tags, it will be rendered in HTML when displayed in the Notes tab.  To create a document in HTML, right click inside the document and select “Change edit mode to formatted text” (if the document is already in HTML mode, this option will read “Change edit mode to plain text”). An option will then be given to start all notes in this mode. When editing in formatted mode, buttons appear for bold, italics,  font size, etc... (Note: including images is not supported at this time)
•	HTML Templates
•	To add HTML tags to a template, you must begin with “{HTML:” and end with “}”.  e.g. {HTML:<b>} This will be bold {HTML:</b>} , {HTML:<i><u>} This text will be italicized and underlined {HTML:</i></u>}. Note: To utilize the HTML tags, the current note must be in HTML mode prior to entering the template. If not, the tags will not be displayed and consequently lost.
•	Skins (Not currently active)
•	To change CPRS’s skin(which just alters the color and look of the program), go to Tools -> Options -> Appearance. Note: This function is not currently available.
•	Web tab (defined server-side)
•	Functionality that can be enabled on the server side (Read documentation in GETURLS^TMGRPC1.m). This could be easily modified to allow inclusion of web based e-prescribing or billing system from within CPRS. Web page will show up as additional folder tab.
•	Spoof Another Version
•	This feature allows a user to spoof a VistA server into allowing a different CPRS version to connect. In the parameters of the CPRS shortcut, put “SPOOF-VER=” and then the version of the server. i.e. If you want to connect a 1.0.26.76 version of CPRS with a 1.0.26.66 VistA server you would place “SPOOF-VER=1.0.26.66” as a parameter into the shortcut to CPRS.
•	Expanded Template Functions, including math functions and dynamic text objects
•	The traditional CPRS template functionality allowed syntax as below. 
This is a test template for |PATIENT NAME|

Enter value:  {FLD:NUMB1-16}

•	The above template would result in the patient name, pulled from the server, to be placed in the final document.  It would also generate a GUI box with a field that the user can interact with.  In the example below, the field ‘NUMB1-16’ happens to be a drop-down box.  When the user selects a number and presses [OK], the resulting text is inserted into the note.  However, nothing more can be done with the user input inside the template.

•	 The new extension allows syntax as below:

This is a test template for |PATIENT NAME|

Enter value:  {FLD:NUMB1-16}
Enter value:  {FLD:NUMB1-16}

Result 1: {FN: [FLD:1:NUMB1-16] + [FLD:2:NUMB1-16] } 

•	The above template would present the user with a GUI box containing two drop-down boxes.  And the output text would evaluated in a math function.  In this case the math function is a simple addition of the two fields.  Notice the syntax of how to identify which field is being referred to.  So [FLD:1:NUMB1-16] refers to the first instance of the field, and [FLD:2:NUMB1-16] is the second instance of this same field.   More details on this syntax below.
•	The following syntax is also allowed.  This will cause a text object (in this example it is the object |PATIENT NAME|).  By itself, the only difference between this and simply including the object directly into the template is that that text object is not resolved (i.e. value obtained from the server) until after the user presses OK on the GUI box.  More below.

Result 3: {OBJ:PATIENT NAME}

•	If the TMG-CPRS-TEXTOBJ-PARAM patch is installed then one may pass parameters into text objects.  And thus one can also use the value from a field as one of the parameters.  (The server code supporting the custom text objects must be programmed to accept the custom parameter.  Syntax to be detailed further below. ) Examples of syntax:

This is a sample of a plain text object:  |PATIENT NAME|

And this is an object with a parameter  |MY TEXT OBJECT{5}|
or another object with a parameter |MY TEXT OBJECT{Some Text}| 

•	And now one may see the value of the {OBJ:... syntax   Below is an example of a text object being passed with user-generated input as a parameter.  The value of the second GUI field is resolved into it’s output value, and this is passed as a parameter into the text object.

Enter value:  {FLD:NUMB1-16}
Enter value:  {FLD:NUMB1-16}

{OBJ:MY TEXT OBJECT{[FLD:2:NUMB1-16]}}

So, if the user selected a value of “1” for the first drop-down box, and “9” for the second drop down box, then the object would be resolved as follows:

{OBJ:MY TEXT OBJECT{9}}

And the server code might be written to return a value like this:

“The user entered: 9”   (or something more clinically useful)

•	The {OBJ:... syntax may also be used in math formulas.  Of course, the output of the text object would have to be text that was only a numeric value.  So, we could have a text object that converted weight into a body-mass-index (BMI).  And this value could then used in a formula. In the example below, the field WEIGHT-LB provides a text box for the user to enter the patient weight in pounds.  (This field would have to be created in CPRS just like all other fields.  See standard CPRS documentation for details.)  And for the example, we will have a custom text object named “PT WEIGHT TO BMI”.  (And this text object would have to be defined on the server.  More on this further below).  There is no clinical reason why one would want to subtracting 5 from a patient’s BMI.  But it demonstrates what is possible.
 
Enter value:  {FLD:WEIGHT-LB}
Here is the result of the formula: {FN:[OBJ:PT WEIGHT TO BMI{[FLD:1:WEIGHT-LB]}]-5}

•	Details on referring to fields in functions and text objects.   Consider the example template below:

Enter value:    {FLD:NUMB1-16}    <--- 1st instance of NUMB1-16
Enter Units:    {FLD:UNITS}
Enter location: {FLD:LOCATION}
Enter value:    {FLD:NUMB1-16}    <--- 2nd instance of NUMB1-16
Enter Units:    {FLD:UNITS}
Enter location: {FLD:LOCATION}
Enter value:    {FLD:NUMB1-16}    <--- 3rd instance of NUMB1-16
Enter location: {FLD:LOCATION}
Enter Units:    {FLD:UNITS}

To refer to the 3rrd instance of the field NUMB1-16, use this syntax: 

   [FLD:3:NUMB1-16]

Notice that this is not the 3rd field on the form (that actually would be the first instance of the LOCATION field).  But it is the 3rd time that NUMB1-16 is used.  So the following rules apply:
i)	Entire reference is enclosed in square brackets (“[“, “]”)
ii)	Starts with “FLD:”, which must be UPPER CASE
iii)	Next is an instance number that refers to a particular field, as described above, followed by another ‘:’.
iv)	And lastly is specified the Field name, which must exactly match in spelling and case-sensitivity.
v)	Notice the similarity between the declaration and the reference, so as not to get confused.

{FLD:NUMB1-16}    <--- used by CPRS to make a GUI input field for user
[FLD:3:NUMB1-16]  <--- used, in a FN or OBJ to refer to a field.

•	To refer to an text object in a function, the following syntax rules apply:
i)	Entire reference is enclosed in square brackets (“[“, “]”)
ii)	Starts with “OBJ:”, which must be UPPER CASE
iii)	Next is the name of the text object.  This is the name normally placed between “|” characters.  The “|” may be included or left off.

[OBJ:MY OBJECT]  <---- Correct
[OBJ:|MY OBJECT|]  <---- Also correct

iv)	If text object supports passing parameters, they must be surrounded by curly brackets (“{“, “}”).  E.g.

[OBJ:MY OBJECT{123}] 

Only one parameter may be passed.  If one needs to pass more than one parameter into a function, one may place then all into one long string, separated by some unique character, e.g.

[OBJ:MY OBJECT{123^ABC}] 

The server-side function would receive this as a parameter and then have to separate the parts itself.  It is allowed to use this syntax with multiple field entries.  E.g. 

[OBJ:MY OBJECT{[FLD:1:NUMB1-16]^[FLD:3:NUMB1-16]}] 

v)	The order of resolution is to first resolve all FLD values, and then resolve OBJ items.
vi)	Having a text object as the parameter of another text object is allowed.  E.g. 

[OBJ:MY OBJECT{[OBJ:ANOTHER OBJECT]}] 

•	The syntax for functions is as follows:
i)	Example function:  {FN:(1+5)*3}
ii)	Entire function is enclosed in curly brackets. (“{“, “}”).  
iii)	Starts with “FN:” which must be UPPER CASE.
iv)	All white space between “:” and closing “}” is not significant, and is removed.
v)	FLD values will be resolved first, then OBJ values, and then the function will be evaluated.
vi)	The mathematical expression must follow the following rules:
(1)	The only operators supported are: ^,*,/,+,-
(2)	There must be the same number of begin and end brackets.
(3)	Only the round brackets can be used, i.e. “(“,  “)”
(4)	All values must be valid constants.  A "valid constant," for this program, is defined as a string with:
(a)	No characters besides "0".."9," up to one ".",
(b)	Up to one "-" at the beginning
(c)	The string must be at least one character in length
(d)	Exponential sections are not supported, ie. "3.14E-10" is not supported.
vii)	If there is a problem evaluating the mathematical formula, then the output is just the text of the formula, inserted into the note text, without being evaluated.	
•	Information for creating custom server-side text objects to accept parameters.
i)	On the server, in roll-and-scroll mode, go to menu option: TIUF DOCUMENT DEFINITION MGR
ii)	From there, select option  Create Objects [TIUFJ CREATE OBJECTS MGR]
iii)	From here, one can create text objects.  See TIU documentation for details.  The key factor is to make an entry into the Object Method field.  This should be a function that returns a value for X that will be put into the note in CPRS.  Below is an example of the traditional way this is done:

SET X=”This is a test”, or
SET X=$$GETOBJ^TMGABC

iv)	To accept the passed parameter, one should change the object function to accept a variable X.  X is preloaded with the passed parameter.  E.g. 

SET X=$$GETOBJ^TMGABC(X)

v)	The above requires a custom version of the function $$BOIL^TIUSRVD, which is supplied in patch TMG-CPRS-TEMPLATE-PARAM

https://trac.opensourcevista.net/browser/cprs/branches/tmg-cprs/Server_KIDS