Skip to content

The DashboardManager is the main entry point into the Dashboard module.

DashboardManager

class arcgis.apps.dashboards.DashboardManager(item: Item | str, gis: GIS | None = None)

Bases: object

Helps work with Dashboard items and their associated data and resources. Provides methods to manipulate, upgrade, and copy dashboards, as well as manage their dependencies.

Parameter

Description

item

Required String or Item. The string for an item id or an item of type ‘Dashboard’.

gis

Optional instance of GIS. If none provided the active gis is used.

copy(title: str | None = None, tags: list[str] | str | None = None, folder: str | None = None, item_mapping: list[ItemMapping] | None = None) Item

Creates a copy of the Dashboard item.

Parameter

Description

title

Optional string. The title of the destination Dashboard Item. If not specified, title of the original Dashboard item is used.

tags

Optional List of Strings. New set of tags (comma separated) for the destination Dashboard item.

folder

Optional string or Folder object in the target GIS where the copied item will be stored.

item_mapping

Optional list of ItemMapping objects used to associate an item, layer, or field in the source GIS to a corresponding item, layer, or field in the target GIS.

Returns:

A new Dashboard Item.

get_dependencies(options: DependencyOptions | None = None) list[ItemResult]

Returns a Dashboard item’s dependencies.

Parameter

Description

options

Optional DependencyOptions object. Set parameters to customize dependency retrieval.

Returns:

A list of dependencies for the Dashboard item.

replace_dependencies(item_mapping: list[ItemMapping], options: DependencyOptions | None = None) Item

Replaces the dependencies of a Dashboard Item, modifying the existing item to reflect the changes incorporated from the target_item_id.

Parameter

Description

item_mapping

Required list of ItemMapping object(s) outlining the new dependencies to set.

options

Optional DependencyOptions object. Set parameters to customize dependency replacement.

Returns:

The Dashboard Item with updated dependencies.

# Usage example : item_mapping parameter structure

from arcgis.gis import GIS
from arcgis.apps.dashboards import (
    DashboardManager,
    ItemMapping,
    LayerMapping,
    FieldMapping
)

gis = GIS(profile="your_organization_profile")
dashboard_item = gis.content.get("<dashboard_item_id>")

item_mapping = ItemMapping(
                    source_item_id="95640b5bddf4470b8c729e75fa77a134",
                    target_item_id="138e01276ed942b9a3a15051b8202505",
                    layer_mappings=[
                       LayerMapping(
                          source_layer_id='18c643060d3-layer-1',
                          target_layer_id='18c643060d3-layer-2',
                          field_mappings=[
                             FieldMapping(source_name="OBJECTID", target_name="FID"),
                             FieldMapping(source_name="Winery_Name", target_name="Winery_Name_new"),
                             FieldMapping(source_name="Address", target_name="Address_new"),
                          ]
                       )
                    ]
            )
manager = DashboardManager(item=dashboard_item, gis=gis)

# Replace dependencies
manager.replace_dependencies(item_mapping=[item_mapping])
upgrade() Item

Upgrades a Dashboard Item to the latest schema version, modifying the existing item to reflect the changes.

Returns:

The upgraded Dashboard Item

Note

Method updates the original item in place. A new item is not created.

ItemMapping

class arcgis.apps.dashboards.ItemMapping(*, sourceItemId: str, targetItemId: str, layerMappings: List[LayerMapping] | None = None)

Bases: BaseModel

Describes how to map one item to another.

field layer_mappings: List[LayerMapping] | None = None

Collection of layer mappings where each layer mapping describes how to map one layer to another.

model_config: ClassVar[ConfigDict] = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

field source_item_id: str [Required]

The source portal item id.

field target_item_id: str [Required]

The target portal item id.

LayerMapping

class arcgis.apps.dashboards.LayerMapping(*, sourceLayerId: int | str | None, targetLayerId: int | str | None, sourceSublayerId: int | None = None, targetSublayerId: int | None = None, fieldMappings: List[FieldMapping] | None = None)

Bases: BaseModel

Describes how to map one layer to another.

field field_mappings: List[FieldMapping] | None = None

A list of field mapping objects to map source field names to target field names. Only required when field names differ between the source and target layers.

Note

Only supported for Dashboard versions >= ‘4.30.0’.

model_config: ClassVar[ConfigDict] = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

field source_layer_id: int | str | None | None [Required]

The source layer’s id.

field source_sublayer_id: int | None = None

The source sublayer’s id - only applicable for sublayer data sources.

field target_layer_id: int | str | None | None [Required]

The target layer’s id.

field target_sublayer_id: int | None = None

The target sublayer’s id - only applicable for sublayer data sources.

validator validate_sublayer_pairs  »  all fields

FieldMapping

class arcgis.apps.dashboards.FieldMapping(*, sourceName: str, targetName: str)

Bases: BaseModel

Describes how to map one field to another.

model_config: ClassVar[ConfigDict] = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

field source_name: str [Required]

The source field name.

field target_name: str [Required]

The target field name.

ItemResult

class arcgis.apps.dashboards.ItemResult(*, itemId: str, source: str | None = None, layers: List[LayerResult] | None = None)

Bases: BaseModel

Result of the find or replace operation for an item.

field item_id: str [Required]

The portal item id.

field layers: List[LayerResult] | None = None

Collection of found layers.

model_config: ClassVar[ConfigDict] = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

field source: str | None = None

Optionally indicates the source of the itemId. For example, an itemId may be sourced from a URL.

FieldResult

class arcgis.apps.dashboards.FieldResult(*, name: str)

Bases: BaseModel

Result of the get or replace operation for a field.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

field name: str [Required]

The field name.

LayerResult

class arcgis.apps.dashboards.LayerResult(*, id: int | str | None, sublayerId: int | None = None, fields: List[FieldResult] | None = None)

Bases: BaseModel

Result of the find or replace operation for a layer.

field fields: List[FieldResult] | None = None

Collection of processed fields.

field id: int | str | None [Required]

The layer id.

model_config: ClassVar[ConfigDict] = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

field sublayer_id: int | None = None

The sublayer id - only applicable for sublayer data sources.

DependencyOptions

class arcgis.apps.dashboards.DependencyOptions(*, includeLayers: bool = False, includeFields: bool = False)

Bases: BaseModel

Provides ability to set options for the dependency result. Can be used to specify whether to include layers and fields in the result.

field include_fields: bool = False

Whether to include fields in the result. If include_layers is false, this option is ignored (fields will not be included).

field include_layers: bool = False

Whether to include layers in the result.

model_config: ClassVar[ConfigDict] = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.