Jonathan Kung February 5, 2007

Offline ECG Analysis: File Formats Documentation

This document provides specifications for the various new file types associated with the Offline ECG Analysis (OEA) application. They are:

1)  Pattern Save

2)  Session Save

Before viewing this document, readers should already be familiar with the associated OEA prototype movie. Reviewing and using the extended documentation associated with the prototype is also recommended.

This document makes references to the contents of the OEA database tables template file.


PATTERN SAVE

The pattern save file (extension .OPAT) is used to saved patterns that are added to the library for the purposes of beat matching. They are saved via the “beat adding” mode and can be viewed from the “library” tab of the program. They are used by the application to process pattern matches against the beats in a RAW file.

Programmers: The format and parameters of this file closely follow that of the .PTN file generated by the PRT. Both the .PTN format and the PRT code used to generate it should be used as references.

Comments in the sample .OPAT file below are preceded by ‘//’, written in light grey, and should not appear in the actual file:


PATTERN SAVE (continued)

Database Tables:

The associated database table (entitled ‘OEA Patterns’) contains some fields that will not actually be implemented in the initial release. They are described below:

Description:

Used by the user to input a long custom description of the pattern being saved. Ideally this would be entered at the time of the pattern save, but it could also be saved/edited later on once the pattern has already been added to the library.

PatternTags:

Same feature as the pattern tagging feature seen in the PRT 1.0.0.6. For each pattern entered into the library, any number of ‘tags’ can be associated to it. Users can then search their library using any tag name. The idea is to give users a system of categorization that is customized (since they decide the tags) and that is as easy or as advanced as they wish: meticulous users may wish to apply many detailed tags for in-depth searching (e.g. “no p wave”, “small r wave”, etc.) while others may simply be interested in organizing using very simple tags (e.g. “good”, “arrhythmia”, etc.). This system allows for a lot of creativity in its usage beyond categorization: for instance, tagging a user’s name to a pattern as a means of assigning it to them, or tagging ‘incomplete’ to a pattern that needs to be worked on further.

Implementation: When new tags are added to a pattern, those tags are first added to the ‘OEA PatternTags’ table which simply keeps a listing of all the names of used pattern tags. Each tag is assigned a reference number here and it is only the reference number that is technically associated with the pattern in the ‘OEA Patterns’ tag. Therefore if a user adds a pre-existing tag to a pattern no new entry is needed in the PatternTags table.

It is imperative that implementation of tagging encourages and facilitates the re-using of tags otherwise there is the danger of users adding multiple tags with similar meanings (e.g. “no p wave”, “p missing”) which would negate the benefits of tagging.


SESSION SAVE

The session save file allows the user to save their current pattern matching progress for a given session/channel. The information contained in this file should allow the program to reconstruct all three tabs at the time of the save: beat search tab, tab, and library.

This file also acts as a readable beat file for its associated channel for other applications such as VR2, thereby eliminating the need for separate save and export files.

File Naming:

The filename itself is copied from the loaded experiment’s name – to follow the beat file format used by CA Recorder. The file’s extension is based on the same naming convention: a two-letter file type designator followed by a number designating the channel. Initial version will only support ECG.

Analysis Type / Carnet-generated beat file / OEA-generated beat file
ECG (PhEAT / ECGRO) / .EKx / .EKxx / .EAxx

Example: A saved OEA file generated from an ECG channel 2 of experiment ‘MyExperiment’ would be named ‘MyExperiment.EA2’ and placed in the root experiment directory of ‘MyExperiment’.

File Format:

The format of the session save file should closely follow that of the beat files generated by Carnet since: i) the bulk of all files will be composed of individual beat information, and ii) the eventual output will follow the Carnet beat file format (see export description).

Below is a list of information that will need to be stored in the save session files. The exact format of how this information will be stored in the file will ultimately be determined by the programmer(s) to best accommodate the pre-existing beat file format (which will make up the majority of the file’s data):


SESSION SAVE (continued)

File Format (continued):

General information (used to load the raw file and appropriate channel(s))

·  RAW file (pointer)

·  Configuration file (pointer)

·  Subject

·  Analysis channel

·  Reference channel (if applicable)

Beat Search (information relating to the ‘beat search’ tab)

·  Start time

·  End time

·  Reference delay

·  [BNA settings] (to be determined by programmer(s))

Library Tab (information relating to the ‘library’ tab)

·  Array of already matched patterns, with each entry including:

o  Pattern name

o  # of matched beats found

o  Tolerance used for matching

Per Beat (information must be able to be saved/loaded for each individual beat)

·  Beat number

·  Designation (BNA, pattern match name, no pattern match)

·  Beat start time

·  Beat length or end time

·  Heart rate (does not need to be stored if it can be calculated from params)

·  *SNA (not a ‘beat’ but areas of SNA must be shown in the RAW display upon load: any area of 3 or more seconds between found beats)


SESSION SAVE (continued)

File Format – Note to Programmer(s)

This same file will be used by other applications such as VR2 which have no need for the fields “general information”, “beat search”, and “library tab”. Since these applications already have code to read pre-existing beat files, the goal of designing these new OEA save files should be to minimize changes from the original beat files format as much as possible. In discussions with Sam, it was recommended then that the OEA-saved beat files should follow their pre-existing Carnet counterpart beat file format, with the addition of an extra header where the OEA-specific fields may be saved.

For instance, the current .EKx files have the following format:

*.EK%c

·  Header (length = 200bytes)

“%c %s %2.2ld-%2.2ld-%4.4ld %2.2ld:%2.2ld:%2.2ld %6.6d %4.4d 1 %s %s” FilterLength

·  Data (C 388 | D 392 bytes/record)

RthreshAdTime(long, 4) (R Wave Sample count),

(RthreshTimeSeconds(float, 4)), //Added_Only_For_Type_D

vecgStatus[64] (short, 2),

vecgResults[64] (float, 4)

The OEA’s .EAx file could utilize almost the exact same format, but with the addition of a second header that could contain the OEA-specific fields. VR2 and other applications then would require very little change to read these, e.g. if the file is an .EAx, ignore the second-header and then read like a regular beat file.

Database Tables:

The associated database table (entitled ‘OEA Session’) contains some fields that will not actually be implemented in the initial release. They are described below:

SessionName:

This will be implemented in future versions of the software when we allow users to begin saving multiple versions of each channel of an experiment. In the initial release version we only allow a single version of each so there is no need for unique filenames since their experiment + channel number will make each unique.

Folder:

This will likely be implemented the same time as the SessionName folder. This field anticipates the move to a VR2-themed manner of organizing the OEA files such as creating a hard-coded folder within the root experiment directory and placing all OEA in sub-folders within this folder.

Page 1 of 6