Populating
the Database
Once the
database is
set up you can
begin to populate it with election data. There are two means of
inserting the data - manually with the Inserter and automatically
using the Importer.
Inserting
Add New
Election
If the database
has just been
created then the first task is to insert a new election. The add
new
election dialogue is invoked by the selecting the menu Tools - > Insert -> New Election.
Provide the
following details for the new
election:
- A meaningful and unique name. It is probably not a bad idea to
start the name with the election year as in the above example, as
election lists are presented alphabetically elsewhere.
- The date the election occurred.
- The election type. The current supported types are:
- National – a single constituency national election (for
example in Scotland and Wales are national single list constituencies
in European elections.
- General – a constituency based national general election.
- Devolved – a constituency based election from a devolved
parliament or assembly (for example Scotland and Wales in the UK,
Catalonia in Spain or perhaps Hessen in Germany)
- By-Election-G – a constituency based by-election for a
national parliament.
- By-Election-D - a constituency based by-election for a
devolved parliament.
- Regional – an election containing regional results.
- Local – a ward based council election.
- Electoral System. The current supported types are:
- F.P.T.P – first past the post.
- List – proportional list system.
Select OK to
insert the new election into the
database.
Add New Candidate
A new candidate
can be inserted into the database by using the Insert New Candidate
dialog - Tools - > Insert ->
New Candidate
Give the new
candidate a first and surname, select a party and press Apply or OK.
Note: currently
the populating of
the Party table is a manual task - this
will be added in a future release.
Inserter
The Inserter is
a
tool for manually
inserting results into the database. It is invoked by
right-clicking on the constituency (from the Constituency
Tree) you wish to insert the result into and select Add Result.
The upper level
of the display show
the most recent result for this constituency (if one exists).
The
centre
section contains the widgets for inserting a new result and
navigating previous results of the same constituency.
Note: if the
election is a List
election then the above dialogue will differ in that the election
participant will be a party instead of a candidate.
To insert
a new
result:
- Select the election you wish the result to be inserted into.
- Choose the candidates by clicking the Change button and
selecting the candidate from the Candidate
Selector and clicking OK.
The party column of the candidate is automatically filled.
- Insert the number of votes for each candidate in the left hand
text field.
- Insert the size of the electorate (or alternatively the
percentage turnout, if both are supplied the turnout is ignored).
Add Party Leader
For each
election, a total vote is calculated and displayed under the nation
tree node. The candidate's name for this overall result is the
party leader. The party leader can be defined using the Add Party
Leader dialogue - Tools ->
Insert -> Party Leader.
The dialogue
displays a list of current defined leaders for the currently selected
election. Using the Candidate
Selector dialogue (Find Candidate)
you can add another leader to the election. If the election is a
local election, you will have the additional step of selecting the
council.
Candidate Selector
The candidate
selector dialogue is a utility dialogue used by a number of screens for
selecting candidates in an election.

It displays all
candidates in the database alphabetically with the candidate's party
abbreviation. A seach field dynamically filters for the pattern
inserted into the field. The dialogue also has the ability to
insert new candidates using the Add
New Candidate
dialogue.
Importing
The importer
populates the database
automatically from comma separated files (typically exported from a
spreadsheet) containing the election data.
The files must
contain the following
information about each election entry:
- F.P.T.P - the candidates first name, the candidates surname, the
party of the candidate, the constituency of the entry and the number of
votes the candidate gained.
- List - the party, the constituency of the entry and the number of
votes the party gained.
Configuration
The following
properties are defined in the
<gswing_home>/etc/properties.cfg file to tell the importer
where in the CSV file to find each column.
To invoke the
importer use the Tools -> Importer option
You will be
presented with the following options:
Create
XML from CSV.
- Once selected you are presented with a list of elections in the
database. Select the election you wish to add the results to.
Press OK.
- You are presented with a list of the CSV files in the directory
<gswing_home>/data/csv. Select the file containing the data
you
wish to insert. Press OK.
- The XML file is created and the original CSV file is moved to the
<gswing_home>/data/csv/processed directory.
Import
from XML
- When presented with a list of XML files stored in
<gswing_home>/data/xml. Select the file you wish to
import. Press
enter.
- The importer goes through the constituencies in the XML file and
checks they exist. If a constituency does not exist you will be
asked
if you wish to add it. Each constituency must belong to region,
if no regions exist you will be asked to insert a region name to be
inserted. Otherwise you will be asked to select the region you wish the
constituency to belong to. If the region does not exist in the
list you can add one from the Constituency Tree.
- The Importer then checks if the parties exist. If a party
does
not exist you will be prompted for the party abbreviation. Note:
the party full name is stored in the XML file and is therefore used in
the search. If a party exists in the database but the Importer
has not found it - because of difference in case or name structure for
example – inserting an existing abbreviation will not create duplicate
parties in the database (Instead an alias entry will be added to the
file <gswing_home>/etc/aliases.xml).
- If no errors are encountered, the results are imported into the
database and the XML file is moved to the directory
<gswing_home>/data/xml/processed.