Department of Veterans Affairs Open Source Electronic Health Record Services
Department of Veterans Affairs Open Source Electronic Health Record Services
Department of Veterans Affairs Open Source Electronic Health Record Services
Contract: VA118-12-C-0056
Table of Contents
1.
Installation ......................................................................................... 3
1.1. 1.2. 1.3. 1.4. 1.5. 1.6. Prerequisites................................................................................................ 3 Download Latest Files................................................................................. 3 Install KIDS Packages and Update VistALink ........................................... 3 Run VistALink Job ...................................................................................... 3 Install the Plug-in ........................................................................................ 3 Configure the Plug-in .................................................................................. 5
2.
Usage ................................................................................................. 5
2.1. Eclipse Projects ........................................................................................... 5 2.1.1. Creating a New Project ............................................................................ 5 2.1.2. Opening an Existing Project ................................................................... 5 2.2. Using MEditor .............................................................................................. 6 2.3. Loading Routines ........................................................................................ 6 2.3.1. Backup Files ............................................................................................. 7 2.4. Saving Routines .......................................................................................... 7 2.5. Debugging.................................................................................................... 7 2.5.1. Adding Breakpoints ................................................................................. 8 2.5.1.1. Line Breakpoints ...................................................................................... 8 2.5.1.2. Tag Breakpoints ....................................................................................... 9 2.5.1.3. Watchpoints ............................................................................................. 9 2.5.2. 2.5.3. 2.5.4. Starting a Debug Session ....................................................................... 9 Variables ................................................................................................. 10 Interactive Console ................................................................................ 11
2.6. MTools Context Menu Tools..................................................................... 11 2.6.1. Report Assumed Variables ................................................................... 13 2.6.2. 2.6.3. 2.6.4. 2.7. Report Errors ......................................................................................... 15 Report Occurrences .............................................................................. 15 Report Quit Types .................................................................................. 16 M Refactor Context Menu Items ............................................................... 16
June 2013
1.
MTools integrated development environment (IDE) supports both Windows and Linux.
Application Veterans Health Information Systems and Technology Architecture (VistA) Version Any Notes This is currently tested with VistA-Freedom of Information Act (FOIA), available here. VistA installation instructions are available on the Open Source Electronic Health Record Agent (OSEHRA) site here.
Indigo 7
June 2013
4. Select the button named Local; this is towards the top right
5. Select the directory where the zip file was unpacked. Then choose the MToolsUpdateSiteProject directory. 6. After clicking OK, the newly added update site will automatically be selected 7. Click Next and follow the prompts to install the plug-in
June 2013
2.
All files in Eclipse must belong to a project since Eclipse can be described as project centric. To begin using MTools IDE there are two options: (1) a new project can be created and files imported or (2) an existing project can be opened containing existing files and the capability to import new files. All files in Eclipse can be removed and/or deleted, or imported via a link as opposed to being in the same directory where the projects root is. The project root is a single directory which contains the .project file. A workspace, however, is a parent to a project and contains 0 or many projects. Projects may or may not exist in the workspace directory root.
2.1.1.
A standard Eclipse project can be created via NewNew Project.This opens the new project wizard. The standard Eclipse project can be chosen from GeneralProject.
2.1.2.
From the Import Wizard choose Existing Projects into Workspace under the General folder.
June 2013
This can be filtered easily by typing ex. Using the file dialog navigate to the directory which contains an existing project (a directory containing a .project file). This will typically be from a version controlled system such as Git, which will typically contain a parent root directory that has the .project file in it, and other files with binaries and source files in children folders.
When a routine is loaded from the server a file is created on disk, either in the root directory if the project has no directories, or a dialog is displayed to prompt the user which directory to load into if there are sub directories in the project. There is also support for the VistA-FOIA structure, which uses a packages.csv file to determine where VistA routines are loaded. For example, if a user attempts to load a routine such as GMPL, it will place this file into Packages/Problem List/
Open Source EHR Services 6 June 2013
automatically. Lastly, if the file already exists in the project, it will always load to this location and attempt to sync showing a diff if anything changes and prompting which file to choose.
2.3.1.
Backup Files
Whenever a file is successfully loaded, a backup file is either created or updated in the /backups folder of the project. This backup file contains the latest server version locally, which is used for comparing when a save occurs. The file format is [routine name] yyyyMMdd.m. If a backup file exists from a previous day, that file will be replaced with the one containing todays date; there will never be multiple backup files for the same routine. These backup files show the latest known server version. Thus, when a routine is either loaded from or saved to the server, this file is updated to what is on the server. It is only used by MEditor to later compare a routine being saved to the server. Users are free to browse the contents of these files if they want to see what MEditor last pushed or pulled from the server.
2.5. Debugging
To use the debug features, enter the Eclipse Debug Perspective. Click the change perspective menu in the top right of the Eclipse IDE. Then choose `Debug`.
June 2013
2.5.1.
Adding Breakpoints
The MDebug Plug-in has three types of breakpoints: line breakpoints, tag breakpoints, and variable watchpoints. All breakpoints can be seen from the breakpoints view under the debug perspective.
2.5.1.1.
Line Breakpoints
Open the M Code in an editor that the user wants to debug. Either press Ctrl + Shift + B or go to the Run Menu at the top of the Eclipse application and select Toggle Breakpoint or Toggle Line Breakpoint.
June 2013
In addition, users can also double click the vertical bar left of the editor to add a line breakpoint. It is important to add breakpoints otherwise the debugger will run until it completes and terminates.
2.5.1.2.
Tag Breakpoints
Arbitrary tags can also be entered (e.g.: TAG^ROUTINE). To add an arbitrary tag, click on the blue tag icon from the breakpoints view.
2.5.1.3.
Watchpoints
Variable watchpoints can be added. They are triggered when a variable value changes. They too are added from the breakpoints view, by clicking the pencil icon.
2.5.2.
To start the debugger, a new launch configuration must be created. Create a new debug configuration by:
Enter the M code which the user wants to debug and which ideally will encounter the users breakpoints.
June 2013
2.5.3.
Variables
Variables will be displayed in the default Eclipse Debug Variables view. But only those variables created after the debug session started are shown.
Since the default view isnt showing all variables currently defined on the server, there is a new custom view created for that. Open it by clicking on Window Show ViewOther and choose M Variables. It can also be filtered by using the text box on top of the variable viewer.
10
June 2013
2.5.4.
Interactive Console
MDebug support is an interactive console which displays MUMPS WRITE commands and can capture input from READ commands. The console uses the default console view and automatically displays itself as WRITE commands output new input or when a READ command is ready to accept input.
11
June 2013
12
June 2013
Currently there are four tools: Report Assumed Variables, Report Errors, Report Occurrences, and Validate Quit Types. Each of these tools is run for each entry point tag in routines. When selected from Outline view, they are run for a specific tag while; when they are run from MEditor, they are run for all the tags in the routine that is being edited in MEditor. All the tools can be run on multiple file selections from Project view.
2.6.1.
The tool finds all the variables that are used in the entry tags that are not newed. Using no newed variables results in un-maintainable code and should be avoided. Running the tool writes the list of assumed variables in the Console per entry point tag. The output also includes clickable location of the assumed variable and when selected it brings the line that the assumed variable is on to focus. Note that some of these tools do recursive analysis. However, recursive analysis is limited to the routines that are on the client Eclipse project and does not consider routines that might be on the server, but not on the client.
13
June 2013
Similar reports are also generated by XINDEX; however, the reports here are generated by a Java-based MUMPS code analyzer that can also recursively search for all the tags that entry tag under test calls. Recursion specifics are configurable, and configuration and can be found under Project Properties M Tools section. (Note: Project Properties is available under the top Project menu item.)
14
June 2013
Users can disable recursive analysis by selecting Only Entry Tag options. Selecting Entry Tag and Fallthrough Tags adds the tags that follow the entry tag to the analysis when entry tag does not end with an unconditional QUIT command. When option All Tags within Routine is selected, all the tags which are local to the routine and called by DO or GOTO commands and extrinsic functions are also included in the analysis. Full recursion is available with Full Recursion with Routine Filter option where can include all DO and GOT calls and extrinsic functions in the analysis. Users can specify routines that would be included or excluded to limit the extent of the recursion. The routines are identified by name regular expressions. In addition to the setting that configures the recursive analysis, users can also specify the variables that should be excluded from the analysis. This is useful when there are variables that are external by design.
2.6.2.
Report Errors
Report Errors writes out all the syntactical errors to the Console. The validation is independent from XINDEX validation and implemented on Java. It serves as confirmation of XINDEX results or can be used offline validation tool where users do not need to save the routine to the server to get validated.
2.6.3.
Report Occurrences
Report Occurrences writes a number of MUMPS language constructs used in the routines to the Console. Most of these constructs should be avoided in VistA development and this report identifies the location which can be reviewed easily. Users can configure the constructs to report on from Project Properties M Tools section.
The following shows an example run; all the constructs include clickable locations.
15
June 2013
2.6.4.
Report Quit Type performs two analyses: the first ensures that each entry tag has consistent QUIT command; all QUIT commands in an entry tag must either all return values or all not return values. The analysis is recursive with respect to GOTO commands. The second analysis looks for DO/GOTO commands that are called for extrinsic functions and SET commands that are called for tags that not return value.
16
June 2013
17
June 2013
Approval Signatures This section is used to document the initial approval of the draft Open Source Electronic Health Record (EHR) Services MTools Installation and Usage Guide, and any subsequent updates and modifications; updates will be submitted as needed. All members of the governing Open Source EHR Services Management Team are required to sign. Please annotate signature blocks accordingly.
18
June 2013