tevjef / politic

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Politic

  • Privacy policy about data usage
  • Geocoding

APIs

GET /voterRoll/states

Static data stored in Firestore and cached for 1 day. Data will be modified when more voter registration are added to functions.

{
    "states": [
        {
            "name": "New Jersey",
            "abbreviation": "NJ",
            "fields": [
                {
                    "inputType": "text"
                    "key": "firstName|lastName|middleInitial"
                },
                {
                    "inputType": "number"
                    "key": "zipCode"
                },
                {
                    "inputType": "dobMY|dobDMY"
                    "key": "month|year|day"
                },
                ,
                {
                    "inputType": "selection"
                    "key": "county"
                    "options": [
                        "Kings (Brooklyn)"
                    ]
                }
            ]
        }
    ]
}

POST /voterRoll/checkRegistration

// Request

{
    "voterInformation": {
        // Using the abbreviation for the state and the key/id, non-null
        "state": "NJ",
        // nullable
        "county": "Kings",
        // nullable
        "firstName": "First",
        // nullable
        "lastName": "Second",
        // nullable
        "middleInitial": "I",
        // 01 or 12, nullable
        "month": "MM",
        // nullable
        "year": 2012
    }
}

// Response
{
    "voterStatus": {
        "type": "multipleEnrolled|singleEnrolled|notEnrolled|notFound",
        // singleEnrolled
        "value":  [
            {
                "title": "",
                "message": ""
            }
        ],
        // multipleEnrolled
        "value": [{
            "voterData": [
                {
                    "title": "",
                    "message": ""
                }
            ]
        }],
        // notFound
        "value": {
            "phone": {
                "label": "212-555-5555",
                "uri": "",
            "requirements": "markdown",
            // URL for user to register at.
            "registrationUrl": { "label": "https://", "uri": "" }
        },
        // notEnrolled
        "value": {
            "phone": {
                "label": "212-555-5555",
                "uri": "",
            "requirements": "markdown",
            // URL for user to register at.
            "registrationUrl": { "label": "https://", "uri": "" }
        }
    }
}

GET /feed/states/{state}

// Request
// - Path parameter with the state abbreviation

// Response
{
  "feed": [
    {
      "itemType": "keyVote",
      "title": "Amends Teacher Health Benefits (S 2273) - Passage Passed - Executive",
      "link": "http://votesmart.org/bill/28233/73218"
    }
  ],
  "representatives": [
    {
      "displayName": "Robert Menendez",
      "image": "https://theunitedstates.io/images/congress/225x275/M000639.jpg",
      "bioguide": "M000639"
    }
  ]
}

GET /feed/representatives

// Request

// Response
{
  "senators": [
      {
        "displayName": "Robert Menendez",
        "image": "https://theunitedstates.io/images/congress/225x275/M000639.jpg",
        "description": ""
      }
    ],
    "representatives": {
      "localRepresentative": [
        {
          "displayName": "Robert Menendez",
          "image": "https://theunitedstates.io/images/congress/225x275/M000639.jpg",
          "description": ""
        }
      ],
      "others": {}
    },
    "local": [
      {
        "officeTitle": "Hudson County Clerk",
        "officials": [
          {
            "displayName": "Robert Menendez",
            "image": "https://theunitedstates.io/images/congress/225x275/M000639.jpg",
            "description": ""
          }
        ]
      }
    ]
}

GET /feed/elections/{id}

// Request

// Response
{
  "election": {
    "electionsName": "Georgia General Primary Runoff Election",
    "electionDay": "2020-08-11",
    "pollingLocations": [
      {
        "locationName": "ANTIOCH BAPTIST CH FAMILY CNTR",
        "address": "540 Cameron Madison Alexander Boulevard Northwest",
        "pollingHours": "Fri, Aug 7: 8:30 am - 6:00 pm",
        "startDate": "2020-07-20",
        "endDate": "2020-08-07"
      }
    ],
    "earlyVoteSites": [
      {
        "locationName": "ANTIOCH BAPTIST CH FAMILY CNTR",
        "address": "540 Cameron Madison Alexander Boulevard Northwest",
        "pollingHours": "Fri, Aug 7: 8:30 am - 6:00 pm",
        "startDate": "2020-07-20",
        "endDate": "2020-08-07"
      }
    ],
    "dropOffLocations": [
      {
        "locationName": "ANTIOCH BAPTIST CH FAMILY CNTR",
        "address": "540 Cameron Madison Alexander Boulevard Northwest",
        "pollingHours": "Fri, Aug 7: 8:30 am - 6:00 pm",
        "startDate": "2020-07-20",
        "endDate": "2020-08-07"
      }
    ],
    "electionAdministrationBody": {
      "name": "STATE Board of Elections",
      "electionInfoUrl": {
        "label": "http://sos.ga.gov/index.php/elections",
        "uri": "sos.ga.gov"
      }
    },
    "contests": [
      {
        "title": "Primary",
        "subtitle": "countywide",
        "candidates": [
          {
            "name": "THEODORE JACKSON",
            "party": "Democratic"
          },
          {
            "name": "PATRICK \"PAT\" LABAT",
            "party": "Democratic"
          }
        ]
      }
    ]
  }
}

GET /feed/elections/all

// Request

// Response
{
  "elections": [
    {
      "id": "2323",
      "electionsName": "Georgia General Primary Runoff Election",
      "electionDay": "2020-08-11"
    }
  ]
}

POST /voterRoll/save Authorization: Token from Firebase Auth

Saving voter registration data,

// Request
{
    "enrollment": {
        "voterInformation": {

            "state": "NJ",
            "firstName": "First",
            "lastName": "Second",
            "middleInitial": "I",
            // 01 or 12
            "month": "MM",
            "year": 2012
        },
        // Token from Firebase Notifications
        "notificationToken": "token"
    }

}

// No response

POST /voterRoll/manual Authorization: Token from Firebase Auth

// Request
{
    "manualEnrollment": {
        "enrolled": false,
        // Token from Firebase Notifications
        "notificationToken": "token"
    }

}

// No response

POST /user/notificationToken Authorization: Token from Firebase Auth

// Request
{
    "tokenUpdate": {
        "token": "token"
    }
}

// No response

GET /user/location Authorization: Token from Firebase Auth

// Request

// Response
{
    "location": {
        "state": "NJ",
        "zipcode" "12345",
        "legislativeDistrict": "6",
        "congressionalDistrict": "40"
    }
}

POST /user/location Authorization: Token from Firebase Auth

Saves the state and district of the user on the backend into a table

// Request
{
    "locationUpdate": {
        "location": {
            "lat": 0,
            "lng": 0
        }
    }
}

// Response
{
    "location": {
        "state": "NJ",
        "latlng": {
            "lat": 0,
            "lng": 0
        }
        "zipcode" "12345",
        "legislativeDistrict": "6",
        "congressionalDistrict": "40"
    }
}

POST /maps/autocomplete Authorization: Token from Firebase Auth

Saves the state and district of the user on the backend into a table

// Request


// Response
{
    "result": [
        "340 3rd Street, Jersey City, NJ, USA",
        "340 Third Avenue, New York, NY, USA",
        "340 South 3rd Street, Brooklyn, NY, USA",
        "340 3rd Street, Palisades Park, NJ, USA",
        "340 3rd Avenue, Brooklyn, NY, USA"
    ]
}

Firebase Firestore Tables

notification_auth_tokens

[
  {
    "user-auth-token": {
      // token send from device
      token: "token",
    },
  },
];

voter_roll_states

[
  {
    "state-name": {
      phone: {
        label: "212-555-5555",
        uri: "",
      },
      requirements: "markdown",
      // URL for user to register at.
      registrationUrl: { label: "https://", uri: "" },
    },
  },
];

electoral_register

Contains a list of all the users that have chosen to save their data.

[
  {
    "user-auth-token": {
      voterInformation: {
        // Using the abbreviation for the state and the key/id
        state: "NJ",
        firstName: "First",
        lastName: "Second",
        middleInitial: "I",
        // 01 or 12
        month: "MM",
        year: 2012,
      },
      manualMarkedEnrolled: "zonedDateTime",
      // The last time a cron job was run on the users voter status or the last time the user manually checked.
      lastCheck: "zonedDateTime",
      lastStatus: "enrolled|unenrolled|unknown",
    },
  },
];

locations

Contains a list of all the users that have chosen to save their data.

[
    {
        "user-auth-token": {
            "state": "NJ",
            "zipcode" "12345",
            "legislativeDistrict": "6",
            "congressionalDistrict": "40"
        }
    }
]

About


Languages

Language:Dart 68.8%Language:TypeScript 25.2%Language:HTML 4.6%Language:Ruby 1.2%Language:Swift 0.1%Language:Kotlin 0.0%Language:Shell 0.0%Language:Objective-C 0.0%