Create a classification schema

Before you can assign a classification schema to your organization, you must create it by defining the configuration options for the classification in a valid JSON file. The classification schema you create must adhere to the classification grammar, a JSON schema included with Portal for ArcGIS, that describes and validates classification schemas.

Depending on your organization’s needs, you can create a simple schema that, at minimum, defines only the required properties or a complex schema that uses ArcGIS Arcade expressions for highly detailed classification of items. See a complete example of a classification schema below or download sample schemas from the ArcGIS/Classification GitHub repository.

Note:

The examples below and sample schemas in the ArcGIS/Classification GitHub repository are meant to be used as references to create a classification schema that meets your organization's needs.

When creating a classification schema, start by defining the following properties:

Note:

A property is optional unless specified otherwise.

Note:

Arcade expressions do not support the < and > characters.

  • name—A required property that identifies the name of the classification schema.
  • version—A required property that identifies the version of the classification schema.
  • grammarVersion—A required property that specifies the version of the classification grammar the schema adheres to. You can find the classification grammar version by browsing to Organization > Settings > Items > Item classification on the portal website.
  • helpToolTip—The help text that appears when you hover over the Information button Information at the top of the classification form.
  • helpURL—The URL of the schema help document that opens on a new tab when you click the Information button Information at the top of the classification form.
  • bannerExpression—The classification information that appears under Classification on the item page. You can use Arcade expressions to create banner text or set the value to an empty string to implement generic encoding logic defined for uiElements in the classification form (for example, bannerOrder, bannerLabel, and labelDelimiter).
    Note:

    If you omit this property or define it as an empty string, you must have at least one attribute with bannerOrder defined to implement generic encoding logic.

  • selectionTextExpression—The classification information that appears on the Edit Classification dialog box. You can use Arcade expressions to create banner text or set the value to an empty string to implement generic encoding logic defined for uiElements in the classification form (for example, selectionDisplayOrder, selectionDisplayLabel, and labelDelimiter).
    Note:

    If you omit this property or define it as an empty string, you must have at least one attribute with selectionDisplayOrder defined to implement generic encoding logic.

  • attributeCategories—The list of attribute categories that appear as sections or tabs in the classification form.
    Note:

    The word default is a reserved keyword and cannot be used as an attribute category.

{ 
  "name": "academic-institution-classification-schema", 
  "version": "2.0", 
  "grammarVersion": "2.0", 
  "helpURL": "https://ansible.hynes.com/portal/home/schema_help.pdf", 
  "helpTooltip": "Click to open the schema help document", 
  "bannerExpression": "", 
  "selectionTextExpression": "", 
  "attributeCategories": [] 
}

Define classificationMetadata

The required classificationMetadata object can include the following properties:

  • primaryAttribute—A required property that identifies the attribute that appears as the primary classification field in the classification form.
  • defaultValue—A required property that specifies the default value for the primaryAttribute property.
  • classificationValueProperties—A required array of objects in which each object represents a classification option of the attribute identified as the primaryAttribute value and defines specific properties for the option. The following properties can be defined for each classification option:
    • value—A required property that specifies the label for the option used in the classification form.
    • acronym—The acronym for the option.
    • textColor—When the option is selected, its label appears in this color under Current Selections in the classification form. The color can be specified with predefined color names or with RGB and HEX values.
    • backgroundColor—When the option is selected, its label is highlighted in this color under Current Selections in the classification form. The color can be specified with predefined color names or with RGB and HEX values.
{ 
... 
 
"classificationMetadata": { 
    "primaryAttribute": "classification", 
    "defaultValue": "Public Data", 
    "classificationValueProperties": [ 
      { 
        "value": "Public Data", 
        "acronym": "Public Data", 
        "backgroundColor": "Green", 
        "textColor": "Black" 
      }, 
      { 
        "value": "Restricted", 
        "acronym": "Restricted", 
        "backgroundColor": "Yellow", 
        "textColor": "Black" 
      }, 
      { 
        "value": "Confidential", 
        "acronym": "Confidential", 
        "backgroundColor": "Red", 
        "textColor": "Black" 
      } 
    ] 
  } 
}

Define attributes

