The QC and VTEC ETN on The Text Workstation

                    Xiangbao Jing,  FSL
The text workstation does the quality control checks for a configured warning product before loading or sending it out. A dialog with the check results message will pop up if there is anything incorrect in the product. The user can choose to return to the text window to re-edit, continue sending, or call WarnGen up (the latter not implemented yet). Although, the d2d Warngen assigned a Event Track Number (ETN) in the VTEC line, but it is checked and may reassigned during the sending on the text workstation. Wherever the product come from, an right following up number should be given based the current text DB.

1.0 Quality Control Checks
The quality control checks for severe weather products will be run twice on the text workstation.  When a Warngen product is generated, a draft is automatically produced using the local templates.  The templates are designed to be modified by the local site to create products in the exact format desired. It is impossible to know a priori if the local modifications have been done correctly. When the draft product is created, a warning product edit window pops open on a designated text workstation. A header block is opened which contains the product ID. The user can change the ID if needed. The user normally will click on the Enter button which starts the edit session for that window. (S/he may also select Cancel which leaves the window open with the draft product in it, but does not invoke the editor.) At that time the QC check will be run for the first time. The QC is done based on the product ID. If it finds a discrepancy in the draft product, an error dialog opens detailing the problem, and identifying it as existing in the template. The user has the option of continuing or canceling. If the user continues, the assumption is that s/he will correct the problem during the edit session or will allow the error to exist in the final product. If the user selects Cancel, then the draft is left in the window and the editor is not invoked. Note that the point of this first QC check is to highlight to the user that there is a problem with the local template. While it may not get fixed immediately, it is important that it be addressed so that these errors are not repeated in subsequent episodes. (There may also be a discrepancy caused by the user changing the product ID so that the WarnGen draft product does not match the format of the product ID entered by the user.)
Assuming the user continues, s/he will then edit the product as needed.  When editing is completed, the user may Send, Save, or Cancel. If the user chooses Cancel, the edit session is canceled and the QC check is not run. Normally the product is either saved or sent. At that point the text message is checked by the QC program for the second time. If a discrepancy is detected, an error dialog opens detailing the problem(s). The user may proceed to send or save, or re-enter the editor to fix the problem. (No cancel option is provided since the user can cancel from the editor.) If the user proceeds with sending or saving, the product is sent or saved as is. If the user re-enters the editor, the error messages shall be inserted at the beginning of the product in red (or some other color) to help identify what needs to be corrected. The user will then make the corrections and delete the error section before sending or saving. At that point the QC check is run again with the same results specified above. The QC programs will access certain tables containing pertinent data like the names of counties within the CWA. Since this information changes from WFO to WFO, an assumption is made about the site for which the product is being checked. Normally it will be the local site. However, a site may back up another site; both partial and full backup options are available in WarnGen. If it is in full backup mode, then the information will be different. The site for which the QC will be run will be a parameter written by the WarnGen application to a known location. The text workstation will query that location to know the site ID that should be used. The assumption is that a localization will have been run for any site for which full backup can be done, and that the appropriate tables, etc. have been generated. The D2D will save the site ID in a file if the service backup site ID (local) is different from the data ingest site ID. Thus, the text workstation "knows" which local site ID should be used during QC.

1.1 Open Architecture
The product, QC code, and buttons are configurable. I call this an open architecture. A QC module can be a tcl procedure as internal code or any external executable. Thus, developing the QC code and deciding which products need a warning dialog, UGC line header checks, etc. can be done by forecasters and other developers.

Configuration Table
There is a configuration table file, $FXA_HOME/data/textQC.config, which tells the system what product uses what check code and how to respond to the check results. Its format is,
    NNN Code_Name  Code_Type Send_Warn UGC3 B_GoAhead B_Abort B_WGN B_WRK WarnType                 proc/file)    (EXE/TNT)  Y/N      Y/N   Y/N       Y/N    Y/N     Y/N    string

NNN -- nnn in afos pil, the product;
Code_Name -- executable file name  and arguments of a QC check;
Code_Type -- "EXE", the QC code is a executable file; "INT", the QC code is
              tcl procedure if the there is a code_name, otherwise it's
              the tqc_severeWarnning and or tqc_CheckThirdLineUGC;
