-
Notifications
You must be signed in to change notification settings - Fork 1
Open Election Data Models
Required fields are the minimum number of fields required to create the record in the database. The application may require additional fields.
Fields denoted with an asterisk * are indexed.
required fields:
id* - UID - secure unique identifier - created in postgres. Do not use integer types.
createdAt - datetime stamp in UTC for record created
updatedAt - datetime stamp in UTC for last update. - Indexed
deletedAt - datetime stamp in UTC for deletion
Governments are entities that match donations, administer donation programs and possibly run elections.
Table Name: Governments
Required fields:
slug* - varchar(24) - unique indexed - the subdomain and humanreadable name
for the government (i.e. portland, seattle). must be alphanumeric.
will be used for folders & naming items in the system
name - varchar(255) - the display name of the government program
Not Required
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)
Users have access to the system, are linked to permissions and can add/edit/read data.
Table name: Users
Required Fields:
email* - varchar(255) - required - the email of the user
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 connects a user to a campaign and/or governnent.
Table name: Permissions
Required fields
userId* - the user record - Indexed
role - enum[superAdmin|campaignAdmin|campaignStaff]
governmentId* - the government id - if set, applies to all campaigns under the government
campaignId* - the campaign id - if set, applies to only the campaign
Campaigns are entities that will receive donation match funds. They submit donations and expenditures, and receive a matching donation. Campaigns are for ONE candidate running for office. A user can be connected to multiple campaigns.
Required Fields
Name - Campaign name
Fields - Generated by the api
id
createdAt
updatedAt
Fields - Entered by the Campaign
date - the contribution date
type - ENUM Contribution | Other
subType - If Contribution was selected: ENUM of cash, inkind_contribution, inkind_paid_supervision, inkind_forgiven_account, inkind_forgiven_personal.
If Other type, ENUM of item_sold_fair_market, item_returned_check, item_misc, item_refund.
contributorType - ENUM individual, business, family, labor, political_committee, political_party, unregistered, other
all strings -> contrPrefix, contrFirst, contrMiddleInitial, contrLast, contrSuffix, contrTitle
contrBusinessName: string
Address1, Address2, Country/Region, City, State, Zip, County strings
email: string
phone: string
phoneType: ENUM Mobile, Work, Home
submitForMatching: boolean,
checkNumber: string,
amount: float
calendarYearAggregate: float,
inKindDescription: blob,
occupation: string
employerName: string
employerCity:string
employerState:string
notes: blob
matchStatus: ENUM Draft, Submitted
Fields managed by city:
complianceStatus: in_compliance, out_of_compliance, other_compliance
matchStatus: Matcheable, Processed, Paid
matchAmount: float
We need an auditable activity log of all actions taken in the system.
** Table Name: activities ***
Required fields
id - uniq/indexed
userId* - the user id who performed or target of the activity
activityType* - an enum of activity types
activityRecordId* - an id of the record affected
notes* - Plain language description of what occured
Not Required fields
campaignId - the campaign id
governmentId - the government id