Names: Camilo Calvo-Alcaniz, Evan Eisenberg, Asher Fink
Date: 5/10/19
Project Topic: Crowdsourced Bills and Laws
URL:
Data point fields:
Field 1
: TextType: String
Schema:
Bill: {
text: String,
authors: [String],
date_introduced: String,
committee: String,
bill_id: Number
}
Law: {
text: String,
authors: [String],
date_passed: String,
committee: String,
bill_id: Number
}
CongressMember: {
name: String,
party: String,
year_inaugurated: Number
}
HTML form route: /create/bill
and /create/law
POST endpoint route: /api/create
Example Node.js POST request to endpoint:
var request = require("request");
var options = {
method: 'POST',
url: 'http://localhost:3000/api/addBill',
headers: {
'content-type': 'application/x-www-form-urlencoded'
},
form: {
text: "Sample bill",
authors: ["sample author 1", "sample author 2"],
date_introduced: "november 3",
committee: "committee on bill stuff",
bill_id: 123
}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
GET endpoint route: /api/getAllBillsAndLaws
Law and Bill Search Field: bill_id
Congress Member Search Field: name
Pages for viewing data
- Bills ->
/bills
- Laws ->
/laws
- Congress Members ->
/congressmembers
- About Us ->
/about
Pages for posting data
- Create Bill ->
/create/bill
- Create Law ->
/create/law
Whenever a bill or law is added, anyone else on the website gets a 2-second notification saying new bill/law added, with the ID of the bill or law.
We used faker
while testing our program to generate fake data
We used validator
to make validate input data on the back-end, such as requiring
bill IDs to be non-negative integers.