Using an Import Definition File

Use an import definition file to customize how .csv file data is imported into your system. The process requires two files: the source data file (.csv) and the import definition file (.idf), which is referenced via the import command parameters.

The .idf file is an XML file that is used to define custom conditions for a .csv file import. Use an .idf file during the import process to set the data source to show whether the imported file contains raw data or not, to specify what columns are required for the import, to define or override units for specific items, or to customize column header names by mapping each default column header name (FMS enumeration value) to a new column header name (user-provided value).

For history import files, a file collection time can also optionally be defined using the .idf file, and data aggregation must be defined using the .idf file for certain conditions.

See the following command configuration topics for more information about preparing and importing .csv files that may utilize an .idf file.

Setting Up Import File Folders

If you will be performing more than one type of file import, a simple way to set up your import folders is to make parallel folders in your chosen directory location. Create a separate folder for each CSV file type you will be importing, and clearly name each folder to reflect the appropriate type of data (shown in the following example as Configuration_Gas, Configuration_Liquid, Gas_Analysis, Gas_Quality, History_Gas_Periodic, History_Liquid_Periodic, and History_Ticket). Each folder would then contain its own "Failed" sub-directory, "Processed" sub-directory, and a properly configured data-type-specific IDF file, renamed to match the data type as necessary (for configuration or history data).

Note: For Configuration_Gas and Configuration_Liquid, you must rename the IDF to CxFmsImportCsvConfig.idf. For History_Gas_Periodic, History_Liquid_Periodic, and History_Ticket, you must rename the IDF to CxFmsImportCsvHistory.idf. The FMS expects these specific filenames.

Example

Import Definition Files

Renaming a Configuration or History Import Definition File (IDF)

CygNet Measurement provides separate samples of configuration and history IDF files, to be used for the various types of data you are importing. Although the sample files are given distinct names for identification purposes, the files must be titled CxFmsImportCsvConfig.idf and CxFmsImportCsvHistory.idf in order for the service to find the file. Therefore the words "Gas" or "Liquid" (for configuration data) or "GasPeriodic" or "LiquidPeriodic" or "Ticket" (for history data) must ultimately be deleted from your working IDF file name(s). For configuration data, sample files are provided for gas (CxFmsImportCsvConfigGas.idf) and liquid (CxFmsImportCsvConfigLiquid.idf) data. For history data, sample files are provided for gas periodic (CxFmsImportCsvHistoryGasPeriodic.idf), liquid periodic (CxFmsImportCsvHistoryLiquidPeriodic.idf), and ticket (CxFmsImportCsvHistoryTicket.idf) data.

Creating the Import Definition File (IDF)

CygNet provides sample files you can adjust and use to create IDFs for new imports. Sample .idf files are located in the CygNet\Services\FMS\ImportSamples folder on your host server.

General Import Definition File Requirements

The following general requirements apply to Import Definition Files.

Import Definition File Structure

The structure of an .idf file for importing gas configuration data is shown in the following example.

<FileImportDefinition textFilesTrusted="true">

<ColumnMapping name="Device" enum="Device" required="true"/>

<ColumnMapping name="DateTime" enum="ConfigDateTime" required="true"/>

<ColumnMapping name="AGA3ExpRange" enum="eFMS_CFG_AGA3_EXPANDED_RANGE" required="true">

<ValueMapping name= "Yes" enum= "eYESNO_YES"/>

<ValueMapping name= "No" enum= "eYESNO_NO"/>

</ColumnMapping>

<ColumnMapping name="RelativeDensity" enum="eFMS_CFG_RELATIVE_DENSITY" required="true"/>

<ColumnMapping name="Methane" enum="eFMS_CFG_METHANE" required="true" units="%"/>

<ColumnMapping name="Nitrogen" enum="eFMS_CFG_NITROGEN" required="true" units="%"/>

...

</FileImportDefinition>

The structure of an .idf file for importing liquid configuration data is shown in the following example.

<FileImportDefinition textFilesTrusted="true">

<ColumnMapping name="Device" enum="Device" required="true"/>

<ColumnMapping name="DateTime" enum="ConfigDateTime" required="true"/>

<ColumnMapping name="EndDateTime" enum="EndDateTime" required="false"/>

<ColumnMapping name="AtmPress" enum="eFMS_CFG_ATMOSPHERIC_PRESSURE" required="true" />

