Schedule reporting scripts

Election Results includes a Python Toolbox for transforming your tabular election data into a format that can be used by the Related Table Charts widget in the Election Results application. The tools use your election district geography and your organization's tabulation results to populate the political contest layers viewed in the Election Results application. The tools provided can be ran from ArcMap, ArcCatalog, or as a scheduled task.

Configure the reporting scripts

To prepare the scripts to run, complete the following steps:

  1. Using Windows Explorer, browse to the <your directory>\Application\PublishingTools folder and copy the arcrest and arcresthelper folders to your python library directory to deploy the arcrest python library. This is typically a path such as C:\Python27\ArcGIS10.4\Lib.
  2. The tools modify existing services, therefore ensure that the services are published, accessible, and include the election district geometry with which the election results data will be associated.

Run the ElectionResults tool

Run the ElectionResults tool to verify the input parameters and complete the following steps for each political contest:

  1. In ArcCatalog or the Catalog window in ArcMap, open the ElectionResults tool from the ElectionTools toolbox.
  2. Fill in values for each of the parameters. The required parameters will depend on the structure of your data and the method used to publish the services.
  3. Click OK to run the tool. Verify that the data updated successfully.
  4. Copy the input parameters from the tool message window into a text file. This string of parameters should start with the tool name (ElectionResults) and include any trailing # marks. These will be the input parameters for Task Scheduler. For example: ElectionResults C:\ElectionResults\Application\PublishingTools\President_of_US.xls\President_of_US PRECINCTID "CANDIDATE1 NUMVOTES1 PARTY1 PERCVOTE1;CANDIDATE2 NUMVOTES2 PARTY2 PERCVOTE2" WINPARTY TOTBALLOTS "ArcGIS Online" http://myorganization.maps.arcgis.com MyUsername MyPassword http://services.arcgis.com/1234OrGgUiD12345/arcgis/rest/services/PresidentOfUS/FeatureServer/0 http://services.arcgis.com/1234OrGgUiD12345/arcgis/rest/services/PresidentOfUS/FeatureServer/1 # # PRECINCTID WINPARTY TOTBALLOTS PRECINCTID CANDIDATE NUMVOTES PARTY PERCVOTE

Run the VoterTurnout tool

Run the VoterTurnout tool to verify the input parameters and complete the following steps to prepare the voter turnout layer:

  1. In ArcCatalog or the Catalog window in ArcMap, open the VoterTurnout tool from the ElectionTools toolbox.
  2. Fill in values for each of the parameters. The required parameters will depend on the structure of your data and the method used to publish the services.
  3. Click OK to run the tool. Verify that the data updated successfully.
  4. Copy the input parameters from the tool message window into a text file. This string of parameters should start with the tool name (VoterTurnout) and include any trailing # marks. These will be the input parameters for Task Scheduler. For example: VoterTurnout C:\ElectionResults\Application\PublishingTools\Voter_Turnout.xls\Voter_Turnout PRECINCTID REGVOTERS TOTBALLOTS PERCVOTE "ArcGIS Online" http://myorganization.maps.arcgis.com MyUsername MyPassword http://services.arcgis.com/1234OrGgUiD12345/ArcGIS/rest/services/VoterTurnout/FeatureServer/0 http://services.arcgis.com/1234OrGgUiD12345/ArcGIS/rest/services/VoterTurnout/FeatureServer/1 # # PRECINCTID REGVOTERS TOTBALLOTS PERCVOTE PRECINCTID REPORTTYPE BALLOT BALLOTPERC

Set up the Task Scheduler

Use Windows Task Scheduler to create tasks that will update each political contest and voter turnout on a specific schedule. By scheduling these tools, the application users will be able to see the election results as they become available.

  1. Open the Task Scheduler on the desktop computer that is hosting the tools and the arcrest library.
  2. Click Action > Create Task and name your task.
  3. Click the Actions tab and click New.
  4. Set Action to Start a Program.
  5. Browse to the location of your Python installation (for example, <default directory>\Python27\ArcGIS10.4\python.exe).
  6. In the Add arguments text box, copy the name of the script (ElectionTools.pyt) and either the ElectionResults or the VoterTurnout parameters from the text file.
  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.
  10. Repeat steps 2 through 9 above for voter turnout and each political contest you would like to update.
Top