Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.Opens in a new tab

For information on migrating to InterSystems IRISOpens in a new tab, see Why Migrate to InterSystems IRIS?

Aviation.UI.Investigator

class Aviation.UI.Investigator extends %ZEN.Component.page

This page represents a mockup interface for typing in new aviation event reports for the Aviation.Event narrative columns. After typing in a report of a few sentences and pressing the "process" button, the system will look for reports similar to the one being typed in using the basic similarity algorithm (first tab) and a slightly more elaborate matching-based approach (second tab). This matching-based approach constructs a simple dictionary based on the contents of what's being typed in (BuildSrcDictionary()) and then finds the report with the highest number of matches against this dictionary. While the basic similarity option (using %iKnow.Queries.SourceAPI.GetSimilar()) is easier to use and has a few options by itself, the matching-based alternative demonstrates how other iKnow API calls can be used together from a simple interface. More specifically, the matching-based approach has the advantage non-exact matches also contribute to the similarity, at the cost of performance and slight over-scoring of simple re-occurring words.

When clicking one of the suggested "similar" reports, a popup shows the basic details of the similar event (time, location, aircraft, link to NTSB report) as well as the the contents of the existing report, with all entities (and CRCs) of the input text highlighted in this similar one. A second tab then reveals the presumed cause of that similar event as recorded by the NTSB, which may "help" the user get an idea of a likely cause for the event being described in his manual input.

Being a code sample, the code is supposed to be quite readable with some comments about what is being achieved by specific line(s) of code, as well as suggesting extensions developers might wish to make to make the demo perform better.

To set up the demo, run the following command from the terminal:

do ##class(Aviation.UI.Investigator).Setup()

Property Inventory

Method Inventory

Parameters

parameter IKNOWCAUSEDOMAINNAME = Aviation Investigator demo - causes;
Default iKnow domain name for event causes
parameter IKNOWREPORTDOMAINNAME = Aviation Investigator demo - reports;
Default iKnow domain name for event reports
parameter PAGENAME = Aviation Event Investigation;
Displayed name of this page.

Properties

property causeDomain as %ZEN.Datatype.integer;
The domain ID for the event causes. Populated during %OnAfterCreatePage().
Property methods: causeDomainDisplayToLogical(), causeDomainGet(), causeDomainIsValid(), causeDomainLogicalToDisplay(), causeDomainLogicalToOdbc(), causeDomainNormalize(), causeDomainSet()
property dictId as %ZEN.Datatype.integer;
The ID of the dictionary created as part of BuildSrcDictionary()
Property methods: dictIdDisplayToLogical(), dictIdGet(), dictIdIsValid(), dictIdLogicalToDisplay(), dictIdLogicalToOdbc(), dictIdNormalize(), dictIdSet()
property filter as %ZEN.Datatype.string (ZENURL = "FILTER");
A filter string to restrict the scope of the similarity search. Either use an InitialExpression or add code to populate this property, similar to the filterPane and associated methods in %iKnow.UI.AbstractPortal
Property methods: filterDisplayToLogical(), filterGet(), filterIsValid(), filterLogicalToDisplay(), filterLogicalToOdbc(), filterNormalize(), filterSet()
property inputSource as %ZEN.Datatype.integer;
The Source ID of the source containing the manual input from the text box. This is a Virtual Source and hence the number will be negative.
Property methods: inputSourceDisplayToLogical(), inputSourceGet(), inputSourceIsValid(), inputSourceLogicalToDisplay(), inputSourceLogicalToOdbc(), inputSourceNormalize(), inputSourceSet()
property reportDomain as %ZEN.Datatype.integer;
The domain ID for the event reports. Populated during %OnAfterCreatePage().
Property methods: reportDomainDisplayToLogical(), reportDomainGet(), reportDomainIsValid(), reportDomainLogicalToDisplay(), reportDomainLogicalToOdbc(), reportDomainNormalize(), reportDomainSet()
property selectedSource as %ZEN.Datatype.integer;
The source ID of the report selected from the "similar reports" list (any tab).
Property methods: selectedSourceDisplayToLogical(), selectedSourceGet(), selectedSourceIsValid(), selectedSourceLogicalToDisplay(), selectedSourceLogicalToOdbc(), selectedSourceNormalize(), selectedSourceSet()
property summaryLength as %ZEN.Datatype.string (ZENURL = "LENGTH");
Length of the report/cause summary to be displayed in the popup.
Property methods: summaryLengthDisplayToLogical(), summaryLengthGet(), summaryLengthIsValid(), summaryLengthLogicalToDisplay(), summaryLengthLogicalToOdbc(), summaryLengthNormalize(), summaryLengthSet()

