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.

In [1]:
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.

In [2]:
groups_df = pd.read_csv('data/groups.csv')
In [3]:
groups_df[:3]
Out[3]:
access description isFav isInvitationOnly isViewOnly phone snippet sortField sortOrder tags thumbnail title
0 public This group includes a complete list of basemap... False True True null Standard basemaps for our organizations. title asc Maps,Base,Basemap,Basemaps Basemaps.png Basemaps
1 org This Group contains an inventory of map servic... False False False null The authoritative service catalog. title asc Services,Maps,Data CentralServices.png Central Services
2 org A group dealing with government and industry a... False False False null Regulatory compliance tracking & reporting. modified asc Regulatory,Compliance RegCompliance.png Compliance

The thumbnails are extracted from an Icons.zip file.

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

Using the magic functions from Jupyter Notebook allows you to easily change directory by making a command line style syntax call. The following line changes the directory to the folder containing the extracted icons.

In [5]:
%cd data/Icons
<Path_To_The_Folder_Containing_Extracted_Icons>\data\Icons

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

In [6]:
import csv

gis = GIS("https://www.arcgis.com", "arcgis_python", "P@ssword123")

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, can can display the newly created groups:

In [7]:
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: Admin
Created: December 15, 2016
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: Admin
Created: December 15, 2016
Compliance

Summary: Regulatory compliance tracking & reporting.
Description: A group dealing with government and industry association regulatory compliance and reporting.
Owner: Admin
Created: December 15, 2016
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: Admin
Created: December 15, 2016
Demographic Content

Summary: Esri demographic data with national coverage
Description: A catalog of Esri provided demographic content for use at the utility.
Owner: Admin
Created: December 15, 2016
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: Admin
Created: December 15, 2016
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: Admin
Created: December 15, 2016
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: Admin
Created: December 15, 2016
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: Admin
Created: December 15, 2016
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: Admin
Created: December 15, 2016
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: Admin
Created: December 15, 2016
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: Admin
Created: December 15, 2016
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: Admin
Created: December 15, 2016
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: Admin
Created: December 15, 2016
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: Admin
Created: December 15, 2016
Land Use Content

Summary: Esri land use data with national coverage
Description: A catalog of Esri provided land use content with national coverage.
Owner: Admin
Created: December 15, 2016
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: Admin
Created: December 15, 2016
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: Admin
Created: December 15, 2016
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: Admin
Created: December 15, 2016
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: Admin
Created: December 15, 2016
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: Admin
Created: December 15, 2016
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: Admin
Created: December 15, 2016

Feedback on this topic?