arcgis.apps.workforce module
Defines public exports for the workforce module.
TheProject
is the main entry point into the Workforce module.It can be used as shown in the following code example.
# Get a Project and search the assignments and workers, create new Workforce projectimportarcgisgis=arcgis.gis.GIS("https://arcgis.com","<username>","<password>")item=gis.content.get("<item-id>")project=arcgis.apps.workforce.Project(item)assignments=project.assignments.search()workers=project.workers.search()project2=arcgis.apps.workforce.create_project('new_project',summary='This project was created by Python')
create_project
- arcgis.apps.workforce.create_project(title,summary=None,major_version=None,gis=None)
Creates a new Workforce Project
Parameter
Description
title
String
.The title of the Project to create (must be unique to the organization)summary
String
.The summary of the Projectmajor_version
Optional
Int
The version of the Project to create. 1 represents the originalWorkforce Project which does not support offline. 2 represents the newerWorkforce Project which supports offline among other things. Defaultsto 2 in GIS 8.2 and highergis
Optional
GIS
.The authenticated GIS to use.Defaults to the active GIS if None is provided.Returns a
Project
Assignment
- classarcgis.apps.workforce.Assignment(project,feature=None,geometry=None,assignment_type=None,assigned_date=None,assignment_read=None,completed_date=None,declined_comment=None,declined_date=None,description=None,dispatcher=None,due_date=None,in_progress_date=None,location=None,notes=None,paused_date=None,priority='none',status=None,work_order_id=None,worker=None)
Represents an assignment
Parameter
Description
project
Required
Project
. The project thatthis assignment belongs to.feature
Optional
Feature
.A feature containing the assignments attributes. Mostly intended forinternal usage. If supplied, other parameters are ignored.geometry
Optional
Dict
.A dictionary containing the assignment geometryassignment_type
Optional
AssignmentType
.The assignment type that represents this assignment.assigned_date
Optional
Date
The date and time the assignment was assignedassignment_read
Optional
Bool
.A flag indicating that the mobile worker has seen the assignment.Version 1 Projects Onlycompleted_date
Optional
Date
.The date the assignment was completeddeclined_comment
Optional
String
.The comment submitted by the mobile worker.declined_date
Optional
Date
.The date the assignment was declined.description
Optional
Description
.The description associated with the assignment.dispatcher
Optional
Dispatcher
.The dispatcher that assigned/created the assignment.due_date
Optional
Date
.The date the assignment is due.in_progress_date
Optional
Date
.The date the assignment was started.location
Optional
String
.The location or address of the assignment.notes
Optional
String
.The notes associated with the assignment.paused_date
Optional
Date
.The date and time the assignment was paused.priority
Optional
String
.The priority of the assignmentnone,low,medium,high,critical
status
Optional
String
.The status of the assignment.unassigned,assigned,in_progress,completed,declined,paused,canceled
work_order_id
Optional
String
.The work order id associated with the assignment.worker
Optional
Worker
.The worker assigned to the assignment# Get an assignment and update itimportarcgisgis=arcgis.gis.GIS("https://arcgis.com","<username>","<password>")item=gis.content.get("<item-id>")project=arcgis.apps.workforce.Project(item)assignment=project.assignments.search()[0]assignment.update(priority="high",description="new assignment",location="100 Commercial Street, Portland, ME")assignment.delete()
- propertyassignment_type
Gets/Sets the
AssignmentType
- propertyattachments
Gets the
AssignmentAttachmentManager
of the assignment
- propertydispatcher
Gets/Sets the
Dispatcher
of the assignment
- propertyfeature
The
Feature
- propertystatus
Gets/Sets the
String
status of the assignmentunassigned,assigned,in_progress,completed,declined,paused,canceled
- update(geometry=None,assignment_type=None,assigned_date=None,assignment_read=None,completed_date=None,declined_comment=None,declined_date=None,description=None,dispatcher=None,due_date=None,in_progress_date=None,location=None,notes=None,paused_date=None,priority=None,status=None,work_order_id=None,worker=None)
Updates the assignment on the server
Parameter
Description
geometry
Optional
Dict
.A dictionary containing the assignment geometryassignment_type
Optional
AssignmentType
.The assignment type that represents this assignment.assigned_date
Optional
Date
The date and time the assignment was assignedassignment_read
Optional
Bool
.A flag indicating that the mobile worker has seen the assignment.Version 1 Projects Onlycompleted_date
Optional
Date
.The date the assignment was completeddeclined_comment
Optional
String
.The comment submitted by the mobile worker.declined_date
Optional
Date
.The date the assignment was declined.description
Optional
Description
.The description associated with the assignment.dispatcher
Optional
Dispatcher
.The dispatcher that assigned/created the assignment.due_date
Optional
Date
.The date the assignment is due.in_progress_date
Optional
Date
.The date the assignment was started.location
Optional
String
.The location or address of the assignment.notes
Optional
String
.The notes associated with the assignment.paused_date
Optional
Date
.The date and time the assignment was paused.priority
Optional
String
.The priority of the assignmentnone,low,medium,high,critical
status
Optional
String
.The status of the assignment.unassigned,assigned,in_progress,completed,declined,paused,canceled
work_order_id
Optional
String
.The work order id associated with the assignment.worker
Optional
Worker
.The worker assigned to the assignment
- propertyworker
Gets the
Worker
of the assignment
AssignmentType
- classarcgis.apps.workforce.AssignmentType(project,feature=None,coded_value=None,name=None)
Defines the acceptable values for
AssignmentType
types.Parameter
Description
project
Required
Project
. The project thatthis assignment belongs to.coded_value
Optional
dict
. The dictionary storing the code andname of the type. Only works for v1 projects.name
Optional
String
. The name of the assignment type.# Get an assignment type, update it, delete itimportarcgisgis=arcgis.gis.GIS("https://arcgis.com","<username>","<password>")item=gis.content.get("<item-id>")project=arcgis.apps.workforce.Project(item)assignment_type=project.assignment_types.search()[0]assignment_type.update(name="Manhole Inspection")assignment_type.delete()
- propertyfeature
The
Feature
Attachment
- classarcgis.apps.workforce.Attachment(assignment,attachment_info)
Represents a file attachment for an Assignment
Parameter
Description
assignment
Required
Assignment
. The assignment object that this attachment belongstoattachment_info
Required
dict
. The attachment info dictionary representing theattachment.- download(out_folder=None)
Downloads the attachment to the specified path. If the path is omitted, the Attachmentwill be saved to the current working directory, using the name property as the filename.:param out_folder: The folder in which the attachment should be saved. Defaults to thecurrent working directory.
- Returns:
The absolute path to the downloaded file.
Dispatcher
- classarcgis.apps.workforce.Dispatcher(project,feature=None,contact_number=None,name=None,user_id=None)
Represents a dispatcher in a project.
Parameter
Description
project
Required
Project
. The project thatthe dispatcher belongs to.feature
Optional
Feature
. The feature representingthe dispatcher. Mostly intended forinternal usage. If supplied, other parameters are ignored.contact_number
Optional
String
. The contact number of the dispatchername
Optional
String
. The name of the dispatcheruser_id
Optional
String
. The user id of the dispatcher# Get a dispatcher, update it, delete itimportarcgisgis=arcgis.gis.GIS("https://arcgis.com","<username>","<password>")item=gis.content.get("<item-id>")project=arcgis.apps.workforce.Project(item)dispatcher=project.dispatchers.search()[0]dispatcher.update(name="Dispatcher Name",contact_number="1234567890")dispatcher.delete()
- propertyfeature
The
Feature
Integration
- classarcgis.apps.workforce.Integration(project,feature=None,integration_id=None,prompt=None,url_template=None,assignment_type=None)
Represents an integration in a project. Version 2 Workforce projects only.
Parameter
Description
project
Required
Project
. The project thatthe dispatcher belongs to.feature
Optional
Feature
. The feature representingthe dispatcher. Mostly intended forinternal usage. If supplied, other parameters are ignored.integration_id
Optional
String
. The id for the integrationprompt
Optional
String
. The prompt in the mobile app for theintegrationurl_template
Optional
String
. The url that the prompt links toassignment_type
Optional
String
. The assignment type for the integration# Get an integration, update it, delete itimportarcgisgis=arcgis.gis.GIS("https://arcgis.com","<username>","<password>")item=gis.content.get("<item-id>")project=arcgis.apps.workforce.Project(item)integration=project.integrations.search()[0]integration.update(integration_id="arcgis-navigator",prompt="Navigate to Assignment")integration.delete()
- propertyfeature
The
Feature
- update(integration_id=None,prompt=None,url_template=None,assignment_type=None)
Updates the dispatcher on the server
Parameter
Description
integration_id
Optional
String
. The id for the integrationprompt
Optional
String
. The prompt in the mobile app for theintegrationurl_template
Optional
String
. The url that the prompt links toassignment_type
Optional
String
. The assignment type for the integration
Project
- classarcgis.apps.workforce.Project(item)
A Workforce Project
Parameter
Description
item
Required
Item
. The item thatthe contains the project.For a version 1 Workforce project, this is an item of typeWorkforce Project. For a version 2 Workforce project, this is anitem of typeFeature Service with typeKeywordWorkforce Project
# Get a Project and search the assignments and workers.importarcgisgis=arcgis.gis.GIS("https://arcgis.com","<username>","<password>")item=gis.content.get("<item-id>")project=arcgis.apps.workforce.Project(item)assignments=project.assignments.search()workers=project.workers.search()# Create v1 "Classic" Workforce project and v2 "offline-enabled" projectv1_project=arcgis.apps.workforce.create_project('v1_project',major_version=1)v2_project=arcgis.apps.workforce.create_project('v2_project',major_version=2)
- propertyassignment_types
The
AssignmentTypeManager
for the project
- propertyassignment_types_item
The assignment types
Item
- propertyassignment_types_table
The assignment types
Table
- propertyassignments
The
AssignmentManager
for the project
- propertyassignments_item
The assignments
Item
- propertyassignments_layer
The assignments
FeatureLayer
- delete()
Deletes the project, group, folder, layers, and webmaps.Assumes the currently signed in user owns the project or is an admin.
- propertydispatcher_webmap
The dispatcher
Map
for the project
- propertydispatchers
The
DispatcherManager
for the project
- propertydispatchers_item
The dispatchers
Item
- propertydispatchers_layer
The dispatchers
FeatureLayer
- propertygroup
The
Group
that the project resources are part of
- propertyintegrations
The
AssignmentIntegrationManager
for the project
- propertyintegrations_table
The integrations
Table
- propertyintegrations_table_url
The integrations table url
Table
- propertyowner
The owner
User
of the project
- propertytracks
The
TrackManager
for the project
- propertytracks_item
The tracks
Item
- propertytracks_layer
The tracks
FeatureLayer
- update(summary=None)
Updates the project on the server
Parameter
Description
summary
Optional
String
. The summary of the project.
- propertyworker_webmap
The worker
Map
for the project
- propertyworkers
The
WorkerManager
for the project
- propertyworkers_item
The workers
Item
- propertyworkers_layer
The workers
FeatureLayer
Track
- classarcgis.apps.workforce.Track(project,feature=None,geometry=None,accuracy=None)
Represents a track feature, which describes the historical location of a worker. V1 Projectsonly.
Parameter
Description
feature
Optional
Feature
.A feature containing the assignments attributes. Mostly intended forinternal usage. If supplied, other parameters are ignored.geometry
Optional
Dict
.A dictionary containing the assignment geometryaccuracy
Optional
Float
. The accuracy of the point- propertyfeature
The
Feature
Worker
- classarcgis.apps.workforce.Worker(project,feature=None,geometry=None,contact_number=None,name=None,notes=None,status='not_working',title=None,user_id=None)
Represents a worker in a Workforce Project
Parameter
Description
project
Required
Project
. The project thatthe worker belongs to.feature
Optional
Feature
. The feature representingthe worker. Mostly intended forinternal usage. If supplied, other parameters are ignored.geometry
Optional
Dict
. The geometry of the worker.contact_number
Optional
String
. The contact number of the worker.name
Optional
String
. The name of the worker.notes
Optional
String
. The notes about the worker.status
Optional
String
. The status of the worker.not_working,working,on_break
title
Optional
String
. The title of the worker.user_id
Optional
String
. The user id of the worker# Get a worker, update it, delete itimportarcgisgis=arcgis.gis.GIS("https://arcgis.com","<username>","<password>")item=gis.content.get("<item-id>")project=arcgis.apps.workforce.Project(item)worker=project.workers.search()[0]worker.update(title="Inspector",status="not_working")
- propertyfeature
The
Feature
- update(geometry=None,contact_number=None,name=None,notes=None,status=None,title=None,user_id=None)
Updates the worker on the server
Parameter
Description
geometry
Optional
Dict
. The geometry of the worker.contact_number
Optional
String
. The contact number of the worker.name
Optional
String
. The name of the worker.notes
Optional
String
. The notes about the worker.status
Optional
String
. The status of the worker.not_working,working,on_break
title
Optional
String
. The title of the worker.user_id
Optional
String
. The user id of the worker