Formatting a CSV for View Import

From PHENOM Portal Knowledgebase
Jump to navigation Jump to search

To bulk import view characteristics, the CSV file should be formatted as described in this article.

General Column/Data Requirements

The following column headers must exist and contain data in each row:

  • View_Name
  • Characteristic_Name
  • Primitive
  • Source
  • Path
  • Measurement

The following columns are optional (for example, the Package columns are only there to specify destination if desired):

  • Package_Name
  • Package_Description
  • Package_Tags
  • View_Description
  • View_Tags
  • Characteristic_Description
  • Characteristic_Tags
  • Lower_Bound
  • Upper_Bound
  • Nested_View

The order of the columns is not enforced, it does not have to be in the same order as the suggested format above.

Any additional user-made columns will be ignored and will not interfere with import.

Bulk import can currently import Package, View, and Characteristic elements.

Column-specific Requirements

Package Name

  • Leaving this column blank will default Package to the "Phenom" package.
  • Setting this column to an existing Package will default to the first matching Platform Package within the model.
  • If there is no matching Package, a new Package will be created within the "Phenom" Package.

Package Description

Package Description will be imported for new Packages only. Only the first Description for new Packages will be imported.

View Name

The data in this column for an existing View will be matched to the first View of that name within the model (there should only be one match). If there isn't a matching View, a new View will be created within the "Phenom" Package.

View Description

View Description will be imported for new Views only. Only the first Description for new Views will be imported.

Characteristic Name, Characteristic Description

  • Characteristic Names must be unique to the View they are imported under.
  • The Characteristic must not already exist in the desired View
  • Characteristics belonging to different Views may have the same name.

Primitive

This column isn't case sensitive. Acceptable values: "Char", "Double", "Float", "Long", "Short", "String", "ULong", "UShort", "Octet", "Enumeration".

Source, Path, Measurement

  • Source must exist in the model and must be the Entity/Association projected from the last element in the Path column.
  • Path must have valid elements leading up to/ending with the Observable realized by the Measurement.
  • Measurement must in the model and realize the Observable at the end of the Path.

For example: AirSystemType is projected (through payload) from elementID which is realized by UniqueID_Unbounded_Integer'

Lower Bound and Upper Bound

  • This row must have both a Source and a Path for these values to be valid

Nested View

  • The Nested View must exist in the model and must be the name of a View.
  • See Nested Views for changes to other columns

Tagging New Elements (Optional)

Package_Tags, View_Tags, and Characteristic_Tags optional columns can be used to tag new Packages, Views, or Characteristics. Each field can have multiple comma-delimited tags.

The raw CSV must have quotes around fields with commas (Excel normally handles this).

Package_Tags will tag whichever package is chosen - this includes the Phenom package when a package isn't specified in the Package_Name column.

Nested Views

By referencing the name of another view, whether already existing in the model or being added by the same CSV file, in the Nested_View column, the import can create view sub-structuring or nesting.

In view field rows representing nested views, the Source and Path columns represent the perspective path under which the view sub-structure is nested. At the same time, the Primitive, Platform_Type, and Measurement are not applicable.

By default, all sub-structure nesting view field rows will be inferred to be representing a "private" nesting. This can be made explicit, or toggled off to accomplish a sub-structure import, by using the Characteristic_Foreign column: if set to "false", the view sub-structure will be private to its nesting view, and an independent import if set to "true".

Additional Requirements

  • Data within Package_Name, View_Name, and Characteristic_Name must all begin with a letter, and only contain numbers, letters, or underscores. The data must also not match any of the following reserved words:
    • IDL Reserved words:

      "and", "begin", "break", "case", "common", "compile_opt", "continue", "do", "else", "end", "endcase", "endelse", "endfor", "endforeach", "endif", "endrep", "endswitch", "endwhile", "eq", "for", "foreach", "forward_function", "function", "ge", "goto", "gt", "if", "inherits", "le", "lt", "mod", "ne", "not", "of", "on_ioerror", "or", "pro", "repeat", "switch", "then", "until", "while", "xor"

    • OCL Reserved words:

      "abstract", "any", "attribute", "boolean", "case", "char", "component", "const", "consumes", "context", "custom", "default", "double", "emits", "enum", "eventtype", "exception", "factory", "false", "finder", "fixed", "float", "getraises", "home", "import", "in", "inout", "interface", "local", "long", "manages", "module", "multiple", "native", "object", "octet", "oneway", "out", "primarykey", "private", "provides", "public", "publishes", "raises", "readonly", "sequence", "setraises", "short", "string", "struct", "supports", "switch", "true", "truncatable", "typedef", "typeid", "typeprefix", "union", "unsigned", "uses", "valuebase", "valuetype", "void", "wchar", "wstring"

  • New Views not already within the model must be unique among elements of type IDLStruct and Enumeration.
  • Multidimensional Measurements are supported, however each axis will default to the primitive found within the primitive column (these can be corrected within Phenom later if desired).
  • If there are any errors during validation of the CSV file, the model import will not be initiated and a list of errors will be returned. They will be labeled by the row they occur on for convenience.
  • There is a 2MB limit in place - if a larger file needs to be imported, it needs to be split up into smaller files.
  • In the raw CSV (i.e., as observed from notepad), any field with commas must have surrounding quotes (Excel normally handles this).