Each attribute defined in the required attributes object corresponds to an input field in the classification form. The following properties can be defined for each attribute:

  • label—A required property that specifies the label for the attribute used in the classification form.
  • description—The description used as a placeholder in the input field.
  • type—A required property that identifies the attribute's data type. Supported data types are string, date, integer, float, and Boolean.
  • isRequired—A Boolean (true or false) value that specifies whether the attribute is required. It cannot be defined as an empty string.
  • uiElement—A required property that identifies the attribute’s UI element type in the classification form. The seven possible values are as follows:
    • text—A single-line text box.
    • checkbox—A standard check box.
    • date—A date picker that allows you to select a date from the calendar in the format DD/MM/YYYY.
    • single-select—A drop-down menu that allows you to select a single option.
    • multi-select—A drop-down menu that allows you to select multiple options.
    • multi-grouped-select—A drop-down menu that allows you to select individual options from groups of related options but not the top-level groups themselves.
    • multi-grouped-select-nested—A drop-down menu that allows you to select groups of related options or individual options from those groups.
  • defaultValue—The default value assigned for the attribute. This property can only be set for the single-select, multi-select, multi-grouped-select, and multi-grouped-select-nested uiElement types.
  • defaultDateTimeline—Used in combination with defaultDateTimelineUnits to set the default date for the attribute. This property can only be set for the date uiElement type.
  • defaultDateTimelineUnits—Used in combination with defaultDateTimeline to set the default date for the attribute. The possible values are years, months, and days. This property can only be set for the date uiElement type.
  • validValues—The list of options that appear in single-select or multi-select uiElement type drop-down menus in the classification form. It can be defined as an empty string if the options are generated by the Arcade expression for valueExpression.
  • validValuesMap—The map of options that appear in multi-grouped-select or multi-grouped-select-nested uiElement type drop-down menus in the classification form. It can be defined as an empty string if the options are generated by the Arcade expression for valueExpression.
  • valueExpression—An Arcade expression that returns a list of options when validValues and validValuesMap are not defined or defined as empty strings.
  • isAttributeEnabled—An Arcade expression that returns a Boolean value that specifies whether the attribute will appear or be hidden in the classification form.
  • attributeValidation—An Arcade expression that returns either an empty string or an error message based on the value selected for the attribute in the classification form.
  • arcadeResultLookup—A map of keys and values that allows the Arcade expression defined for valueExpression to generate the list.
  • attributeCategory—The attributeCategories section or tab under which the attribute appears in the classification form.
  • selectionDisplayOrder—The order in which the attribute appears in the selectionTextExpression text.
    Note:

    You must define this property for at least one attribute in the classification if you omit selectionTextExpression or define it as an empty string.

  • selectionDisplayLabel—The label for the attribute used in the selectionTextExpression text.
  • bannerOrder—The order in which the attribute appears in the bannerExpression text.
    Note:

    You must define this for at least one attribute in the classification if you omit bannerExpression or define it as an empty string.

  • bannerLabel—The label for the attribute used in the bannerExpression text.
  • labelDelimiter—The delimiter that separates the attribute’s label and value in the selectionTextExpression and bannerExpression texts.
  • valueDelimiter—The delimiter that separates the values selected in a multi-select uiElement type when they appear in the selectionTextExpression and bannerExpression texts.
  • attributeDelimiter—The delimiter that separates the attribute and its preceding attribute in the selectionTextExpression and bannerExpression texts.
  • labelTooltip—The help text that appears when you hover over the Information button Information next to the attribute’s label.
{ 
... 
 
"attributes": { 
    "classification": { 
      "label": "Classification", 
      "description": "Classification", 
      "type": "string", 
      "uiElement": "single-select", 
      "validValues": [{"label": "Public Data", "value": "Public Data"}, {"label": "Restricted", "value": "Restricted"}, {"label": "Confidential", "value": "Confidential"}], 
      "selectionDisplayOrder": 1, 
      "bannerOrder": 1, 
      "labelDelimiter": "", 
      "valueDelimiter": "-", 
      "attributeDelimiter": ";" 
    }, 
    "program": { 
      "label": "Program", 
      "description": "Program", 
      "type": "string", 
      "uiElement": "single-select", 
      "valueExpression": "function getProgramValidValues(schemaJsonString, valueJsonString, attributeId) {\n    var valueJson = Dictionary(valueJsonString)\n    var schemaJson = Dictionary(schemaJsonString)\n    if (!HasKey(valueJson, \"classification\"))\n        return null;\n    if (valueJson.classification == \"Public Data\")\n        return schemaJson.attributes[attributeId].arcadeResultLookup[\"Public_Data_List\"];\n    if (valueJson.classification == \"Restricted\")\n        return schemaJson.attributes[attributeId].arcadeResultLookup[\"Restricted_List\"];\n    if (valueJson.classification == \"Confidential\")\n        return schemaJson.attributes[attributeId].arcadeResultLookup[\"Confidential_List\"];\n    return null;\n}\ngetProgramValidValues(schemaJsonString, valueJsonString, attributeId)", 
      "arcadeResultLookup": { 
        "Public_Data_List": [{"label": "Intra-agency", "value": "Intra-agency"}, {"label": "Marketing", "value": "Marketing"}, {"label": "Promotional", "value": "Promotional"}], 
        "Restricted_List": [{"label": "Compliance", "value": "Compliance"}, {"label": "Financial", "value": "Financial"}, {"label": "Human Resources", "value": "Human Resources"}, {"label": "Market Data", "value": "Market Data"}, {"label": "PII", "value": "PII"}, {"label": "Proprietary", "value": "Proprietary"}], 
        "Confidential_List": [{"label": "Intellectual Property", "value": "Intellectual Property"}, {"label": "Legal", "value": "Legal"}, {"label": "Security", "value": "Security"}] 
      }, 
      "selectionDisplayOrder": 2, 
      "bannerOrder": 2, 
      "labelDelimiter": "", 
      "valueDelimiter": "-", 
      "attributeDelimiter": ";" 
    } 
  } 
}

