Department of Veterans Affairs. Open Source Electronic Health Record Services

Size: px
Start display at page:

Download "Department of Veterans Affairs. Open Source Electronic Health Record Services"

Transcription

1 Department of Veterans Affairs Open Source Electronic Health Record Services MTools Installation and Usage Guide Version 1.0 June 2013 Contract: VA C-0056

2 Table of Contents 1. Installation Prerequisites Download Latest Files Install KIDS Packages and Update VistALink Run VistALink Job Install the Plug-in Configure the Plug-in Usage Eclipse Projects Creating a New Project Opening an Existing Project Using MEditor Loading Routines Backup Files Saving Routines Debugging Adding Breakpoints Line Breakpoints Tag Breakpoints Watchpoints Starting a Debug Session Variables Interactive Console MTools Context Menu Tools Report Assumed Variables Report Errors Report Occurrences Report Quit Types M Refactor Context Menu Items Open Source EHR Services 2 June 2013

3 1. Installation 1.1. Prerequisites MTools integrated development environment (IDE) supports both Windows and Linux. Application Version Notes Veterans Health Information Systems and Technology Architecture (VistA) Any 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. Eclipse Indigo Java Runtime Download Latest Files Download the latest version of MTools here and unpack the file. It contains the plug-in jar files needed and the Kernel Installation and Distribution System (KIDS) packages Install KIDS Packages and Update VistALink From the unpacked file, the KIDS packages are located under /MiscDependencies/KIDS/. Install all three packages: MDebugger, MEditor, and Utilities. KIDS installation instructions can be found here. If a user is working in Linux, VistALink routines need to be updated with those found here; these files can be loaded using D ^%RI utility from a MUMPS Terminal Run VistALink Job Enter the MUMPS command JOB LISTENER^XOBVTCPL(8001) to start VistALink. This action is required for the plug-in to connect with and talk to the server Install the Plug-in 1. Open Eclipse 2. Click Help Install New Software Open Source EHR Services 3 June 2013

4 3. Then Clock Add in the top right 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 Open Source EHR Services 4 June 2013

5 1.6. Configure the Plug-in 1) From Eclipse s main menu (the top most bar) Click Window Preferences VistA Connection 2) Remove the dummy Primary connection value 3) Add a new connection in the format of [Name];[IP Address or hostname];[port number];[blank or an eclipse project name]; a typical value would be local; ;8001; 4) Click OK 2. Usage 2.1. Eclipse Projects 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 project s 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 Creating a New Project A standard Eclipse project can be created via New New Project.This opens the new project wizard. The standard Eclipse project can be chosen from General Project Opening an Existing Project To open an existing project, click on New Import. From the Import Wizard choose Existing Projects into Workspace under the General folder. Open Source EHR Services 5 June 2013

6 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 Using MEditor To begin using MEditor (a custom editor for MUMPS language, part of MTools IDE), simply open a file ending with the suffix.m. A custom editor which includes syntax coloring, new contextual menus, and the outline view (by default the vertical right pane) will display tags in the current routine Loading Routines Routines can be loaded from the server. Either click the green M button in the Eclipse toolbar or on the top menu click VistA Load M Routine. 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

7 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 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 today s 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 Saving Routines Routines are saved, just like all Eclipse files, to the disk. Additionally, when the save button is clicked, it will also attempt to sync with the server, unless it is working in offline mode, as defined in the preferences ( Windows Preferences VistA ). When a routine is to be saved to the server, it will first fetch a copy of that routine from the server. MEditor will then compare what is on the server to the latest backup file for that routine. The latest backup file is a copy of what was last on the server. If this is different, a prompt will be shown. If the file to be saved (the actual routine file, not the backup) is different, no comparison selection prompt is shown because the files should be different as there should be changes to submit. An informational dialog will be shown if the routine to be saved is the same as what is on the server 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`. Open Source EHR Services 7 June 2013

8 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 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. Open Source EHR Services 8 June 2013

9 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 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 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 Starting a Debug Session 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 user s breakpoints. Open Source EHR Services 9 June 2013

10 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 isn t showing all variables currently defined on the server, there is a new custom view created for that. Open it by clicking on Window Show View Other and choose M Variables. It can also be filtered by using the text box on top of the variable viewer. Open Source EHR Services 10 June 2013

11 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 MTools Context Menu Tools A number of M code validation and analysis tools are available in MTools IDE. These tools can be found under M Tools menu item in context menus of Project Explorer view, Outline view, and MEditor. Open Source EHR Services 11 June 2013

12 Open Source EHR Services 12 June 2013

13 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 Report Assumed Variables 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. Open Source EHR Services 13 June 2013

14 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.) Open Source EHR Services 14 June 2013

15 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 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 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. Open Source EHR Services 15 June 2013

16 Report Quit Types 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 M Refactor Context Menu Items M Refactor context menu item is available only from MEditor and it has current single action Expand Keywords. This item changes all the command and intrinsic function mnemonics to their full form. The following screenshots illustrate before and after Expand Keywords state of a routine: Open Source EHR Services 16 June 2013

17 Open Source EHR Services 17 June 2013

18 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. Signed: Date: LaWanda Wells, Contracting Officer s Representative Signed: Date: Maureen Coyle, Program Manager Open Source EHR Services 18 June 2013