Batch creation of Groups

This sample notebook automates the task of creating groups in a Portal for ArcGIS or ArcGIS Online organization. A similar script can be used for creating or updating users and content.

Note: To run this sample, you need the pandas library in your conda environment. If you don't have the library, install it by running the following command from cmd.exe or your shell

conda install pandas```
from arcgis.gis import GIS
from IPython.display import display
import pandas as pd

Data preparation

In this sample, a list of groups to be created is read from a .csv file along with the properties and thumbnails to be used for creating the groups.

groups_df = pd.read_csv('data/groups.csv')
groups_df[:3]
accessdescriptionisFavisInvitationOnlyisViewOnlyphonesnippetsortFieldsortOrdertagsthumbnailtitle
0publicThis group includes a complete list of basemap...FalseTrueTrueNaNStandard basemaps for our organizations.titleascMaps,Base,Basemap,Basemapsdata/Icons/Basemaps.pngBasemaps
1orgThis Group contains an inventory of map servic...FalseFalseFalseNaNThe authoritative service catalog.titleascServices,Maps,Datadata/Icons/CentralServices.pngCentral Services
2orgA group dealing with government and industry a...FalseFalseFalseNaNRegulatory compliance tracking & reporting.modifiedascRegulatory,Compliancedata/Icons/RegCompliance.pngCompliance
gis = GIS("https://pythonapi.playground.esri.com/portal", "arcgis_python", "amazing_arcgis_123")

Before we proceed, we will verify if these groups do not exist in our organization. If they exist, we will delete them so that we can re-create as part of the process that follows.

for group_name in groups_df['title']:
    g = gis.groups.search(query='title:'+group_name)
    #if group exists with the title, delete it
    if len(g)>0:
        g[0].delete()

The thumbnails are extracted from an Icons.zip file.

import zipfile
with zipfile.ZipFile("data/Icons.zip") as z:
    z.extractall("data")

The code below reads the csv file line by line and creates groups in the portal using the specified parameters and thumbnails.

import csv

groups = []
with open('data/groups.csv') as csvfile:
    reader = csv.DictReader(csvfile)
    for row in reader:
        group = gis.groups.create_from_dict(row)
        groups.append(group)   

To verify, we can display the newly created groups:

for group in groups:
    display(group)
Basemaps

Summary: Standard basemaps for our organizations.
Description: This group includes a complete list of basemaps for our organization. They provide relevant and consistent geographic context across all city departments; and are essential building blocks for the local government's desktop, mobile and web applications.
Owner: arcgis_python
Created: January 01, 2023
Central Services

Summary: The authoritative service catalog.
Description: This Group contains an inventory of map services for our organization. These map services serve as building blocks for all maps and apps throughout the organization.
Owner: arcgis_python
Created: January 01, 2023
Compliance

Summary: Regulatory compliance tracking & reporting.
Description: A group dealing with government and industry association regulatory compliance and reporting.
Owner: arcgis_python
Created: January 01, 2023
Customer Service, Finance, Billing and Accounting

Summary: The Water & Sewer Billing and Collection Division manage the water and sewer accounts for residents.
Description: Typical types of users and roles that part of this group:Human Resources/PayrollAdministrative Services Officer I, IIAdministrative AideAccountantAccount ClerkPayroll ClerkDepartment AnalystRisk Management Analyst I,II,IIIAccounting TechnicianEngineering TechnicianCommon Task or Responsibilities of the users in this group:Customer ServiceReal Estate ServicesBudgets/Accounting/Long Range Financial PlanningSafety/Risk ManagementFinancingRecords Management/Clerical ServicesAuditingBill Collection and paymentConnections/DisconnectsReduced Rates / Leak AdjustmentsPool AdjustmentIrrigation and Hydrant MetersEmployee Development
Owner: arcgis_python
Created: January 01, 2023
Demographic Content

Summary: Esri demographic data with national coverage
Description: A catalog of Esri provided demographic content for use at the utility.
Owner: arcgis_python
Created: January 01, 2023
Design and Engineering

Summary: Design and Engineering is responsible for designing, planning and inspection construction and maintenance projects.
Description: Typical types of users and roles that part of this group:Chief EngineerAsst. Chief EngineerEngineeringEngineering TechInspectorElectricianLand SurveyorTechnical WriterCommon Task or Responsibilities of the users in this group:DesignConstructionEngineering/Survey ServicesPlanning
Owner: arcgis_python
Created: January 01, 2023
Disaster Response

Summary: A catalog of Esri Live Feeds which may be needed during a disaster
Description: A catalog of Esri Live Feeds which may be needed during a disaster.During disasters, the Esri Disaster Response Program receives numerous requests for access to live disaster data. In the United States and abroad, many data sources are already freely available from agencies, but not in a readily digestible or dynamic format* for Web GIS platforms. To unlock the potential of these data sets, we use the Aggregated Live Feed methodology.
Owner: arcgis_python
Created: January 01, 2023
Executive Reports

Summary: Maps, apps and reports for the Board or Executives.
Description: This group is used to catalog key performance indicators and content used by the Board or Executive of our organization.
Owner: arcgis_python
Created: January 01, 2023
External Contractors

Summary: Collection of maps and apps designed to coordinate with external contractors and engineering firms.
Description: Typical types of users and roles that part of thisEngineering ContractorsContracted OperationsCommon Task or Responsibilities of the external users. Valve ExercisingHydrant FlushingDesignRehabilitationCCTV
Owner: arcgis_python
Created: January 01, 2023
Featured Apps

Summary: Apps that appear on the organization home page.
Description: This group contains a collection of applications highlighted on the organization's home page.
Owner: arcgis_python
Created: January 01, 2023
Field and Facility Maintenance

Summary: Field Maintenance is responsible for the operations of the Water distribution system, Sewer Collection system and construction of those networks.
Description: Typical types of users and roles that part of this group: Field Maintenance Manager Asst. Field Maintenance Manager Water/Sewer Utility I, II, III, IV Heavy Equipment Operator Meter Technicians/Mechanics Building Superintendent I, II Service Reader I,II Warehouse ClerkCommon Task or Responsibilities of the users in this group. Water Distribution Valves & Hydrants Main Repair Customer Service Leak Investigation Sewer Collection Main Maintenance Pump Operations & Maintenance TV/Video Inspection Sewer Backup Construction(Optional, may be under Engineering) Main Install Facility & Grounds Maintenance Grounds Maintenance Regulatory Compliance Meter Shop Meter Reading Inventory Control
Owner: arcgis_python
Created: January 01, 2023
Fire Service

Summary: A functional group designed to provide better coordination with the local fire departments
Description: Typical types of users and roles that part of this group: Engineering Technician GIS Technician GIS Supervisor Fire Department(External) Common Task or Responsibilities of the users in this group: Out of Service Hydrants Fire Flow Hydrant Inspections
Owner: arcgis_python
Created: January 01, 2023
Gallery

Summary: Content in this group appears on the organization gallery.
Description: This group contains a collection of maps, apps and mobile configurations highlighted in the organization's gallery.
Owner: arcgis_python
Created: January 01, 2023
Industrial Monitoring

Summary: A group with maps to meet a State and Federal regulatory requirement to monitor what industries discharge into the sewer system.
Description: A group with maps to meet a State and Federal regulatory requirement to monitor what industries discharge into the sewer system. The Industrial Monitoring section issues permits to industries to limit the pollutants discharged into the sewer system, inspects the industries for compliance and takes action against industries that violate their permits. Typical types of users and roles that part of this group: Manager Common Task or Responsibilities of the users in this group: Industrial Waste Pretreatment ProgramIndustrial Permits and ComplianceViolationsSurveillanceEmergency Response
Owner: arcgis_python
Created: January 01, 2023
Lab Services

Summary: Lab Services is responsible for testing drinking water and sampling waste water. This group includes the follow responsibility and roles at the utility.
Description: Lab Services functions as a support service for their environmental testing needs. The Lab also works with other government agencies to meet their testing needs. Lab Services can analyze drinking water, wastewater, surface water, groundwater, bio-solids, septage and solid samples for over 60 parameters.Typical types of users and roles that part of this group. Manager Common Task or Responsibilities of the users in this group. Wastewater FSE - FOG Drinking Water Trace Metals
Owner: arcgis_python
Created: January 01, 2023
Land Use Content

Summary: Esri land use data with national coverage
Description: A catalog of Esri provided land use content with national coverage.
Owner: arcgis_python
Created: January 01, 2023
Network Operations

Summary: Provides the latest information on the operational status of the network, including outage information, trouble reports and latest crew locations.
Description: Content for the network operations group.
Owner: arcgis_python
Created: January 01, 2023
Public Maps and Apps

Summary: Unsecured public facing content.
Description: This group contains a collection of maps and apps available to customers or citizens in our organization.
Owner: arcgis_python
Created: January 01, 2023
Tools and Add-Ins

Summary: Collection of extensions, tools and models.
Description: This group contains a collection of add-ins, tools and models used by our organization.
Owner: arcgis_python
Created: January 01, 2023
Wastewater Treatment

Summary: The Wastewater Treatment Division operates and maintains the treatment plant.
Description: The Wastewater Treatment Division operates and maintains the treatment plant. The division protects the health of the community and environment by reclaiming wastewater from residential, commercial, and industrial sources. Typical types of users and roles that part of this group:Superintendent of Water Pollution ControlWastewater Treatment Plant Operator I, II, I Utility I, II Common Task or Responsibilities of the users in this group: Identify and define prohibited wastes; Develop local limits on specific pollutants; Obtain access to facilities for inspections and sampling; Require non-residential dischargers to provide an adequate sampling location; Require treatment of non-domestic wastes to meet discharge standards; Require non-residential dischargers to obtain discharge permits; Require non-residential dischargers to monitor their discharge and submit reports; Take enforcement action for non-compliance with the program regulations.
Owner: arcgis_python
Created: January 01, 2023
Water Treatment

Summary: The Water Treatment Division operates and maintains treatment plants, elevated water storage tanks, reservoirs and pumping stations.
Description: The Water Treatment Division operates and maintains the treatment plant. The treatment process, which includes lime softening, dual media filtering, and chlorination and fluoridation, supplies a high quality, finished water that is unsurpassed in the region. Typical types of users and roles that part of this group: Superintendent of Water Pollution ControlWater Treatment Plant Operator I, II, IUtility I, II Common Task or Responsibilities of the users in this group: Boil Water NoticesConsumer Confidence ReportWater Treatment
Owner: arcgis_python
Created: January 01, 2023
Web App Templates

Summary: Collection of web application templates.
Description: This group contains a collection of web application templates used in our organization. The application templates are used to exposed web maps as applications.
Owner: arcgis_python
Created: January 01, 2023

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