This script has been moved to mature support.

Enrich reports

Reports made in public comment applications can be enriched with information (for example, nearest asset, maintenance district) 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 report script can be used to calculate attribute values on a report from a coincident or intersecting set of features. This script can be scheduled to run as frequently as you want using Windows Task Scheduler, but only one instance of the task can be running at a single time.

Configuring and executing this script requires the following components:

Once these components are installed, make sure that your Python IDE is set to work against your Python 3 installation that contains the ArcGIS API for Python library (for example, <default directory>\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-python3\python.exe), and then skip ahead to the steps for configuring the script.

To set up the enrich report script, complete the following steps:

  1. Unzip the folder and use a Python IDE or text editor to open the enrich_reports.py file from the EnrichReports folder.
  2. Provide the URL to your ArcGIS organization and the credentials to an account that can edit the reporting layer in the orgURL, username, and password parameters. These values should be surrounded by quotation marks.
  3. List the service or services to scan in the services parameter by providing the following values for each service:
    • 'url': The URL to the REST endpoint of the service.
    • 'enrichment layers': List the layers to use to provide attributes to the specified service. For each of these enrichment layers, provide the following attributes:
      • 'url': The URL to the REST endpoint of the enrichment service.
      • 'query': SQL query to identify which features should acquire values from this enrichment layer.
      • 'source field': Field in the enrichment layer containing the value to be copied to the report layer.
      • 'target field': Field in the report layer that will receive the value from the enrichment layer.
      Multiple enrichment layers can be listed for each report layer. Enrichment layers should be listed in order of priority. Values in layers that are listed first will trump values from layers further down the list.
  4. Save your changes to this configuration file and test the script by double-clicking the geoassignment.py file in Windows Explorer. The script will report any errors in a log file that will be created in the same directory as the scripts. Also verify that the expected changes occurred in the service.

Set up Task Scheduler

Use Windows Task Scheduler to schedule the script to regularly scan the configured services and moderate content.

  1. Open the Task Scheduler on the desktop 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>\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-python3\python.exe).
  6. In the Add arguments text box, type the name of the script (enrich_reports.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 specified layers.
Top