Esri-Private-Sector-SEs / gbd-migration

Migration project to consolidate various orgs within the Commercial GBD team.
0 stars 0 forks source link

Migration - Key Error #13

Closed JHendrickson4 closed 1 year ago

JHendrickson4 commented 1 year ago

ITEM_ID = "a89b7fadc77849018facc05ff504fa90"


KeyError Traceback (most recent call last) /tmp/ipykernel_18/3793353524.py in <cell line: 1>() ----> 1 transfer()

/tmp/ipykernel_18/3758147352.py in transfer() 222 sm_transfer(destination=destination, item=item_origin) 223 elif item_origin.type == "Dashboard": --> 224 dash_transfer(destination=destination, dash=item_origin, swizzle=True) 225 else: 226 wc_transfer(destination=destination, items=[item_origin])

/tmp/ipykernel_18/3758147352.py in dash_transfer(destination, dash, swizzle) 56 """ 57 ---> 58 dash_elements = get_dash_wm(dash=dash) 59 wm_items = {} # origin to destination ids 60

/tmp/ipykernel_18/3344664258.py in get_dash_wm(dash) 115 """ 116 return [origin.content.get(widget['itemId']) --> 117 for widget in dash.get_data()["desktopView"]['widgets'] 118 if widget['type'] == "mapWidget"]

KeyError: 'desktopView'

rfreedBusiness commented 1 year ago

Can you return the JSON of the item back to me with the following code?

my_dash = origin.content.get("a89b7fadc77849018facc05ff504fa90") 

dash_json = my_dash.get_data()

dash_json
JHendrickson4 commented 1 year ago

