I'm a novice at best with Python scripting but it's on the top of the list of things for me to figure out so our organization can more fully utilize Workforce. I've had success running the title script in the Python Command Prompt written like this:
python create_assignments_from_csv.py -csv-file "N:\RDA_exported_assignments.csv" -u <username> -p <password> -org "https://<our org>.maps.arcgis.com" -project-id "<xxxxxxxxxxxxxxxxxxxxxxxxxxxx>" -x-field "xField" -y-field "yField" -assignment-type-field "AssignmentType" -location-field "Location" -description-field "Description" -priority-field "Priority" -wkid 102100 -log-file "N:\Rapid Damage Assessment\log.txt" -timezone "US/Pacific"
Again, this worked. However I can't seem to get the same script to work in a Jupyter notebook. The sample notebook geocodes an address to an x,y location which I already have. My assignments csv does not have addresses, only x,y location in separate columns (exported from the Assignments Point Layer - see sample below) as the points are along river levees and don't necessarily have addresses, and i used the location field in Workforce for the name of the levee that is to be inspected. How do I get the script to recognize my x,y data? I've tried converting the x,y data into a single column titled SHAPE with formatting like this: {"x": -122.366238, "y": 47.22577965}. This seemed to work but as the script created the assignments, there was no symbology for the new assignments - similar to the discussion here: Workforce 'create assignments from csv' script - no assignments symbolized on map
I'm really hoping to use notebooks rather than Command Prompt scripts so I can document processes and share more easily.
I'm pretty sure I need to change at least the geometry line(s)?
workforce-scripts/2 - Importing Assignments.ipynb at master · Esri/workforce-scripts · GitHub
Below is a sample of the csv that works with the Command Prompt script. I know I can delete a lot of these fields, and please let me know if I should.
OBJECTID | xField | yField | Description | Status | Notes | Priority | AssignmentType | WorkOrderId | DueDate | WorkerId | GlobalID | Location | DeclinedComment | AssignedDate | AssignmentRead | InProgressDate | CompletedDate | DeclinedDate | PausedDate | DispatcherId | CreationDate | Creator | EditDate | Editor |
5 | -13621747.3 | 5979005.241 | Puyallup Left: MP3.0 - 6.8 | unassigned | high | Levee Assessment - Drive | Zone 1 | | | e99c5014-0d2a-4a8b-9dab-278c052f703d | River Road Levee | | | | | | | | 23CE0246-08E7-4E60-B6AC-49D9DFCF7F29 | 7/21/2020 11:40 | dsarver | 7/21/2020 12:21 | dsarver |
I hope what I wrote makes sense, and thanks for reading this