Moderate reports

Public comment applications can occasionally generate feedback that should not be made publicly visible. Data entered into specific fields, such as personal information, can be hidden and protected using the pop-up configuration and layer security, but sometimes entire comments need to be hidden to avoid displaying sensitive or explicit content to other users.

Features can be hidden by updating the value of a field so that it no longer meets the requirements of a filter applied to that layer in the map. The Moderate Reports tool can be used to configure which layers and fields to scan for explicit or sensitive words and phrases, and how to update the feature so that it can be filtered from the map. Features and records can be scanned on a frequency of your choosing. Note that the tool only generates the configuration; an additional script (provided) must be run to actually scan the features.

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

To configure automated moderation of incoming 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 Moderate Reports tool.
  4. If the tool has not been run previously, start by specifying at least one moderation list in the General Moderation Settings section of the tool by providing the following values:
    • List Name—Assign a name to the moderation list. This value will appear in the drop-down menu for selecting the moderation list use when scanning each layer.
    • Filter Type—Choose to scan feature for words and phrases that exactly match the provided list of works and phrases. For example, when the filter type is EXACT, if the list contains the word 'duck' the script will update the specified field when the feature contains the word 'duck', but not when it contains the word 'duckling'. When the filter type is FUZZY, the script will update the feature when either 'duck' or 'duckling' are found.
    • Words and Phrases—Provide a comma-separated list of words or phrases to scan for.
    Keep in mind that deleting or changing these lists will impact all the layers that are configured to use the edited sequences.
  5. Choose the feature layer or table layer to be moderated by either choosing a layer from the active map, or by browsing to your hosted content and choosing a feature layer or table layer.
  6. If a moderation configuration already exists for the selected layer, choose to either edit an existing configuration by selecting the name of the moderation list used in the configuration, or choose the option to add a new moderation configuration. If you choose to edit an existing configuration, a checkbox will appear that, when checked, will delete the existing moderation configuration for the selected layer. Alternatively, edit the moderation configuration and run the tool to overwrite the existing moderation configuration for the selected layer and moderation list. To add a new moderation configuration, choose Add New and continue with the following steps.
  7. Choose the moderation list to use to process the features in the selected layer.
  8. Choose the fields that will be scanned for content that matches the words and phrases in the selected moderation list.
  9. Optionally, provide an SQL query to only apply moderation to some features. If no query is provided, all features are processed.
  10. Choose a Field to Update when a match is found between the value of a field and the content of a moderation list. Use the Found Value parameter to specify the value that should be written to this field indicating a match.
  11. 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 regularly scan and moderate the configured layers.

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.
Top