Skip to content

Open Election Data Models

Dan Melton edited this page Mar 24, 2019 · 23 revisions

All tables

Required fields are the minimum number of fields required to create the record in the database.

required fields:

id* - UID - secure unique identifier - created in postgres. Do not use integer types. - Indexed
createdAt - datetime stamp in UTC for record created
updatedAt - datetime stamp in UTC for last update. - Indexed

Government

Governments are entities that match donations, administer donation programs and possibly run elections. All records are located against the government entity

Table Name: Governments

Required fields:

slug - varchar(24) - the subdomain and huma-nreadable name for the government (i.e. portland, seattle).  - Indexed
must be alphanumeric. will be used for folders & naming items in the system

Not Required

name - varchar(255) - the display name of the government program
website - varchar(255) - the government's main website for the matching program
domain - varchar(255) - the fully qualified domain name for the program (https://www.portlandopenelections.org)

User

Users have access to the system, are linked to permissions and can add/edit/read data.

Required Fields:

email - varchar(255) - required - the email of the user -  Indexed
salt - varchar(255) - required - the application generated salt for the password
passwordHash - varchar(255) - required - the salted md5 hash of the password (salt + password)

Not Required Fields:

phone - uinteger(64) - the phone number of the user
firstName - varchar(255) - the user's first name
lastName - varchar(255) - the user's last name
address1 - varchar(255) - the mailing address
address2 - varchar(255) - the additional mailing address
city - varchar(255) - the city
state - varchar(255) - the two letter abbreviation
postcalCode - varchar(255) - the postal code - 5 to 8 numbers. dashes allowed

Permissions

Required fields userId - the user record - Indexed permissionLevel - enum[admin|write|read] resource - enum[User|Donation|] - a human readable resource identifier. Can correspond to the table name, a service, capability, etc governmentId - the government id - if set, applies to all campaigns under the government campaignId - the campaign id - if set, applies to only the campaign

Settings

Documents

Campaign

Election Cycle

Donor

Donation

Expenditure Report

Expenditure

Donor Match Rule

Resident Record

Clone this wiki locally