arcgis.apps.workforce module¶
Defines public exports for the workforce module.
The Project
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.
import arcgis
gis = 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()
Assignment¶
-
class
arcgis.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
Argument
Description
project
Required
Project
. The project that this assignment belongs to.feature
Optional
Feature
. A feature containing the assignments attributes. Mostly intended for internal 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 assignmentcompleted_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-
property
assigned_date
¶ Gets/Sets the assigned
datetime
of the assignment
-
property
assignment_read
¶ Gets/Sets the assignment read field
-
property
assignment_type
¶ Gets/Sets the
AssignmentType
-
property
assignment_type_code
¶ Gets the assignment type code
-
property
attachments
¶ Gets the
AssignmentAttachmentManager
of the assignment
-
property
completed_date
¶ Gets/Sets the completed
datetime
of the assignment
-
property
creation_date
¶ The
datetime
at which the Feature was created.
-
property
creator
¶ The named user that created the Feature.
-
property
declined_comment
¶ Gets/Sets the declined comment of the assignment
-
property
declined_date
¶ Gets/Sets the declined
datetime
of the assignment
-
delete
()¶ Deletes the assignment from the server
-
property
description
¶ Gets/Sets the description for the assignment
-
property
dispatcher
¶ Gets/Sets the
Dispatcher
of the assignment
-
property
dispatcher_id
¶ Gets the dispatcher id of the assignment
-
property
due_date
¶ Gets/Sets the due
datetime
of the assignment
-
property
edit_date
¶ The
datetime
at which the Feature was last edited.
-
property
editor
¶ The named user that last edited the Feature.
-
property
geometry
¶ Gets/Sets the geometry for the Feature.
-
property
global_id
¶ The global id of the feature
-
property
id
¶ The object id of the feature
-
property
in_progress_date
¶ Gets/Sets the in progress
datetime
for the assignment
-
property
location
¶ Gets/Sets the location of the assignment
-
property
notes
¶ Gets/Sets the notes of the assignment
-
property
object_id
¶ The object id of the feature
-
property
paused_date
¶ Gets/Sets the paused
datetime
for the assignment
-
property
priority
¶ Gets/Sets the
String
priority of the assignmentnone, low, medium, high, critical
-
property
status
¶ 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
Argument
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 assignmentcompleted_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
-
property
work_order_id
¶ Gets/Sets the work order id of the assignment
-
property
worker_id
¶ Gets the worker id of the assignment
-
property
AssignmentType¶
-
class
arcgis.apps.workforce.
AssignmentType
(project, coded_value=None, name=None)¶ Defines the acceptable values for
Assignment
types.Argument
Description
project
Required
Project
. The project that this assignment belongs to.coded_value
Optional
dict
. The dictionary storing the code and name of the type.name
Optional
String
. The name of the assignment type.-
property
code
¶ Gets the internal code that uniquely identifies the assignment type
-
property
coded_value
¶ Gets the coded value
-
delete
()¶ Deletes the assignment type from the server
-
property
id
¶ Gets the id of the assignment type
-
property
name
¶ Gets/Sets The name of the assignment type
-
update
(name=None)¶ Updates the assignment type on the server
Argument
Description
name
Optional
String
. The name of the assignment type
-
property
Attachment¶
-
class
arcgis.apps.workforce.
Attachment
(assignment, attachment_info)¶ Represents a file attachment for an Assignment
Argument
Description
assignment
Required
Assignment
. The assignment object that this attachment belongs toattachment_info
Required
dict
. The attachment info dictionary representing the attachment.-
property
attachment_info
¶ Gets the attachment info of the attachment
-
property
content_type
¶ Gets the attachment content type
-
download
(out_folder=None)¶ Downloads the attachment to the specified path. If the path is omitted, the Attachment will 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 the current working directory.
- Returns
The absolute path to the downloaded file.
-
property
global_id
¶ Gets the attachment global id
-
property
id
¶ Gets the attachment id
-
property
name
¶ Gets the attachment name
-
property
project
¶ Gets the project that the attachment belongs to
-
property
size
¶ Gets the attachment size
-
property
Dispatcher¶
-
class
arcgis.apps.workforce.
Dispatcher
(project, feature=None, contact_number=None, name=None, user_id=None)¶ Represents a dispatcher in a project.
Argument
Description
project
Required
Project
. The project that the dispatcher belongs to.feature
Optional
Feature
. The feature representing the dispatcher. Mostly intended for internal 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-
property
contact_number
¶ Gets/Sets the contact number of the dispatcher
-
property
creation_date
¶ The
datetime
at which the Feature was created.
-
property
creator
¶ The named user that created the Feature.
-
delete
()¶ Deletes the dispatcher from the server
-
property
edit_date
¶ The
datetime
at which the Feature was last edited.
-
property
editor
¶ The named user that last edited the Feature.
-
property
geometry
¶ Gets/Sets the geometry for the Feature.
-
property
global_id
¶ The global id of the feature
-
property
id
¶ The object id of the feature
-
property
name
¶ Gets/Sets the name of the dispatcher
-
property
object_id
¶ The object id of the feature
-
update
(contact_number=None, name=None, user_id=None)¶ Updates the dispatcher on the server
Argument
Description
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
-
property
user_id
¶ Gets/Sets the user id of the dispatcher
-
property
Project¶
-
class
arcgis.apps.workforce.
Project
(item)¶ A Workforce Project
Argument
Description
item
Required
Item
. The item that the contains the project.# Get a Project and search the assignments and workers. import arcgis gis = 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()
-
property
assignment_types
¶ The
AssignmentTypeManager
for the project
-
property
assignments
¶ The
AssignmentManager
for the project
-
property
assignments_layer
¶ The assignments
FeatureLayer
-
property
assignments_layer_url
¶ The assignments feature layer url
-
delete
()¶ Deletes the project, group, folder, layers, and webmaps. Assumes the currently signed in user owns the project or is an admin.
-
property
dispatcher_web_map_id
¶ The dispatcher webmap item id
-
property
dispatchers
¶ The
DispatcherManager
for the project
-
property
dispatchers_layer
¶ The dispatchers
FeatureLayer
-
property
dispatchers_layer_url
¶ The dispatchers feature layer url
-
property
group_id
¶ The group id that all project items are part of
-
property
id
¶ The item id of the project
-
property
owner_user_id
¶ The user id of the project owner.
-
property
summary
¶ The title of the project
-
property
title
¶ Gets the title of the project
-
property
tracks
¶ The
TrackManager
for the project
-
property
tracks_layer
¶ The tracks
FeatureLayer
-
property
tracks_layer_url
¶ The tracks feature layer url
-
update
(summary=None)¶ Updates the project on the server
Argument
Description
summary
Optional
String
. The summary of the project.
-
property
version
¶ The version of the project
-
property
worker_web_map_id
¶ The worker webmap item id
-
property
workers
¶ The
WorkerManager
for the project
-
property
workers_layer
¶ The workers
FeatureLayer
-
property
workers_layer_url
¶ The workers feature layer url
-
property
Track¶
-
class
arcgis.apps.workforce.
Track
(project, feature=None, geometry=None, accuracy=None)¶ Represents a track feature, which describes the historical location of a worker.
Argument
Description
feature
Optional
Feature
. A feature containing the assignments attributes. Mostly intended for internal usage. If supplied, other parameters are ignored.geometry
Optional
Dict
. A dictionary containing the assignment geometryaccuracy
Optional
Float
. The accuracy of the point-
property
accuracy
¶ The horizontal accuracy of the location measurement, in meters.
-
property
creation_date
¶ The
datetime
at which the Feature was created.
-
property
creator
¶ The named user that created the Feature.
-
delete
()¶ Deletes the track point on the server
-
property
edit_date
¶ The
datetime
at which the Feature was last edited.
-
property
editor
¶ The named user that last edited the Feature.
-
property
geometry
¶ Gets/Sets the geometry for the Feature.
-
property
global_id
¶ The global id of the feature
-
property
id
¶ The object id of the feature
-
property
object_id
¶ The object id of the feature
-
update
(geometry=None, accuracy=None)¶ Updates the track point on the server
Argument
Description
geometry
Optional
Dict
. A dictionary containing the assignment geometryaccuracy
Optional
Float
. The accuracy of the point
-
property
Worker¶
-
class
arcgis.apps.workforce.
Worker
(project, feature=None, geometry=None, contact_number=None, name=None, notes=None, status=None, title=None, user_id=None)¶ Represents a worker in a Workforce Project
Argument
Description
project
Required
Project
. The project that the worker belongs to.feature
Optional
Feature
. The feature representing the worker. Mostly intended for internal 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-
property
contact_number
¶ Gets/Sets the contact number of the worker
-
property
creation_date
¶ The
datetime
at which the Feature was created.
-
property
creator
¶ The named user that created the Feature.
-
delete
()¶ Deletes the worker from the server
-
property
edit_date
¶ The
datetime
at which the Feature was last edited.
-
property
editor
¶ The named user that last edited the Feature.
-
property
geometry
¶ Gets/Sets the geometry for the Feature.
-
property
global_id
¶ The global id of the feature
-
property
id
¶ The object id of the feature
-
property
name
¶ Gets/Sets the name of the worker
-
property
notes
¶ Gets/Sets the notes of the worker
-
property
object_id
¶ The object id of the feature
-
property
status
¶ Gets/Sets the
String
status of the workernot_working, working, on_break
-
property
title
¶ Gets/Sets the title of the worker
-
update
(geometry=None, contact_number=None, name=None, notes=None, status=None, title=None, user_id=None)¶ Updates the worker on the server
Argument
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
-
property
user_id
¶ Gets/Sets the user id of the worker
-
property