Enrich reports

Reports made in public comment applications can be enriched with information about the report location. This information can then be used to efficiently direct the report to the correct person or department responsible for its resolution.

The Enrich Reports tool can be used to configure which attribute values to calculate from a coincident or intersecting set of features at a regularly scheduled interval of your choosing. Note that the tool only generates the configuration; an additional script (provided) must be run to actually update the features based on intersecting features.

Configuring and executing this script requires the ArcGIS API for Python (Installed with ArcGIS Pro).

To configure the ability to enrich reports using the attributes of co-incident features, complete the following steps:

  1. Download and extract the ServiceFunctions toolbox. The tools in this toolbox create and update a configuration file that can then serve as input for a scheduled script.
  2. Open the toolbox in ArcGIS Pro 2.x, and if you've never used the toolbox before, run the Define Connection Settings tool to establish a connection between the toolbox and the ArcGIS Enterprise portal or ArcGIS Online organization containing the layers you wish to moderate.
  3. Open the Enrich Reports tool.
  4. Choose the feature layer that will receive values by either choosing a layer from the active map, or by browsing to your hosted content and choosing a feature layer.
  5. If an enrichment configuration already exists for the selected layer, choose to either edit an existing configuration by selecting the configuration from the drop-down list, or choose the option to add a new enrichment configuration. If you choose to edit an existing configuration, a checkbox will appear that, when checked, will delete the existing enrichment configuration for the selected layer. Alternatively, edit the configuration and run the tool to save the changes. To add a new enrichment configuration, choose Add New and continue with the following steps.
  6. Choose the polygon feature layer that will provide the enriching attribute values by either choosing a layer from the active map, or by browsing to your hosted content and choosing a polygon feature layer.
  7. Choose a field from the enrichment layer as the Source Field and a field from the input layer as the Target Field. The script will not process features that already have a value in the target field.
  8. Specify the priority that should be given to this enrichment configuration relative to the other configurations for this input layer. Enrichment configurations for a layer that have a lower priority value will override enrichment configuration with a higher value. For example, a layer has two enrichment configurations that use the same target field, but one has a priority value of 1 and the other a priority of 2. If the configuration with priority 1 does not produce a valid value for the field, the field will be populated with the value produced from the configuration with priority 2.
  9. To test the configuration, run the servicefunctions.py script that accompanies the toolbox. If errors occur, they will be written to a log file that will be created in the same directory as the script. The ServiceFunctions toolbox, servicefunctions.py script, and the servicefunctions.json file created by the toolbox must all remain in the same directory.

Set up Task Scheduler

Use Windows Task Scheduler to schedule the script to enrich features.

This is only necessary if servicefunctions.py has not been previously scheduled. All the tools in this toolbox share a common configuration file and execution script so only one scheduled task is required to automate running all the associated processes.

  1. Open the Task Scheduler on the computer that is hosting the scripts.
  2. Click Action > Create Task and name your task.
  3. Click the Action tab and click New.
  4. Set Action to Start a Program.
  5. Browse to the location of your Python 3 installation (for example, <default directory>\C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe).
  6. In the Add arguments text box, type the name of the script (servicefunctions.py).
  7. In the Start in text box, type the path to the folder where your script is and click OK.
  8. Click the Trigger tab, click New, and set a schedule for your task.
  9. Click OK. When the trigger occurs, the scripts will begin scanning the configured layers and, for each one, processing (in order) configurations for generating identifiers, enriching reports, moderating reports, and sending emails.