⚡️ Powered by: Google Civics API and OpenAI GPT3 ⚡️
DirectRep is an app that allows US Citizens to write letters to their elected representatives using Artifical Intelligence to generate the body text given a specific "issue" and "stance" on that issue. The user's representatives are gathered using Google Civic Information API and are determined by the Zip Code the user provides on Sign-Up.
This service lowers the barrier-to-entry for citizens to have their voices heard by their elected representatives. Regardless of your literacy, your English proficiency, your ability to articulate your thoughts and opinions, having your voice heard is now easier for everyone to access.
**Disclaimers**
There may be data missing from Google Civics API which may lead to certain representatives not being shown in the results. Always double check and verify your representatives' data.
Kim Geraghty -- FullStack Developer
Aaryan Mittal -- FullStack Developer
Vincent Phung -- FullStack Developer
John Gardner -- FullStack Developer
Page | Request Type | Path | Request Shape JSON | **Response Shape (JSON) |
---|---|---|---|---|
Signup Page | POST |
localhost:8080/api/accounts | { ;"full_name": "string" ,"email": "string" ,"zipcode": "string" ,"password": "string" } |
{ "access_token": "string" ,"token_type": "Bearer" ,"account": { "id": 0 ,"full_name": "string" ,"email": "string" ,"zipcode": "string" } } |
Login Page | POST |
localhost:8080/token | { "username": "string" ,"password": "string" } |
{ "access_token": "string" ,"token_type": "Bearer" } |
Get Token | GET |
localhost:8080/token | N/A | { "access_token": "string" ,"token_type": "Bearer" ,"account": { "id": 0 ,"full_name": "string" ,"email": "string" ,"zipcode": "string" } } |
Update Profile Page | PUT |
localhost:8080/api/accounts/$id |
{ "full_name": "string" ,"email": "string" ,"zipcode": "string" ,"password": "string" } |
{ "access_token": "string" ,"token_type": "Bearer" ,"account": { "id": 0 ,"full_name": "string" ,"email": "string" ,"zipcode": "string" } } |
Logout Page | DELETE |
localhost:8080/token | N/A | {true } |
(values in parenthesis are max values. e.g. VARCHAR(255) is a variable character with a max_length of 255 characters)
Field | FieldType | **options |
---|---|---|
id | SERIAL PRIMARY KEY |
NOT NULL |
full_name | VARCHAR(255) |
NOT NULL |
VARCHAR(255) |
NOT NULL |
|
zipcode | VARCHAR(5) |
NOT NULL |
hashed_password | VARCHAR(255) |
NOT NULL |
Letters-Service Endpoints
Page | Request Type | Path | Request Shape (JSON) | Response Shape (JSON) |
---|---|---|---|---|
Create Letter | POST | localhost:8090/api/letters | { "topic": "string" ,"stance": "boolean" } |
{ "id": 0 ,"topic": "string" "stance": true ,"content": "string" ,"user_id": 0 } |
Get ALL Letters for User | GET | localhost:8090/api/letters | N/A | { "id": 0 ,"created": "2022-12-12T04:00:12.644Z" ,"topic": "string" ,"stance": true ,"content": "string" ,"user_id": 0 } |
Get Single Letter | GET | localhost:8090/letters/${letter_id} |
N/A | { "id": 0 ,"created": "2022-12-12T04:00:12.644Z" ,"topic": "string" ,"stance": true ,"content": "string" ,"user_id": 0 } |
Edit Letter Body | PUT | localhost:8090/letters/${letter_id} |
{ "letter_id": 0 ,"content": "string" } |
{ "content": "string" } |
Delete Letter | DELETE | localhost:8090/letters/${letter_id} |
N/A | {true } |
Issues Endpoints
Page | Request Type | Path | Request Shape (JSON) | Response Shape (JSON) |
---|---|---|---|---|
Get ALL issues | GET | localhost:8090/api/issues | N/A | {"string" } |
Reps Endpoints
Page | Request Type | Path | Request Shape (JSON) | Response Shape (JSON) |
---|---|---|---|---|
Get Reps from API | GET | localhost:8090/civics | N/A | { "office": "string" ,"level": "string" ,"name": "string" ,"party": "string" ,"address": "string" "address": {} ,"email": "string" } |
Get All Reps | GET | localhost:8090/api/reps | N/A | [ { "office": "string" ,"level": "string" ,"name": "string" ,"party": "string" ,"address": "string" ,"address": {} ,"email": "string" } ] |
Select Rep | POST | localhost:8090/api/reps | { "office": "string" ,"level": "string" ,"name": "string" ,"party": "string" ,"address": "string" ,"address": {} ,"email": "string" } |
{ "rep_id" 0 ,"office": "string" ,"level": "string" ,"name": "string" ,"party": "string" ,"address": "string" ,"address": {} ,"email": "string" ,"letter_id": 0 } |
Get SINGLE Rep Selection | GET | localhost:8090/reps/${rep_id} | N/A | { "office": "string" ,"level": "string" ,"name": "string" ,"party": "string" ,"address": "string" ,"address": {} ,"email": "string" } |
Get ALL Rep Selections for SPECIFIC letter | GET | localhost:8090/reps/letter/${letter_id} | N/A | [ { "office": "string" ,"level": "string" ,"name": "string" ,"party": "string" ,"address": "string" ,"address": {} ,"email": "string" } ] |
Delete SINGLE Rep Selection from SPECIFIC letter | DELETE | localhost:8090/reps/letter/${letter_id} | N/A | {true } |
(values in parenthesis are max values. e.g. VARCHAR(255) is a variable character with a max_length of 255 characters)
Field | FieldType | **options |
---|---|---|
id | SERIAL PRIMARY KEY |
NOT NULL |
created | TIMESTAMP |
`DEFAULT CURRENT_TIMESTAMP |
topic | VARCHAR(1000) |
NOT NULL |
stance | BOOLEAN |
NOT NULL |
user_id | INTEGER |
NOT NULL |
Field | FieldType | **options |
---|---|---|
id | SERIAL PRIMARY KEY |
NOT NULL |
user_issue | VARCHAR(1000) |
NOT NULL |
openai_issue | VARCHAR(1000) |
NOT NULL |
**Field | FieldType | **options |
---|---|---|
rep_id | SERIAL PRIMARY KEY |
NOT NULL |
office | VARCHAR(255) |
NOT NULL |
level | VARCHAR(255) |
NOT NULL |
name | VARCHAR(255) |
NOT NULL |
address | VARCHAR(1000) |
NOT NULL |
VARCHAR(255) |
NOT NULL |
|
letter_id | INT |
FOREIGN KEY (letter_id) REFERENCES (letter_id) ON DELETE CASCADE |
Your list of available representatives is pulled from Google Civics API using the Zip Code provided on Sign-Up
When creating a letter, your "issue" and "stance" are sent to a 3rd party API that then uses a large-language model to generate the letter body the users desires.
When the AI returns your letter body, the user can change, add, or remove any part of the letter, making it fully customizable and ensuring the voice accurately represents the user.
After creating an account and creating letters, the letters you see in your Dashboard are only the letters you created
After creating an account and creating letters, the letters you see in your Dashboard are only the letters you created
- Git clone into your local repository
git clone «repo»
- cd into it
cd direct-rep
- Create a new file in the root directory called
.env
(This is where you'll store your Google Civics API Key and you OpenAI API Key) - Create a volume and name it beta-data
docker volume create postgres-data
- Build the image and run the container
docker compose up --build
- Open browser to http://localhost:3000 to make sure it’s running
- Once it’s up and running, you can begin with creating an account and confirming that account. Once you confirm the account, you can create a new letter.
People residing in the United States of America.
Making contacting your elected officials more accessible
- List of representatives with their details.
- List of issues.
- Open AI to draft an automated AI generated letter.
- Login / logout feature.
- Email template sent to user’s email with letter draft and rep’s emails list.
- Keep track of past letter templates / requests