<ColumnMapping name="CalibrationFactor" enum="eFMS_CFG_CALIBRATION_FACTOR" required="true"/>

<ColumnMapping name="ContractHour" enum="eFMS_CFG_CONTRACT_HOUR" required="true"/>

<ColumnMapping name="DPAlarmHigh" enum="eFMS_CFG_DP_ALARM_HIGH" required="true"/>

<ColumnMapping name="DPAlarmLow" enum="eFMS_CFG_DP_ALARM_LOW" required="true"/>

<ColumnMapping name="DPBackflowAlarm" enum="eFMS_CFG_DP_BACKFLOW_ALARM" required="true"/>

<ColumnMapping name="DPCalibrateHigh" enum="eFMS_CFG_DP_CALIBRATE_HIGH" required="true"/>

<ColumnMapping name="DPCalibrateLow" enum="eFMS_CFG_DP_CALIBRATE_LOW" required="true"/>

<ColumnMapping name="DPTapsType" enum="eFMS_CFG_DP_TAPS_TYPE" required="true">

<ValueMapping name= "Flange" enum= "eFMS_CFG_DP_TAPS_TYPE_FLANGE"/>

<ValueMapping name= "Pipe" enum= "eFMS_CFG_DP_TAPS_TYPE_PIPE"/>

</ColumnMapping>

...

</FileImportDefinition>

The structure of an .idf file for importing gas periodic history data, using the fileCollectionTime property, is shown in the following example.

<FileImportDefinition textFilesTrusted="false" fileCollectionTime="T-3">

<ColumnMapping name="DataNode" enum="Device" required="true"/>

<ColumnMapping name="SampleDate" enum="BeginDateTime" required="true"/>

<ColumnMapping name="PressDiff" enum="eFMS_PV_DIFF_PRESSURE" required="false"/>

<ColumnMapping name="PressStatic" enum="eFMS_PV_LINE_PRESSURE" required="false"/>

<ColumnMapping name="Air%" enum="eFMS_PV_AIR" aggregation="Average" required="false"/>

...

</FileImportDefinition>

The structure of an .idf file for importing liquid periodic history data, using the fileCollectionTime property, is shown in the following example.

<FileImportDefinition textFilesTrusted="false" fileCollectionTime="T-3">

<ColumnMapping name="Meter" enum="Device" required="true"/>

<ColumnMapping name="BeginDate" enum="BeginDateTime" required="true"/>

<ColumnMapping name="EndDate" enum="EndDateTime" required="true"/>

<ColumnMapping name="IV" enum="eFMS_PV_INDICATED_VOLUME" required="false"/>

<ColumnMapping name="BaseDensity" enum="eFMS_PV_BASE_DENSITY" required="false"/>

<ColumnMapping name="ObservedDensity" enum="eFMS_PV_OBSERVED_DENSITY" required="false"/>

<ColumnMapping name="DensityPressure" enum="eFMS_PV_DENSITY_PRESSURE" required="false"/>

<ColumnMapping name="DensityTemperature" enum="eFMS_PV_DENSITY_TEMP" required="false"/>

<ColumnMapping name="PulsesBegin" enum="eFMS_PV_PULSES_BEGIN" required="false"/>

<ColumnMapping name="PulsesEnd" enum="eFMS_PV_PULSES_END" required="false"/>

<ColumnMapping name="SWPercent" enum="eFMS_PV_SW_PERCENT" required="false"/>

...

</FileImportDefinition>

The structure of an .idf file for importing ticket history data, using the fileCollectionTime property, is shown in the following example.

<FileImportDefinition textFilesTrusted="false" fileCollectionTime="T">

<ColumnMapping name="Node" enum="Device" required="true"/>

<ColumnMapping name="TicketDate" enum="TicketDateTime" required="true"/>

<ColumnMapping name="TicketName" enum="eFMS_TICKET_NAME" required="false"/>

<ColumnMapping name="TicketType" enum="eFMS_TICKET_DEVICE_TYPE" required="false"/>

<ColumnMapping name="TransportType" enum="eFMS_TICKET_TRANSPORT_METHOD" required="false"/>

...

</FileImportDefinition>

Import Definition File Elements

The following .idf file elements can be used to custom define options in your configuration file import.

Note: XML elements used in .idf files are case sensitive, unless noted otherwise.

The FileImportDefinition element is the root element of the XML file. The properties of this element are as follows.

The ColumnMapping element defines each column header. The properties of this element are as follows.

Back to top