Schedule reporting scripts

Election Results Viewer includes a toolbox and Python script to create and update election results operational layers that are used to report current political contest results in Election Results Viewer. It uses your precinct geography and organization's tabulation results to create political contest layers viewed in Election Results Viewer. The scripts provided with the toolbox can be used in ArcMap or ArcCatalog, or run as a scheduled task.

ElectionsResults.py is a script you can use to merge election results (.xls, .xlsx, .txt, or .csv) for individual political contests and join them to your voting precincts feature class. In addition, it calculates the date and time in the LastUpdate field so you can convey the currency of the results information. The script overwrites previous results data each time it runs, and you should ensure the tabulation results you process include cumulative results on election night.

Configure the reporting scripts

To place the scripts and tools in the correct location, complete the following steps:

  1. Using Windows Explorer, browse to the Application\PublishingTools folder and copy the ElectionResults toolbox and Python script to a location on your computer to which you are comfortable having log files written.

Validate the ElectionResults tool

Run the tools manually to verify they work as expected.

To validate the tool, complete the following steps:

  1. In ArcCatalog or the Catalog window in ArcMap, open the ElectionResultsTool in the ElectionResults toolbox.
  2. Click the Input Folder with Files parameter and browse to Application\PublishingTools\Spreadsheets folder.
  3. Click the Voting Precincts Feature drop-down and click VotingPrecinct.
  4. Click the Election Results Feature Dataset and browse to MapsandGeodatabase\LocalGovernment.gdb\ElectionResults feature dataset.
  5. Click OK.

    Verify that the data updated successfully.

Run the ElectionResults tool using Task Scheduler

Use Windows Task Scheduler to set the tools to run on a specific schedule. By scheduling this tool, the application users will be able to see the election results as they become available.

To update the election results on a schedule, complete the following steps:

  1. Open the Results window and double-click the successful validation result.
  2. Copy and paste the parameters into a text editor as a single line of text separated by spaces.
    1. Folder hosting your tabular election data Application\PublishingTools\Spreadsheets
    2. Voting Precinct Feature Class LocalGovernment.gdb\ElectionAdministration\VotingPrecinct
    3. ElectionResults Feature Dataset LocalGovernment.gdb\ElectionResults
    4. Field Name to join with from Parameter 1 Example: NAME
    5. Field Name to join with from Parameter 2 Example: NAME
    6. Field Name for last update field Example: LASTUPDATE
  3. Add double quotes (" ") around each parameter, then save the file and exit.
    • "C:\Application\PublishingTools\Spreadsheets"
    • "C:\MapsandGeodatabase\LocalGovernment.gdb\ElectionAdministration\VotingPrecinct"
    • "C:\MapsandGeodatabase\LocalGovernment.gdb\ElectionResults" "NAME" "NAME" "LASTUPDATE"

Set up the Task Scheduler

  1. Open the Task Scheduler on the computer that is hosting your LocalGovernment.gdb.
  2. Select Action > Create Task and name your task.
  3. Select the Actions tab and click New.
  4. Set Action to Start a Program.
  5. Browse to to the location of your Python installation (for example, <default directory>\Python27\ArcGIS10.2\python.exe).
  6. In the Add Arguments text box, copy the name of the script and the 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, set a schedule for your task and click OK.
Top