Home
Welcome:
Quick Links
Introduction
Programming
Syntax
Examples
Slate Card Generator
Van Export Filter

Analyzer File Analysis Utility Documentation

Voter Analysis Programming

The Voter Analysis Tool is capable of performing a data analyses or filtering and extracting selected data fields from a dataset. The programming language consists of descriptive statements which are generally common between a data analysis request and a data extraction request. Here is the complete list of statements and where they may be used.

Statement ReportAnalysis ExportFields
RequestType Y Y
TargetElection Y Y
GroupBy Y N/A
Precincts Y Y
Zone Y Y
Filter Y Y
Report Y N/A
Type Y N/A
Column Y N/A
Compute Y N/A
Export N/A Y

The programming language for the Voter Analysis Tool is a descriptive (rather than procedural) language consisting of 9 statements:

  • RequestType - Declares whether this is an data analysis or data extraction
  • TargetElection - Defines the targeted election year (i.e. 2020)
  • GroupBy - Defines which fields/values to use for rows
  • Precincts/Zone - Defines a list of precinct numbers to include for analysis or extraction.
  • Filter - Defines data to be included or excluded from report analysis
  • Report - Provides a name the generated analysis
  • Column - Defines a report column heading and selection criteria
  • Compute - Defines a computed column
  • Export - Defines a list of fields to be exported to a csv file.
  • A program file must begin with the declaration of which type of request is being described. Following the RequestType statement, a program is divided into two sections. The first section describes which data records in the dataset should be included and in the case of an analysis, how the data should be organized. Statements allowed in this section include TargetElection, GroupBy, Precinct, Zone, and Filter. These statements may appear in any order.

    • ReportType: <ReportAnalysis> | <ExportFields>

      The ReportType statement defines the type of output described by the program. This statement must be on the first line of the file.

    • TargetElection: <year>

      The TargetElection statement controlls the election year of the current election and the election years used to compute the voter temperature value (HWCN type). If the year specified is in the future, the current election year will be the year of the most recent election and the previous election years for HWCN determination will be the current election year and the prior election.

    • Groupby: ( <field1> [ , <field2> [ , <field3> ]] )

      The GroupBy statement defines the grouping of data into rows for the final report. It is optional and defaults to grouping data into rows by precinct number. If provided, the GroupBy statement may specify up to three fields from the dataset. The order of the fields is significant. The unique values from each GroupBy field will be extracted from the dataset, sorted, and combined to establish the row qualification for the analysis.

    • Precincts: ( <number> [ , <number>])
      Zone: <Zone Name>

      These statements define precinct numbers to be used to filter data included in the analysis or extracted list. Precinct and Zone statements are optional. If no user defined zone is provided, a list of all unique precinct numbers contained in the dataset will be used.

      Precinct numbers specified as whole values (no decimal portion) specify rows which include all corresponding sub-precincts. Precincts identified as a sub-precinct will select only that specific sub-precinct. In this way, you can control whether the report is detailed at the sub-precinct level or summarized at the whole precinct number level.

      The Zone statement specifies the use of a predefined list of precincts. For a list of predefined zones see Predefined Zones.

      The Precinct statement defines an arbitary list of precinct numbers to be used by the GroupBy statement when defining rows.

    • Filter: [ Include | Exclude] ( <criteria> )
    • The Filter statement is used to provide flexible criteria for including (or excluding) data from the analysis. For a full definition of a criteria, please refer to the Language Syntax.

    • Example 1: Include only democrats in the analysis.
      Filter: Include ( Party == DEM )

    • Example 2: Exclude people who did not vote in 2020.
      Filter: Exclude ( (2020GeneralElection == N ) OR
            (2020GeneralElection == ' ' ) )
    • Example 2a: Alternative way to determine voting.
      Filter: Exclude ( VoterVoted == FALSE )

    • A program may contain both an Include filter and an Exclude filter, but may not contain multiple filters of the same type.

    If the request is for an analysis, the second section begins with a 'Report' statement which may be folowed by any number of column/computation definitions.

    • Report: <Report Name>

      The Report statement marks the end of the initialization statements and the beginning of column definitions for the analysis. The only parameter is the name of the analysis. This is the name given to the file which will be downloaded to your computer upon completion of the analysis.

    • Column: <Column Name> ( <criteria> )

      The Column statement defines a name and the criteria for including a voter record in this column count.

    • Compute: <Column Name> ( <calculation> )

      The Compute statement defines a name and the method of computing the value for this column. Calculations can be performed using the values contained in any preceeding column (including preceeding computed columns). For a full definition of a calculation, please refer to the Language Syntax.

    If the request is for a data file export, the second section may only contain an 'Export' statement.

    • Export: ( <field name> | , <field name> )

      The Report statement marks the end of the initialization statements and the beginning of column definitions for the analysis. The only parameter is the name of the analysis. This is the name given to the file which will be downloaded to your computer upon completion of the analysis.