Methods

method %OnAfterCreatePage() as %Status
Initializes some of the panes and session variables used by this page, fetching domain, source and term variables from the request (if present). This method also verifies if the appropriate domains are present.
method BuildSrcDictionary() as %Status [ ZenMethod ]
Builds/replaces a dictionary based on the contents of the (virtual) source represented by inputSource and stores it into both the reports and the causes domains. The ID of this dictionary (in the reports domain) is stored into dictId.
method DrawEventHeader(pSeed As %String) as %Status

Draws a number of event properties as a header for the popup.

method DrawMetadata(pTable As %ZEN.Component.tablePane, pName As %String, pSeed As %String) as %Status
Utility method to draw source metadata in a <tablePane> column for a given source. pSeed is expected to be the name of the metadata field to display.
method DrawPercentage(pTable As %ZEN.Component.tablePane, pName As %String, pSeed As %String) as %Status
Draws a <tablePane> column's contents as a percentage
method DrawSource(pSeed As %String) as %Status

Draws the contents of a source (report or cause, based on pSeed) as identified by the value of selectedSource. The source is summarized if summaryLength is non-zero (interpreted as the number of sentences) and any matches against the dictionary created by BuildSrcDictionary() is highlighted.

method ExecuteSimilarQuery(pRS As %Library.ResultSet, ByRef tSC As %Status, pInfo As %ZEN.Auxiliary.QueryInfo) as %Boolean
Ensures required parameters are present when calling a GetSimilar() query from the main tables, to avoid noisy errors when the page opens before typing/selecting anything.
method ProcessInput(pText As %String(MAXLEN=32767), pLanguage As %String) as %String [ ZenMethod ]

ZenMethod to process manual user input pText by the iKnow engine and store the ID of the generated Virtual Source in inputSource.

classmethod Setup() as %Status
Sets up the Aviation Investigator demo. If the Standalone Aviation demo was already set up through Aviation.Utils, that domain will be used.
clientmethod displaySourceClient(srcId) [ Language = javascript ]
Client-side method refreshing appropriate sections of the popup window using the srcId passed in.
clientmethod onUpdateFilterClient() [ Language = javascript ]
Client-side utility method to refresh appropriate sections when filter changes.
clientmethod onlayoutHandler(load) [ Language = javascript ]
This client event, if present, is fired when the page is first loaded or whenever it is resized.
If this is called at load time, then load will be true.
clientmethod onunloadHandler() [ Language = javascript ]
Inherited description: This client event, if present, is fired when the page is unloaded. If this method returns a string value, then that is used as the return value of the HTML page's onbeforeunload handler (if more than one component returns a string, the first one encountered is used).
clientmethod realTimeInputClient() [ Language = javascript ]
Client-side method coordinating the processing of user input by invoking ProcessInput() and then refreshing the appropriate sections of the interface.
clientmethod refreshDictionaryAsync() [ Language = javascript ]
Client-side method called asynchroneously from realTimeInputClient() to perform the matching-based similarity search in the background and avoid "freezing" the UI while it runs.
clientmethod resizeGroups(load) [ Language = javascript ]
Utility method to properly position and align the main page components.
clientmethod summarize() [ Language = javascript ]
Client-side method triggered when the user presses the "summarize" button.

Inherited Members

Inherited Properties

Inherited Methods

FeedbackOpens in a new tab