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:
objectHelps work with Dashboard
itemsand 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
Folderobject in the targetGISwhere the copied item will be stored.item_mapping
Optional list of
ItemMappingobjects 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
DependencyOptionsobject. 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
ItemMappingobject(s) outlining the new dependencies to set.options
Optional
DependencyOptionsobject. Set parameters to customize dependency replacement.- Returns:
The Dashboard
Itemwith 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])
ItemMapping
- class arcgis.apps.dashboards.ItemMapping(*, sourceItemId: str, targetItemId: str, layerMappings: List[LayerMapping] | None = None)
Bases:
BaseModelDescribes how to map one item to another.
- field layer_mappings: List[LayerMapping] | None = None
Collection of
layer mappingswhere each layer mapping describes how to map one layer to another.
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:
BaseModelDescribes how to map one layer to another.
- field field_mappings: List[FieldMapping] | None = None
A list of
field mappingobjects 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_sublayer_id: int | None = None
The source sublayer’s id - only applicable for sublayer data sources.
FieldMapping
- class arcgis.apps.dashboards.FieldMapping(*, sourceName: str, targetName: str)
Bases:
BaseModelDescribes how to map one field to another.
ItemResult
- class arcgis.apps.dashboards.ItemResult(*, itemId: str, source: str | None = None, layers: List[LayerResult] | None = None)
Bases:
BaseModelResult of the find or replace operation for an item.
- field layers: List[LayerResult] | None = None
Collection of found layers.
FieldResult
LayerResult
- class arcgis.apps.dashboards.LayerResult(*, id: int | str | None, sublayerId: int | None = None, fields: List[FieldResult] | None = None)
Bases:
BaseModelResult of the find or replace operation for a layer.
- field fields: List[FieldResult] | None = None
Collection of processed fields.
DependencyOptions
- class arcgis.apps.dashboards.DependencyOptions(*, includeLayers: bool = False, includeFields: bool = False)
Bases:
BaseModelProvides ability to set options for the dependency result. Can be used to specify whether to include layers and fields in the result.