Send_Warn -- Whether warning before sending or saving a product;
UGC3 -- Whether to check the UGC on third line. There is no UGC3 check if a
         QC is configured for a product since it is covered.
B_GoAhead -- Set a "Go Ahead" button on the QC dialog.
B_Abort -- Set an "Abort" button on the QC dialog.
B_WGN -- Set a "Go Back to WGN" button on the QC dialog, to turn off the
          WGN window. It's for future's version.
B_WRK -- Set a "Reload WRK" button on the QC dialog, to reloading a wgn
          work file, and restart the WGN.
WarnType -- A string for warning.
 
The example is,
NNN    Code_Name               Code_Type  Send_Warn UGC3   B_GoAhead B_Abort B_WGN B_WRK WarnType
        (proc/file)                 (EXE/TNT)  Y/N       Y/N    Y/N       Y/N     Y/N    Y/N    string
TOR    {localWarningInfoTest TOR}   EXE       Y         N      Y         Y       N     N    {Tornado Warning}
SVR    {localWarningInfoTest SVR}   EXE       Y         N      Y         Y       N     N    {Severe Thunderstorm Warning}
SVS    NONE                     INT        Y         Y      Y         Y       N     N    {Severe Weather Statement}
FFW    {localWarningInfoTest FFW}   EXE       Y         N      Y         Y       N     N    {Flash Flood Warning}
FFS     NONE                     INT       Y         Y      Y         Y       N     N    {Flash Flood Statement}
SMW    {localWarningInfoTest SMW}  EXE       Y         N      Y         Y       N     N    {Special Marine Warning}
MWS    NONE                     INT       Y         Y      Y         Y       N     N    {Marine Weather Statement}
SLS     NONE                     INT       Y         Y      N         Y       N     N    {Watch Box Areal Outline}


How to Catch the Site ID for Service Back up
The local site ID is stored in $FXA_DATA/textWSwork/WRKWGn.locId; WarnGen creates this file only when the local site ID is different from the ingest site.

1.2 Real QC check - The LocalWarningInfo Class
This is the implementation of the class LocalWarningInfo which is shared by WGN follow up and quality control checks(QC).
To implement the RWP 0288 Minimum Requirements for 2003 Severe Weather Season, perform the following QC checks:

Currently, only the warning products of the TOP, SVR, SMW and FFW are checked by the QC.
 
2.0 QC for VTEC ETN 

The VTEC ETN
The text workstation performs the VTEC event tracking number QC and assign a right ETN during sending a warning product. Why do so on the text workstation? In a text display editor, a sending product can be a loaded from the text DB(WGN generated or user saved) or a manually created. During the editing, the ETN may be changed,  the latest ETN in text DB is changed ( some one sent same product out from another workstation), or two forecaster are sending same product at same time. To insure a right ETN, we should assign it during transmission.

When the loading a product into the text editor, text WS decodes all new vtec lines, buffers the product types and etns in order. The format like,
      set Wetns  {{FFW 0101} {SVR 0233}}
This is the the original ETNs from WGN or user created product stored in the text DB. The Wetns will be empty when user creating new product in the editor which the case is complex, however, the Wetns is cleared loading a product, and when entering the editor, the Wetns is cleared too if the message body is less than 50 chars.
After doing QC and before sending, the text WS decodes all new vtec lines in the sending product text, get product types and etns as the user edited (Uetns). It's format and or order should be same as the Wetns, and they are matched.
For each product type in the Uetns, we search the text DB to get the latest DBetn. The Wetn should same as DBetn + 1.
The default etn(Detn) usually is Wetn, but in case the is no Wetn or the is less then DBetn + 1, the DBetn + 1 is the Detn.
The etn will be automatically assign to 0001 each year and during specified switch time(in file VTECparsingInfo.txt).
User should select or reedit the etn if the original etn is difference than Uetn, or failed to read the text DB.
In any case, use the DBetn + 1 as the sending etn if the selected etn is smaller tha the DBetn + 1, except the selected etn is 0001.
User will be warned by a popped up dialog in any case that needing the user to make a decision such as which etn should be used, should go back to the editor.
Before do the vtec etn check, a warning sending collision check will be performed. The sending will be delay if another sending is in progress.
The file $FXA_DATA/textWSwork/vtecInSendNNN.locId is a sending flag. A sending process creates this flag and deletes it after the sending and storing into the text DB.

(The draft has not been completed)