Define layouts

The required layouts object specifies the order in which attributes appear in the classification form. It can include the following:

  • default—The object that includes the details of a specific layout. You can define the following property within the object:
    • layoutElements—A required object that maps attributes and their order in the classification form. The following property can be defined for each attribute in the object:
      • formDisplayOrder—A required integer that identifies the order in which the attribute appears in the classification form.
{ 
... 
 
"layouts": { 
    "default": { 
      "layoutElements": { 
        "classification": { 
          "formDisplayOrder": 1 
        }, 
        "program": { 
          "formDisplayOrder": 2 
        } 
      } 
    } 
  } 
}

Complete example

The following is a complete example of a classification schema:

Note:

The example schema below and sample schemas in the ArcGIS/Classification GitHub repository are meant to be used as references to create a classification schema that meets your organization's needs.

{  
  "name": "academic-institution-classification-schema",  
  "version": "2.0",  
  "grammarVersion": "2.0",  
  "helpURL": "https://ansible.hynes.com/portal/home/schema_help.pdf",  
  "helpTooltip": "Click to open the schema help document",  
  "bannerExpression": "",  
  "selectionTextExpression": "",  
  "attributeCategories": [], 
  "classificationMetadata": {  
    "primaryAttribute": "classification",  
    "defaultValue": "Public Data",  
    "classificationValueProperties": [  
      {  
        "value": "Public Data",  
        "acronym": "Public Data",  
        "backgroundColor": "Green",  
        "textColor": "Black"  
      },  
      {  
        "value": "Restricted",  
        "acronym": "Restricted",  
        "backgroundColor": "Yellow",  
        "textColor": "Black"  
      },  
      {  
        "value": "Confidential",  
        "acronym": "Confidential",  
        "backgroundColor": "Red",  
        "textColor": "Black"  
      }  
    ]  
  }, 
  "attributes": {  
    "classification": {  
      "label": "Classification",  
      "description": "Classification",  
      "type": "string",  
      "uiElement": "single-select",  
      "validValues": [{"label": "Public Data", "value": "Public Data"}, {"label": "Restricted", "value": "Restricted"}, {"label": "Confidential", "value": "Confidential"}],  
      "selectionDisplayOrder": 1,  
      "bannerOrder": 1,  
      "labelDelimiter": "",  
      "valueDelimiter": "-",  
      "attributeDelimiter": ";"  
    },  
    "program": {  
      "label": "Program",  
      "description": "Program",  
      "type": "string",  
      "uiElement": "single-select",  
      "valueExpression": "function getProgramValidValues(schemaJsonString, valueJsonString, attributeId) {\n    var valueJson = Dictionary(valueJsonString)\n    var schemaJson = Dictionary(schemaJsonString)\n    if (!HasKey(valueJson, \"classification\"))\n        return null;\n    if (valueJson.classification == \"Public Data\")\n        return schemaJson.attributes[attributeId].arcadeResultLookup[\"Public_Data_List\"];\n    if (valueJson.classification == \"Restricted\")\n        return schemaJson.attributes[attributeId].arcadeResultLookup[\"Restricted_List\"];\n    if (valueJson.classification == \"Confidential\")\n        return schemaJson.attributes[attributeId].arcadeResultLookup[\"Confidential_List\"];\n    return null;\n}\ngetProgramValidValues(schemaJsonString, valueJsonString, attributeId)",  
      "arcadeResultLookup": {  
        "Public_Data_List": [{"label": "Intra-agency", "value": "Intra-agency"}, {"label": "Marketing", "value": "Marketing"}, {"label": "Promotional", "value": "Promotional"}],  
        "Restricted_List": [{"label": "Compliance", "value": "Compliance"}, {"label": "Financial", "value": "Financial"}, {"label": "Human Resources", "value": "Human Resources"}, {"label": "Market Data", "value": "Market Data"}, {"label": "PII", "value": "PII"}, {"label": "Proprietary", "value": "Proprietary"}],  
        "Confidential_List": [{"label": "Intellectual Property", "value": "Intellectual Property"}, {"label": "Legal", "value": "Legal"}, {"label": "Security", "value": "Security"}]  
      },  
      "selectionDisplayOrder": 2,  
      "bannerOrder": 2,  
      "labelDelimiter": "",  
      "valueDelimiter": "-",  
      "attributeDelimiter": ";"  
    }  
  }, 
  "layouts": {  
    "default": {  
      "layoutElements": {  
        "classification": {  
          "formDisplayOrder": 1  
        },  
        "program": {  
          "formDisplayOrder": 2  
        }  
      }  
    }  
  } 
}