Rules creation and management is typically the most complex part of using an expert system. This is true for LabScanner, but LabScanner's rules have been designed to be as easy to create and manage as possible. Rules in LabScanner are managed as Rule Sets, which are linked to a particular test (or event) by the test codes in the data file that is imported. Within a Rule Set, rules can be created in four major categories: value comparisons, trends, variability and frequency. These rule categories provide simple standard frameworks for the creation of useful rules. Once created, rule sets and rules can be modified or turned on and off as desired for scanning particular data sets. Rules can be saved to files and rule files can be loaded as needed. LabScanner is distributed with a few demonstration rule sets related to therapeutic drug monitoring. However, the most useful rule sets will be those created at specific sites for specific purposes.
Rules files are loaded by choosing Open Rules File... from the Rules Menu and then selecting the file to load in the open file dialog box that appears. Rules files can also be loaded by double-clicking them or dragging them over the LabScanner icon. The rule sets in the rule file are displayed in the Current Rule Sets window (Fig. 6, right) after the file loads. If a rules file is already loaded, its rule sets can be displayed by choosing Show Rule Sets... from the Rules Menu. The Current Rule Sets window shows the name of the currently loaded rule file at the top, and a list of its rule sets below. A "+" sign in front of a rule set indicates that it is active; a "-" indicates that a rule set is inactive and will not be used in scans or rule statistics calculations. Rule sets can be activated or deactivated by selecting them in the list with the mouse and clicking the Activate/Deactivate button at the bottom left of the window (selecting multiple items and clicking the button toggles the items' activated/deactivated state). Double-clicking a list item will open a Rule Sets window (Fig 7, below) for that item and display the details of the rule set.
Fig 6. Current Rule Sets Window Rules files containing rule sets can be defined as "default" by clicking the Make Default button at the bottom of the window (Fig. 6). The default rules file is opened automatically by LabScanner when the program starts up. If a rules file is already defined as default, it will show "(default)" following its name at the top of the window and the Make Default button will be inactive.
Rules files can be saved by clicking the Save As button at the upper right of the Current Rule Sets window (Fig. 6). You will then be asked to name the file and choose a location to save it in the standard way. Rules files can be saved to any location desired and the default rules file can also be located anywhere. However, if you move the default rules file, you will need to re-choose it as default in its new location. Rules files are internally XML files and thus they can be inspected or edited with a text or XML editor if desired. Windows system save rules files with a ".rul" file extension.
Rules can be imported into the currently loaded rules file from another rules file on disk. To do this, choose Import Rules... from the Rules Menu and select the desired file. All the rule sets in the selected file will be added to the current rules file and the combined rule sets will be displayed in the Current Rule Sets window (Fig. 6, above).
Rules files and their rule sets are tied to particular patient data file formats through the definition of the Data File Codes in the Rule Sets Window (Fig. 7) discussed below. In cases where a large rule set needs to be applied to data files from different systems that may use different codes for the same test, it is convenient to enter the rules one time, save rules files under different names appropriate for the data files and edit just the Data File Codes as needed in each rules file. Then the appropriate rules file can be opened before loading the corresponding patient data file. Similar considerations apply to patient archive files.
New rule sets are created by choosing New Rule Set... from the Rules menu. This displays a blank Rule Sets Window (below), which can be completed as desired and which allows creation of specific rules within the rule set. When a new rule set is created, it is saved to the current rules file and its title appears in the Current Rule Sets window (Fig 6, above).
An example Rule Set Window is shown at the right in Fig 7. This window could be displayed by, for example, double-clicking Digoxin in the window in Fig 6. This display also could be created by opening a new Rule Set window using New Rule Set... from the Rules menu and entering data directly. The rule set name at the top is up to the user, but it is intended that it correspond to the test that the rule set targets (Digoxin, in this case). The rule set name is used as the title for the data list and graph in the patient display and printed report, so it should make sense in that context. The Abbreviation is used in the Patient list window as noted previously. The rule set can be activated/deactivated from the popup menu at the upper right in addition to the button in the Current Rule Sets Window (Fig 6).
Fig 7. Rule Set Window The Data File Codes at the upper left refer to the actual text from the data file that will be matched to this rule set. The rule set will be applied only to data that matches all codes entered here. For tests (such as aminoglycoside antibiotics) which are drawn according to peak and trough schedules, the peak and trough codes are also entered here (this allows the peak and trough values to be identified, displayed and scanned separately). The location code refers to the patient location; if this box is filled in, the rule set will be applied only to data matching this location code. In the future, a similar hospital code will be available, but this feature isn't implemented yet. Note that LabScanner can confine a particular rule set specifically to a particular location (e.g., an ER or intensive care unit) and apply other rule sets to the same test from other locations. A rule set with a specified location code takes precedence over a rule set for the same test code that has a blank location field. Multiple rule sets targeting one test from different locations should be named in a way that distinguishes them.
LabScanner allows limited processing of tests that have textual results. Text strings and corresponding numbers can be entered into the Text Result Replacement box using its New button. For tests that normally have only textual results, those results can be assigned numbers (i.e., integer values) and rules can be constructed to identify patterns of interest in those numbers. Note that numbers entered here must be positive integers or decimal numbers. Text results in tests that usually have a numerical result can be handled in two ways. Lines containing values such as "pending" or "QNS" can be identified and skipped in data import by entering the values into the Filters in the Input Format Window. Text results can also be replaced by numbers that are not normally reported using Text Replacements, which theoretically could allow construction of rules to respond to those numbers. At the moment, this is a bit unwieldy with respect to rule application and graphics. Results that contain leading text or textual elements (including things like "< 0.03") that are not replaced here are assigned a value of zero for purposes of graphical display and rule application. However, results that have a value of zero are shown in the Patient Display Window data list as the original text from the import file, so representations like "< 0.03" or "less than 1" will be preserved there (though only the first 5 or 6 characters will show).
Ranges contains entry boxes for reference range data. Reference range regions on displayed and printed graphs are derived from these entries. An age range can be specified and thus a rule set can be targeted to a specific patient age range (i.e., separate pediatric rule sets). Like targeted locations, rule sets with specified age ranges take precedence over rule sets for the same test code that do not have age ranges. If a rule set is age-specific, its name should reflect that (i.e., Pediatric Theophylline). Note that rule sets targeted to specific age ranges or locations are entirely separate from other rule sets for the same test, and can have different reference ranges, text replacements, and rule lists.
The Rule Set Window has buttons at the bottom that allow a rule set to be updated or deleted. Note that changes in the Rule Set window are saved to the current rules file when the Update Rule Set button is clicked. If the Rule Set window is closed without clicking the Update button, changes are not saved (this is a quick way to cancel unsaved changes). Overwriting or loss of a rules file will cause loss of all entered rules--making backups of these files is a good idea.
The Rule Set Window (Fig 7, above) displays a list of specific rules at the bottom. These rules can be activated and deactivated individually or in groups by selecting them and clicking the Activate/Deactivate button, similar to the Current Rule Sets Window (Fig 6). If one of the list items is double-clicked, or selected and the Edit button is clicked, the Rule Builder Window for that rule is shown (Fig 8, right). The Rule Builder Window specifies the rule name, which is shown in the list at the bottom of the Rule Sets Window (Fig 7) and also in the list of flagged rules in the Patient Display window and printed reports. It also contains a panel with tabs for each of the main rule categories (Value comparison, Trend, Variability and Frequency). There is also a fifth panel for a special purpose rule that flags peak/trough tests that do not have peak or trough specified (i.e., a "random" draw). The characteristics of individual rules are specified within these panels. Clicking the New button at the bottom of the Rule Sets Window displays an empty RuleBuilder Window that can be used to create a new rule for the list.
Fig 8. Rule Builder Window: Value Rule
Value Rules (Fig 8 above) are defined as a sequence of values of which at least a certain number are greater than, less than, or equal to a specified value (for example: "at least 3 of 5 values greater than 2.2"). Value rules flag as soon as the initial criterium is satisfied: "at least 3 of 5" will flag as soon as three values are above or below the cutoff, whether the three values are sequential, 3 of 4, or 3 of 5. Trend Rules (Fig 9, right) are defined as a sequence of values with an increase or decrease greater than a specified amount per unit of time, and/or a projected value greater than or less than a cutoff value within a specified amount of time, and/or the last value greater than or less than a cutoff (these criteria are independently selectable using the checkboxes in the Rule Builder Window). The slope and projected values are calculated from linear regression across the indicated number of values. Trend rules test the scatter in the data and are not applied to data that is too variable (such data doesn't adequately define a trend and should be assessed using variability rules, below). If the average differences between the specified number of data points is greater than 2/(specified number of data points) times the difference between the first and last points, the pattern will not be assessed as a trend. Variability Rules are defined as a specified sequence of values with an average deviation from the regression line of greater than the indicated amount (not shown). If the average difference between all the values in the sequence is less than the difference between the first and last values, then the sequence will not be evaluated for variability (if anything, it may represent a trend). Frequency Rules are defined simply as more than or fewer than an indicated number of tests (the time span of frequency rules is defined in the bottom of the window, below).
Fig 9. Rule Builder Window: Trend Rule The Timespan and Interval constraints at the bottom of the Rule Builder Window (Figs 8 and 9) are optional for most rules, but required for Frequency rules to be meaningful. In other cases, they are helpful in preventing rules from being applied over timespans that don't make sense (for example, applying rules designed to operate over a week to 4 tests in one day, 4 tests in 9 months, or three tests in a week followed by one more 6 months later). The maximum and minimum Timespan specify a maximum and/or minimum span between the first and last specimens in the sequence; the rule is not applied if the span of the sequence is outside of these bounds. If either the maximum or minimum span boxes are left blank, there is no limit on that end of the timespan. In the case of Frequency tests, a sequence of 4 specimens in 1.5 days would trigger an excess testing rule that had a sequence length of 4 with a maximum span of 2 D (if the timespan of the sequence were longer than 2 days, the rule would not trigger; it would trigger for any span less than 2 days). Similarly, the maximum and minimum intervals are used to test the time difference between each two specimens in the sequence. In this case, intervals that are too long abort processing of that particular sequence in a patient's data. Intervals that are too short cause the earlier of the two specimens to be ignored in assembling the sequence for rule testing (the program merely goes on to test the next earlier value for inclusion in the sequence).
If a rule set is designated as Peak/Trough by entering peak and trough codes into the Rule Set Window (Fig. 7), Rule Builder Windows will include checkboxes to specify whether the rule should be applied to peaks, troughs, both or all values. Figure 9 above illustrates the checkboxes in the lower right of the window. If either the Peak or Trough checkbox is checked, the rule will be applied only to those values. If both Peak and Trough are checked, the rule will be applied to both peak and trough values without distinction, but not to unlabeled ("random") values. If neither checkbox is checked, the rule will be applied to all values. For example, to flag a pattern in which corresponding trough and peak vancomycin values did not change substantially, a variability rule might specify two points with a variability of less than 2, a time span upper bound of 4 hours, and both peak and trough checked.
When the rule is set up as desired, click the Add Rule button to add it to the list in the Rule Set Window. Click the Close button to close the Rule Builder window without adding the rule to the rule set. Note that the rules file and the currently loaded rules are not updated until the Update button in the Rule Sets Window (Fig. 7) is clicked.
Rules are applied to sequences of event values. The process is typically initiated by choosing Full Scan from the Scan Menu. For each rule, the specimen time course for each patient is evaluated as an overlapping set of sequences of the length specified in the rule. Each sequence is tested for span and interval compliance and analyzed to determine whether the rule is satisfied ("triggered"). If the rule is triggered, a record (a "flag") is created marking the initial and final events in the triggering sequence. The initial events are considered "contributing events" and the final event is considered the triggering event. If earlier events are present the sequence is "frame-shifted" repeatedly back in time, adding one earlier event and deleting the most recent event. Each new sequence is evaluated and flagged as above until no earlier specimens are available. Thus the history of rule triggering over all specimens available is recorded. Patients with sequences of consecutive triggering events are considered to show persistent patterns, which have a start event (the first triggering event), an end event (the last triggering event), an event persistence (the number of triggering events in the sequence) and a temporal persistence (the time between the start and end triggering events). These characteristics are enumerated in the Scan Statistics report (see Statistics) and are discussed a bit further in the Patient Display description. When LabScanner is used in a prospective manner, it is useful to log only patterns that involve the most current events. This facility is provided by Scan Most Recent from the Scan Menu, which evaluates only a single sequence ending on the most recent event for each rule.
The types of rules managed by LabScanner are not useful in evaluating pooled data from drugs that are drawn at peaks and troughs because of the inherent variability and irregularity of these profiles. However, the rule frameworks are useful in comparing peak values against other peak values, and trough values vs. trough values. Thus LabScanner treats peak and trough values separately for the purpose of rule application (rules like "3 of 4 trough values above 10" work).
| Last modified: 3/6/01 | LabScanner Home | LabScanner Operation |