{'version': 52, 'authoringApp': 'ArcGIS Dashboards', 'authoringAppVersion': '4.25.0+ff53c5645c', 'header': {'selectors': [{'id': '09c97fff-2952-4552-8cb4-6d70361290d2', 'name': 'Category Selector (1)', 'caption': 'Route Name:', 'showLastUpdate': True, 'noDataState': {'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}, 'noFilterState': {'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}, 'presentationMode': 'dropdown', 'datasets': [{'type': 'serviceDataset', 'name': 'main', 'dataSource': {'type': 'layerDataSource', 'layerId': 'ODFL_V3_WFL1_1601', 'ownerId': '1200f3f1-8f72-4ea6-af16-14f19e9a4517'}, 'groupByFields': [], 'orderByFields': [], 'statisticDefinitions': [], 'maxFeatures': 50, 'clientSideStatistics': False, 'outFields': ['*'], 'returnDistinctValues': False, 'allowSourceDownload': False, 'allowSummaryDownload': False}], 'type': 'categorySelectorWidget', 'category': {'type': 'features', 'itemText': '{routename}'}, 'selection': {'operator': 'equal', 'allowNone': True, 'noneLabelPlacement': 'first', 'type': 'single', 'defaultSelection': 'first'}, 'displayType': 'list', 'showFilter': True, 'maxSize': 'compact'}, {'id': '1f83eb22-d3bd-419e-9487-b9f69350e1ff', 'name': 'Specialty Type Category Selector ', 'caption': 'Specialty Type', 'showLastUpdate': True, 'noDataState': {'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}, 'noFilterState': {'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}, 'presentationMode': 'dropdown', 'datasets': [{'type': 'serviceDataset', 'name': 'main', 'dataSource': {'type': 'layerDataSource', 'layerId': 'ODFL_V3_WFL1_1601', 'ownerId': '1200f3f1-8f72-4ea6-af16-14f19e9a4517'}, 'filter': {'type': 'filterGroup', 'condition': 'OR', 'rules': [{'type': 'filterGroup', 'condition': 'AND', 'rules': [{'type': 'filterRule', 'field': {'name': 'specialtynames', 'type': 'string'}, 'operator': 'is_not_null', 'constraint': {'type': 'nil'}}]}]}, 'groupByFields': [], 'orderByFields': [], 'statisticDefinitions': [], 'maxFeatures': 50, 'clientSideStatistics': False, 'outFields': ['*'], 'returnDistinctValues': False, 'allowSourceDownload': False, 'allowSummaryDownload': False}], 'type': 'categorySelectorWidget', 'category': {'type': 'features', 'itemText': '{specialtynames}'}, 'selection': {'operator': 'equal', 'allowNone': True, 'noneLabelPlacement': 'first', 'type': 'single', 'defaultSelection': 'first'}, 'displayType': 'list', 'showFilter': True, 'maxSize': 'compact'}, {'id': 'e431dc86-1db4-44be-b99a-f1f77adf8f44', 'name': 'Date Selector (1)', 'caption': 'Date: ', 'showLastUpdate': True, 'noDataState': {'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}, 'noFilterState': {'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}, 'presentationMode': 'dropdown', 'showActionButtons': True, 'type': 'dateSelectorWidget', 'optionType': 'datePicker', 'datePickerOption': {'type': 'datePicker', 'selectionType': 'single', 'includeTime': True, 'operator': 'is_on'}}], 'type': 'header', 'title': 'Daily Route Review Explorer', 'subtitlePlacement': 'sameLine', 'logoIcon': '<svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" id="ember9560" class="icon ember-view" viewBox="0 0 21 21">\n<path d="M18,13h-1.1c0,0.1,0.1,0.3,0.1,0.4v0.2c0,0.8-0.6,1.4-1.4,1.4h-0.2c-0.8,0-1.4-0.6-1.4-1.4v-0.2c0-0.1,0-0.3,0.1-0.4H7.9&#10;&#9;c0,0.1,0.1,0.3,0.1,0.4v0.2C8,14.4,7.4,15,6.6,15H6.4C5.6,15,5,14.4,5,13.6v-0.2c0-0.1,0-0.3,0.1-0.4H4V6h9v4h1V8h1.9l1.1,2h1V13z"/>\n</svg>', 'logoIconFillColor': '#ffffff', 'logoURL': '', 'logoSize': 'small', 'showMargin': True, 'backgroundImageSizing': 'fit-height', 'normalBackgroundImagePlacement': 'left', 'horizontalBackgroundImagePlacement': 'top', 'showSignOutMenu': True, 'menuLinks': []}, 'widgets': [{'id': '1200f3f1-8f72-4ea6-af16-14f19e9a4517', 'name': 'Map (1)', 'showLastUpdate': True, 'noDataState': {'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}, 'noFilterState': {'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}, 'events': [{'type': 'extentChanged', 'actions': [{'targets': [{'targetId': 'eb3fcf01-0425-40e2-97eb-4f1f3ce46686#main', 'by': 'geometry', 'requiresSelection': False}, {'targetId': '8bb21494-bb7a-4e1d-9ee9-a1a8d9edbc32#main', 'by': 'geometry', 'requiresSelection': False}, {'targetId': 'd98ea6b0-3406-4352-b4bc-a42b8db2a606#main', 'by': 'geometry', 'requiresSelection': False}, {'targetId': 'ad24f2af-f0db-495f-b7dc-244492c212b0#main', 'by': 'geometry', 'requiresSelection': False}, {'targetId': 'a3e855e5-5b6e-467d-8259-acb698f9af84#main', 'by': 'geometry', 'requiresSelection': False}], 'type': 'filter'}]}], 'type': 'mapWidget', 'flashRepeats': 3, 'itemId': '3521f345635140549aa56eea58a7424f', 'mapTools': [{'type': 'bookmarksTool'}, {'type': 'basemapGalleryTool'}, {'type': 'searchTool'}], 'showNavigation': True, 'showPopup': True, 'scalebarStyle': 'none', 'layers': [{'events': [{'type': 'selectionChanged', 'actions': [{'targets': [{'targetId': 'eb3fcf01-0425-40e2-97eb-4f1f3ce46686#main', 'by': 'whereClause', 'requiresSelection': False}, {'targetId': 'd98ea6b0-3406-4352-b4bc-a42b8db2a606#main', 'by': 'whereClause', 'requiresSelection': False}, {'targetId': 'ad24f2af-f0db-495f-b7dc-244492c212b0#main', 'by': 'whereClause', 'requiresSelection': False}, {'targetId': '70e1195a-90ed-4602-9f8b-fd0ec41fa15f#main', 'by': 'whereClause', 'requiresSelection': False}, {'targetId': '8bb21494-bb7a-4e1d-9ee9-a1a8d9edbc32#main', 'by': 'whereClause', 'requiresSelection': False}, {'targetId': 'a3e855e5-5b6e-467d-8259-acb698f9af84#main', 'by': 'whereClause', 'requiresSelection': False}], 'type': 'filter'}]}], 'type': 'layer', 'dataSource': {'type': 'layerDataSource', 'layerId': 'ODFL_V3_WFL1_1601', 'ownerId': '1200f3f1-8f72-4ea6-af16-14f19e9a4517'}}]}, {'id': '5639c13b-c4cb-401a-8323-2f9664634cd6', 'name': 'Map Legend (1)', 'caption': '<h3>Legend</h3>\n', 'showLastUpdate': True, 'noDataState': {'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}, 'noFilterState': {'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}, 'type': 'legendWidget', 'mapWidgetId': '1200f3f1-8f72-4ea6-af16-14f19e9a4517'}, {'id': 'eb3fcf01-0425-40e2-97eb-4f1f3ce46686', 'name': 'Total Routes Indicator', 'showLastUpdate': True, 'noDataState': {'text': '', 'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}, 'noFilterState': {'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}, 'datasets': [{'type': 'serviceDataset', 'name': 'main', 'dataSource': {'type': 'layerDataSource', 'layerId': 'ODFL_V3_WFL1_1601', 'ownerId': '1200f3f1-8f72-4ea6-af16-14f19e9a4517'}, 'groupByFields': [], 'orderByFields': [], 'statisticDefinitions': [{'onStatisticField': 'objectid', 'outStatisticFieldName': 'value', 'statisticType': 'count'}], 'clientSideStatistics': False, 'outFields': ['*'], 'returnDistinctValues': False, 'allowSourceDownload': False, 'allowSummaryDownload': False}], 'type': 'indicatorWidget', 'defaultSettings': {'topSection': {'fontSize': 80, 'textInfo': {'text': 'Total Routes'}}, 'middleSection': {'fontSize': 160, 'textInfo': {'text': '{value}'}}, 'bottomSection': {'fontSize': 80, 'textInfo': {}}}, 'comparison': 'none', 'valueFormat': {'name': 'value', 'prefix': False, 'style': 'decimal', 'useGrouping': True, 'minimumFractionDigits': 0, 'maximumFractionDigits': 3, 'valuePrefix': '', 'valueSuffix': ''}, 'percentageFormat': {'name': 'percentage', 'prefix': False, 'style': 'percent', 'useGrouping': True, 'minimumFractionDigits': 0, 'maximumFractionDigits': 3, 'valuePrefix': '', 'valueSuffix': ''}, 'ratioFormat': {'name': 'ratio', 'prefix': False, 'style': 'decimal', 'useGrouping': True, 'minimumFractionDigits': 0, 'maximumFractionDigits': 3, 'valuePrefix': '', 'valueSuffix': ''}, 'valueType': 'statistic', 'noValueState': {'text': '', 'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}}, {'id': 'd98ea6b0-3406-4352-b4bc-a42b8db2a606', 'name': 'Total Cost Indicator', 'showLastUpdate': True, 'noDataState': {'text': '', 'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}, 'noFilterState': {'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}, 'datasets': [{'type': 'serviceDataset', 'name': 'main', 'dataSource': {'type': 'layerDataSource', 'layerId': 'ODFL_V3_WFL1_1601', 'ownerId': '1200f3f1-8f72-4ea6-af16-14f19e9a4517'}, 'groupByFields': [], 'orderByFields': [], 'statisticDefinitions': [{'onStatisticField': 'totalcost', 'outStatisticFieldName': 'value', 'statisticType': 'sum'}], 'clientSideStatistics': False, 'outFields': ['*'], 'returnDistinctValues': False, 'allowSourceDownload': False, 'allowSummaryDownload': False}], 'type': 'indicatorWidget', 'defaultSettings': {'topSection': {'fontSize': 80, 'textInfo': {'text': 'Total Cost'}}, 'middleSection': {'fontSize': 160, 'textInfo': {'text': '${value}'}}, 'bottomSection': {'fontSize': 80, 'textInfo': {}}}, 'comparison': 'none', 'valueFormat': {'name': 'value', 'prefix': False, 'style': 'decimal', 'useGrouping': True, 'minimumFractionDigits': 0, 'maximumFractionDigits': 2, 'valuePrefix': '', 'valueSuffix': ''}, 'percentageFormat': {'name': 'percentage', 'prefix': False, 'style': 'percent', 'useGrouping': True, 'minimumFractionDigits': 0, 'maximumFractionDigits': 3, 'valuePrefix': '', 'valueSuffix': ''}, 'ratioFormat': {'name': 'ratio', 'prefix': False, 'style': 'decimal', 'useGrouping': True, 'minimumFractionDigits': 0, 'maximumFractionDigits': 3, 'valuePrefix': '', 'valueSuffix': ''}, 'valueType': 'statistic', 'noValueState': {'text': '', 'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}}, {'id': '8bb21494-bb7a-4e1d-9ee9-a1a8d9edbc32', 'name': 'Total Orders Indicator', 'showLastUpdate': True, 'noDataState': {'text': '', 'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}, 'noFilterState': {'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}, 'datasets': [{'type': 'serviceDataset', 'name': 'main', 'dataSource': {'type': 'layerDataSource', 'layerId': 'ODFL_V3_WFL1_1601', 'ownerId': '1200f3f1-8f72-4ea6-af16-14f19e9a4517'}, 'groupByFields': [], 'orderByFields': [], 'statisticDefinitions': [{'onStatisticField': 'ordercount', 'outStatisticFieldName': 'value', 'statisticType': 'sum'}], 'clientSideStatistics': False, 'outFields': ['*'], 'returnDistinctValues': False, 'allowSourceDownload': False, 'allowSummaryDownload': False}], 'type': 'indicatorWidget', 'defaultSettings': {'topSection': {'fontSize': 80, 'textInfo': {'text': 'Total Orders'}}, 'middleSection': {'fontSize': 160, 'textInfo': {'text': '{value}'}}, 'bottomSection': {'fontSize': 80, 'textInfo': {}}}, 'comparison': 'none', 'valueFormat': {'name': 'value', 'prefix': False, 'style': 'decimal', 'useGrouping': True, 'minimumFractionDigits': 0, 'maximumFractionDigits': 3, 'valuePrefix': '', 'valueSuffix': ''}, 'percentageFormat': {'name': 'percentage', 'prefix': False, 'style': 'percent', 'useGrouping': True, 'minimumFractionDigits': 0, 'maximumFractionDigits': 3, 'valuePrefix': '', 'valueSuffix': ''}, 'ratioFormat': {'name': 'ratio', 'prefix': False, 'style': 'decimal', 'useGrouping': True, 'minimumFractionDigits': 0, 'maximumFractionDigits': 3, 'valuePrefix': '', 'valueSuffix': ''}, 'valueType': 'statistic', 'noValueState': {'text': '', 'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}}, {'id': '84e8469c-9d28-4f32-8a18-13bfa8b9b8ed', 'name': 'Assigned Orders Indicator', 'showLastUpdate': True, 'noDataState': {'text': '', 'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}, 'noFilterState': {'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}, 'datasets': [{'type': 'serviceDataset', 'name': 'main', 'dataSource': {'type': 'layerDataSource', 'layerId': 'ODFL_V3_WFL1_786', 'ownerId': '1200f3f1-8f72-4ea6-af16-14f19e9a4517'}, 'filter': {'type': 'filterGroup', 'condition': 'OR', 'rules': [{'type': 'filterGroup', 'condition': 'AND', 'rules': [{'type': 'filterRule', 'field': {'name': 'routeid', 'type': 'string'}, 'operator': 'is_null', 'constraint': {'type': 'nil'}}]}]}, 'groupByFields': [], 'orderByFields': [], 'statisticDefinitions': [{'onStatisticField': 'objectid', 'outStatisticFieldName': 'value', 'statisticType': 'count'}], 'clientSideStatistics': False, 'outFields': ['*'], 'returnDistinctValues': False, 'allowSourceDownload': False, 'allowSummaryDownload': False}, {'type': 'serviceDataset', 'name': 'reference', 'dataSource': {'type': 'layerDataSource', 'layerId': 'ODFL_V3_WFL1_786', 'ownerId': '1200f3f1-8f72-4ea6-af16-14f19e9a4517'}, 'groupByFields': [], 'orderByFields': [], 'statisticDefinitions': [{'onStatisticField': 'objectid', 'outStatisticFieldName': 'value', 'statisticType': 'count'}], 'clientSideStatistics': False, 'outFields': ['*'], 'returnDistinctValues': False, 'allowSourceDownload': False, 'allowSummaryDownload': False}], 'type': 'indicatorWidget', 'defaultSettings': {'topSection': {'fontSize': 80, 'textInfo': {'text': 'Unassigned Orders'}}, 'middleSection': {'fontSize': 160, 'textInfo': {'text': '{value}'}}, 'bottomSection': {'fontSize': 40, 'textInfo': {'text': 'out of {reference} total orders', 'fillColor': '#858585'}}}, 'comparison': 'statistic', 'valueFormat': {'name': 'value', 'prefix': False, 'style': 'decimal', 'useGrouping': True, 'minimumFractionDigits': 0, 'maximumFractionDigits': 3, 'valuePrefix': '', 'valueSuffix': ''}, 'percentageFormat': {'name': 'percentage', 'prefix': False, 'style': 'percent', 'useGrouping': True, 'minimumFractionDigits': 0, 'maximumFractionDigits': 3, 'valuePrefix': '', 'valueSuffix': ''}, 'ratioFormat': {'name': 'ratio', 'prefix': False, 'style': 'decimal', 'useGrouping': True, 'minimumFractionDigits': 0, 'maximumFractionDigits': 3, 'valuePrefix': '', 'valueSuffix': ''}, 'valueType': 'statistic', 'noValueState': {'text': '', 'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}}, {'id': 'ad24f2af-f0db-495f-b7dc-244492c212b0', 'name': 'Avg Route Time (Travel) Indicator', 'showLastUpdate': True, 'noDataState': {'text': '', 'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}, 'noFilterState': {'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}, 'datasets': [{'type': 'serviceDataset', 'name': 'main', 'dataSource': {'type': 'layerDataSource', 'layerId': 'ODFL_V3_WFL1_1601', 'ownerId': '1200f3f1-8f72-4ea6-af16-14f19e9a4517'}, 'groupByFields': [], 'orderByFields': [], 'statisticDefinitions': [{'onStatisticField': 'totaltraveltime', 'outStatisticFieldName': 'value', 'statisticType': 'avg'}], 'clientSideStatistics': False, 'outFields': ['*'], 'returnDistinctValues': False, 'allowSourceDownload': False, 'allowSummaryDownload': False}], 'type': 'indicatorWidget', 'defaultSettings': {'topSection': {'fontSize': 80, 'textInfo': {'text': 'Avg Route Time'}}, 'middleSection': {'fontSize': 160, 'textInfo': {'text': '{value}'}}, 'bottomSection': {'fontSize': 40, 'textInfo': {'text': 'Travel Time in Minutes'}}}, 'comparison': 'none', 'valueFormat': {'name': 'value', 'prefix': False, 'style': 'decimal', 'useGrouping': True, 'minimumFractionDigits': 0, 'maximumFractionDigits': 2, 'valuePrefix': '', 'valueSuffix': ''}, 'percentageFormat': {'name': 'percentage', 'prefix': False, 'style': 'percent', 'useGrouping': True, 'minimumFractionDigits': 0, 'maximumFractionDigits': 3, 'valuePrefix': '', 'valueSuffix': ''}, 'ratioFormat': {'name': 'ratio', 'prefix': False, 'style': 'decimal', 'useGrouping': True, 'minimumFractionDigits': 0, 'maximumFractionDigits': 3, 'valuePrefix': '', 'valueSuffix': ''}, 'valueType': 'statistic', 'noValueState': {'text': '', 'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}}, {'id': 'a3e855e5-5b6e-467d-8259-acb698f9af84', 'name': 'AVG Stops Per Hour Indicator', 'showLastUpdate': True, 'noDataState': {'text': '', 'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}, 'noFilterState': {'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}, 'datasets': [{'type': 'serviceDataset', 'name': 'main', 'dataSource': {'type': 'layerDataSource', 'layerId': 'ODFL_V3_WFL1_1601', 'ownerId': '1200f3f1-8f72-4ea6-af16-14f19e9a4517'}, 'groupByFields': [], 'orderByFields': [], 'statisticDefinitions': [{'onStatisticField': 'StopsPHour', 'outStatisticFieldName': 'value', 'statisticType': 'avg'}], 'clientSideStatistics': False, 'outFields': ['*'], 'returnDistinctValues': False, 'allowSourceDownload': False, 'allowSummaryDownload': False}], 'type': 'indicatorWidget', 'defaultSettings': {'topSection': {'fontSize': 80, 'textInfo': {'text': 'AVG Stops Per Hour'}}, 'middleSection': {'fontSize': 160, 'textInfo': {'text': '{value}'}}, 'bottomSection': {'fontSize': 80, 'textInfo': {}}}, 'comparison': 'none', 'valueFormat': {'name': 'value', 'prefix': False, 'style': 'decimal', 'useGrouping': True, 'minimumFractionDigits': 0, 'maximumFractionDigits': 2, 'valuePrefix': '', 'valueSuffix': ''}, 'percentageFormat': {'name': 'percentage', 'prefix': False, 'style': 'percent', 'useGrouping': True, 'minimumFractionDigits': 0, 'maximumFractionDigits': 3, 'valuePrefix': '', 'valueSuffix': ''}, 'ratioFormat': {'name': 'ratio', 'prefix': False, 'style': 'decimal', 'useGrouping': True, 'minimumFractionDigits': 0, 'maximumFractionDigits': 3, 'valuePrefix': '', 'valueSuffix': ''}, 'valueType': 'statistic', 'noValueState': {'text': '', 'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}}, {'id': '70e1195a-90ed-4602-9f8b-fd0ec41fa15f', 'name': 'List (1)', 'showLastUpdate': True, 'noDataState': {'text': '', 'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}, 'noFilterState': {'verticalAlignment': 'middle', 'showCaption': True, 'showDescription': True}, 'datasets': [{'type': 'serviceDataset', 'name': 'main', 'dataSource': {'type': 'layerDataSource', 'layerId': 'ODFL_V3_WFL1_1601', 'ownerId': '1200f3f1-8f72-4ea6-af16-14f19e9a4517'}, 'groupByFields': [], 'orderByFields': [], 'statisticDefinitions': [], 'maxFeatures': 25, 'clientSideStatistics': False, 'outFields': ['*'], 'returnDistinctValues': False, 'allowSourceDownload': False, 'allowSummaryDownload': False}], 'events': [{'type': 'selectionChanged', 'actions': [{'targets': [{'targetId': '1200f3f1-8f72-4ea6-af16-14f19e9a4517', 'by': 'whereClause', 'requiresSelection': False}], 'type': 'flashGeometry'}, {'targets': [{'targetId': '1200f3f1-8f72-4ea6-af16-14f19e9a4517#ODFL_V3_WFL1_1601', 'by': 'whereClause', 'requiresSelection': False}, {'targetId': 'a3e855e5-5b6e-467d-8259-acb698f9af84#main', 'by': 'whereClause', 'requiresSelection': False}, {'targetId': 'ad24f2af-f0db-495f-b7dc-244492c212b0#main', 'by': 'whereClause', 'requiresSelection': False}, {'targetId': 'd98ea6b0-3406-4352-b4bc-a42b8db2a606#main', 'by': 'whereClause', 'requiresSelection': False}, {'targetId': '8bb21494-bb7a-4e1d-9ee9-a1a8d9edbc32#main', 'by': 'whereClause', 'requiresSelection': False}, {'targetId': 'eb3fcf01-0425-40e2-97eb-4f1f3ce46686#main', 'by': 'whereClause', 'requiresSelection': False}], 'type': 'filter'}]}], 'type': 'listWidget', 'selectionMode': 'single', 'iconType': 'symbol', 'text': '<p>Name: {routename}</p>\n\n<p>Order Count: {ordercount}</p>\n\n<p>Total Travel Time: {totaltraveltime}</p>\n\n<p>Total Distance: {totaldistance}</p>\n', 'showFilter': False}], 'settings': {'maxPaginationRecords': 50000, 'allowElementResizing': True, 'allowElementExpansion': True, 'allowReset': False}, 'mapOverrides': {'highlightColor': '#ff00ff', 'trackedFeatureColor': '#0000ff', 'trackedFeatureRadius': 60}, 'theme': 'dark', 'themeOverrides': {}, 'numberPrefixOverrides': [{'key': 'yotta', 'symbol': 'Y', 'enabled': True}, {'key': 'zeta', 'symbol': 'Z', 'enabled': True}, {'key': 'exa', 'symbol': 'E', 'enabled': True}, {'key': 'peta', 'symbol': 'P', 'enabled': True}, {'key': 'tera', 'symbol': 'T', 'enabled': True}, {'key': 'giga', 'symbol': 'G', 'enabled': True}, {'key': 'mega', 'symbol': 'M', 'enabled': True}, {'key': 'kilo', 'symbol': 'k', 'enabled': True}, {'key': 'base', 'symbol': '', 'enabled': True}, {'key': 'deci', 'symbol': 'd', 'enabled': False}, {'key': 'centi', 'symbol': 'c', 'enabled': False}, {'key': 'milli', 'symbol': 'm', 'enabled': False}, {'key': 'micro', 'symbol': 'µ', 'enabled': False}, {'key': 'nano', 'symbol': 'n', 'enabled': False}], 'layout': {'rootElement': {'width': 1, 'height': 1, 'elements': [{'width': 0.1614420177148823, 'height': 1, 'elements': [{'width': 1, 'height': 0.6179624316648548, 'type': 'itemLayoutElement', 'id': '70e1195a-90ed-4602-9f8b-fd0ec41fa15f'}, {'width': 1, 'height': 0.38203756833514524, 'type': 'itemLayoutElement', 'id': '5639c13b-c4cb-401a-8323-2f9664634cd6'}], 'type': 'stackLayoutElement', 'orientation': 'row'}, {'width': 0.8385579822851176, 'height': 1, 'elements': [{'width': 1, 'height': 0.6216842645403943, 'type': 'itemLayoutElement', 'id': '1200f3f1-8f72-4ea6-af16-14f19e9a4517'}, {'width': 1, 'height': 0.18761403897499887, 'elements': [{'width': 0.33333333333333337, 'height': 1, 'type': 'itemLayoutElement', 'id': 'eb3fcf01-0425-40e2-97eb-4f1f3ce46686'}, {'width': 0.3463498622589532, 'height': 1, 'type': 'itemLayoutElement', 'id': '8bb21494-bb7a-4e1d-9ee9-a1a8d9edbc32'}, {'width': 0.3203168044077135, 'height': 1, 'type': 'itemLayoutElement', 'id': 'ad24f2af-f0db-495f-b7dc-244492c212b0'}], 'type': 'stackLayoutElement', 'orientation': 'col'}, {'width': 1, 'height': 0.19070169648460672, 'elements': [{'width': 0.33333333333333337, 'height': 1, 'type': 'itemLayoutElement', 'id': 'd98ea6b0-3406-4352-b4bc-a42b8db2a606'}, {'width': 0.3463498622589532, 'height': 1, 'type': 'itemLayoutElement', 'id': '84e8469c-9d28-4f32-8a18-13bfa8b9b8ed'}, {'width': 0.3203168044077135, 'height': 1, 'type': 'itemLayoutElement', 'id': 'a3e855e5-5b6e-467d-8259-acb698f9af84'}], 'type': 'stackLayoutElement', 'orientation': 'col'}], 'type': 'stackLayoutElement', 'orientation': 'row'}], 'type': 'stackLayoutElement', 'orientation': 'col'}}} ​

rfreedBusiness commented 1 year ago

Interesting, this dashboard seems to have a different JSON than other ones I have looked at. Is this a legacy dashboard item or just a regular dashboard?

rfreedBusiness commented 1 year ago

If we are going to have dashboards that have varying JSONs, ones that don't start with [desktopView] keys, I will need to build an exception handler and handle each unique JSON. We can not unpack the JSON as a string unfortunately, because then we can not determine what is an ItemID substring.

If this isn't a legacy dashboard, this is probably worth pointing out the API dev team because their help documentation uses the following helper function to get item IDs from a JSON (which I use in this script):

def get_dash_wm(dash):
    """
    From https://developers.arcgis.com/python/guide/cloning-content/#helper-functions

    Returns a list of all Web Maps participating in a Dashboard. 

    Arguments:
        dash (item): Dashboard to return participating Web Maps from.
    Returns:
        (list): All Web Maps partipating in the dashboard. 

    """
    return [origin.content.get(widget['itemId']) 
            for widget in dash.get_data()["desktopView"]['widgets']
            if widget['type'] == "mapWidget"]

This does have a widgets key, so maybe our exception handles this by just keying into [widgets] as the first level of the JSON?

JHendrickson4 commented 1 year ago

It was an older dashboard version. Opening and saving in the new version made it work for the transfer.