whitehouse / petitions Goto Github PK
View Code? Open in Web Editor NEWDrupal installation profile powering We The People at petitions.whitehouse.gov
Home Page: https://petitions.whitehouse.gov/
Drupal installation profile powering We The People at petitions.whitehouse.gov
Home Page: https://petitions.whitehouse.gov/
I am building a web application that will communicate via the API. If the service fails to respond due to internal errors, will I get a response?
My email address is displayed with an underscore instead of a period. Is there a reason for this?
https://github.com/WhiteHouse/petition/blob/7.x-1.x/modules/custom/wh_core/wh_core.install
The install hook calls all the update hooks. In the first update hook, your echo'ing all your css, html, and js of the frontpage into a variable. This really, really, really bad practice...
I am building a web application that will post petition signatures via the write API.
I can definitely foresee a scenario where all of the required fields were not gathered. If I am trying to post a signature via the API at http://api.whitehouse.gov/v1/signatures that does not contain all of the required fields, will I get an error response?
Firstly I had the 404 on /petition/create but I used the file modified for localhost but now when I try to create a petition, this is what I get.
https://dl.dropboxusercontent.com/u/48832584/petitions.PNG
I also have the following notice when I log as admin https://dl.dropboxusercontent.com/u/48832584/petitions_modules.PNG
I followed step by step your install several times and I always get the same result :(
Well, everything went smoothly, all 4 sets of modules installed, when I get this little bug: http://d.pr/i/NTgI
Initial install seemed to be working, and petition_install1 proceeded normally. The site itself still functions despite this error, but presumably one of the rules configurations is incomplete.
A quick Google suggests we might need this patch: https://drupal.org/node/1952170 or possibly it might also be a dependency issue: https://drupal.org/node/1412452.
drush en -y petition_install2
The following extensions will be enabled: petition_install2, wh_user_ss_data, wh_response_feature, wh_petition_page, taxonomy_sync, petitions_user_registration, petitions_logintoboggan_settings
Do you really want to continue? (y/n): y
Creating default object from empty value entity.module:660 [warning]
WD rules_config: PDOException: SQLSTATE[HY000]: General error: 1364 Field 'plugin' doesn't have a default value: INSERT INTO [error]
{rules_config} (name, status, module) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array
(
[:db_insert_placeholder_0] => rules_user_validate_redirect
[:db_insert_placeholder_1] => 2
[:db_insert_placeholder_2] => petitions_user_registration
)
in drupal_write_record() (line 7136 of /home/owen/workspace/petitions/includes/common.inc).
WD php: PDOException: SQLSTATE[HY000]: General error: 1364 Field 'plugin' doesn't have a default value: INSERT INTO {rules_config} [error]
(name, status, module) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array
(
[:db_insert_placeholder_0] => rules_user_validate_redirect
[:db_insert_placeholder_1] => 2
[:db_insert_placeholder_2] => petitions_user_registration
)
in drupal_write_record() (line 7136 of /home/owen/workspace/petitions/includes/common.inc).
Cannot modify header information - headers already sent by (output started at /home/owen/workspace/drush/includes/output.inc:38) [warning]
bootstrap.inc:1212
PDOException: SQLSTATE[HY000]: General error: 1364 Field 'plugin' doesn't have a default value: INSERT INTO {rules_config} (name, status, module) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array
(
[:db_insert_placeholder_0] => rules_user_validate_redirect
[:db_insert_placeholder_1] => 2
[:db_insert_placeholder_2] => petitions_user_registration
)
in drupal_write_record() (line 7136 of /home/owen/workspace/petitions/includes/common.inc).
Drush command terminated abnormally due to an unrecoverable error. [error]
If a petition includes the word "classic", the module will consider it profane, because "classic" includes "ass".
See The Clbuttic Mistake: When obscenity filters go wrong for common pitfalls around obscenity filters/detectors.
Here's the naive line of code.
I'm not familiar with Drush and get stuck on step 4.
drush -y make --no-core --contrib-destination=. drupal-org.make
I keep getting this response:
Make new site in the current directory? (y/n): y
file_get_contents(drupal-org.make): failed to open stream: No such file or directory make.utilities.inc:456 [warning]
Invalid or empty make file: drupal-org.make
I've had very little luck finding the answer with a web search. Any information would be helpful. thanks!
Yes
When a petition is created, identify any place names within it and store their coordinates (such as with Yahoo Placefinder). Then expose those coordinates as a part of the JSON, and permit proximity searches. Likewise, when a petition is signed, geocode that using a free ZIP centroid database (e.g., 1, 2, 3), and expose those in the same manner. This will enable a variety of location-based services based on We The People data.
At Step 5,
After select profile 'petition' and select language,
installer shows only message 'Sorry, the profile you have chosen cannot be loaded.' without progress.
Surely, 1,2,3,4 steps went well, and I checked 'phpinfo' for mongodb and mysql extentions.
I am building a web application that views petitions via the API. If I accidentally enter an invalid petition ID, will I get a response? If so, what will it look like?
It appears that the text-based arguments (title
and body
for sure) for the API are case-sensitive (e.g. "Freedom" != "freedom"). This means that searches for petitions with "guns" in the title will be different than those for "Guns" as shown below:
https://api.whitehouse.gov/v1/petitions.json?title=guns&limit=1
{"metadata":{"responseInfo":{"status":200,"developerMessage":"OK"},"resultset":{"count":5,"offset":0,"limit":1},"executionTime":0.049998},"results":[{"id":"50e0abe3c988d4dd53000022","type":"petition","title":"Tax sales of guns and ammunition","body":"We request that Congress and the President institute a federal sales tax on guns and ammunition. Revenue from the tax should be used to pay for enforcement of existing gun laws, improved mental health care, gun safety programs, violence prevention programs, a national firearms injury/mortality database, and a compensation fund for victims of gun violence.","issues":[{"id":"3","name":"Budget and Taxes"},{"id":"10","name":"Criminal Justice and Law Enforcement"},{"id":"22","name":"Firearms"}],"signatureThreshold":25000,"signatureCount":3393,"signaturesNeeded":21607,"url":"https://petitions.whitehouse.gov/petition/tax-sales-guns-and-ammunition/HQQmBzW1","deadline":1359493347,"status":"closed","response":null,"created":1356901347}]}
https://api.whitehouse.gov/v1/petitions.json?title=Guns&limit=1
{"metadata":{"responseInfo":{"status":200,"developerMessage":"OK"},"resultset":{"count":3,"offset":0,"limit":1},"executionTime":0.03},"results":[{"id":"50f62a5d6ce61ca803000007","type":"petition","title":"Impeach President Barack Obama if Executive Orders are signed to ban Assault Rifles, Guns & High Capacity Magazines","body":"The Vice President has made it clear that 19 Executive Orders could / will come about if an Assault Rifle / High Capacity Magazine ban is not passed through the House. This is a violation of our 2nd Amendment. I propose that our elected officials Impeach President Barack Obama if he signs executive orders to take away this right to bear arms. Our 2nd Amendment was written to stand up against a tyrant government. Our government has F18s and F16s, we the people should be allowed a Semi Automatic Rifles to defend ourselves from a possible tyrant government take over. ","issues":[{"id":"22","name":"Firearms"},{"id":"193","name":"Government Reform"},{"id":"175","name":"Urban Policy"}],"signatureThreshold":100000,"signatureCount":8992,"signaturesNeeded":91008,"url":"https://petitions.whitehouse.gov/petition/impeach-president-barack-obama-if-executive-orders-are-signed-ban-assault-rifles-guns-high-capacity/rVVBsPhM","deadline":1360901981,"status":"closed","response":null,"created":1358309981}]}
I would expect that these two queries would return the same results.
https://petitions.whitehouse.gov/petition/allow-trans-people-military/FbFBNrbc
This is one example. I thought signatures were supposed to continuously show up? I tried signing but it didn't show.
Individual petitions should provide an embeddable thermometer that petition creators, and signers, can display on their own sites.
It should display:
The embed should be small enough to be embedded on most blog posts (e.g. roughly 500px x 300px).
The petitions data necessary to do this can be retrieved using the We the People API. Sheldon Rampton built a thermometer Drupal module at the first White House hackathon and several other hackathon participants have done similar work, including Douglas Back's Widget the People.
Example:
the modules mentioned in step seem to be missing
$drush en -y petition_install1
petition_install1 was not found and will not be enabled. [warning]
There were no extensions that could be enabled. [ok]
$ drush en -y petition_install2
petition_install2 was not found and will not be enabled. [warning]
There were no extensions that could be enabled. [ok]
$ drush en -y petition_install3
petition_install3 was not found and will not be enabled. [warning]
There were no extensions that could be enabled. [ok]
$ drush en -y petition_install4
petition_install4 was not found and will not be enabled. [warning]
There were no extensions that could be enabled. [ok]
step 7 (if there is any) is also missing from the installation instructions
Only petitions with at least 150 signatures are included in the bulk download (SQL) file at present. That limits substantially the value of that bulk download, although I appreciate that there are many purposes for which it's best not to bother with petitions that get virtually no signatures. Provide an alternate bulk download that includes all petitions.
Failure when trying to run petitions_install1:
WD php: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'petitions.cache_petitions_api_keys' doesn't
It appears there was no cache_petitions_api_keys table created during install.
I am building a web application that will submit signatures via the write API and confirm that signatures have been validated via the validations resource. If I pass an invalid API key with my request, will I get a response?
I am building a web application that will communicate via the read API. If I pass an invalid petition ID with my request, will I get a response?
In the plaintext version of the email with the subject line Action Needed: Verify your signature
, there are a number of links starting with http://mandrillapp.com/track/click/. The first of these links is to complete the verification process.
Following this link brings me to a page with the following text:
The page you're looking for is currently unavailable to view
We've been upgrading our site. It is possible that this page has been moved or renamed. You can use your browser's Back button to return to the previous page, go to the homepage, or you can browse or search for the information you're looking for.
If you think that you have reached this page due to an error on our part, please let us know.
Also, the top of the plaintext email contains css at the top, which should only be for the HTML version of the email.
I am developing an iOS app in which the user will watch/follow many petitions. I need a way to request multiple petitions in one request for easier implementation and less network overhead on their phones and We the People's servers.
In my app, there is maintained a list of petition id's which the user is watching. I want to be able to specify multiple id's of the petitions I want in one API request. That way, I won't have to worry about exceeding my 10 request/second limit, and the We the People servers will not be bogged down with around 50 requests each time my users want to view their favorite petitions. Instead, one request would be sent.
An example request may look like the following:
https://api.whitehouse.gov/v1/petitions.json?&id=1234&id=5678.
...or even
https://api.whitehouse.gov/v1/petitions.json.&id=1234%205678
This functionality is critical to the performance of my app.
Why not just cache every petition and filter among those cached petitions?
I don't want to cache every single petition on the device and simply filter from among those. Users follow petitions in order to stay up to date with petitions. So, this doesn't make sense to cache petitions on which users want to stay up to date. API requests will nonetheless have to be made whenever the users view their followed petitions. So, under the current design, users will ask the We the People API for 1000-2000 petitions at once rather than ~20-100.
This seems to make sense for both the clients and We the People servers regarding network performance and optimization.
Are you planning on having any localization features and functionality for Spanish and other languages?
If so, will you have an XML for easy translation or will you be using any services to crowdsource this functionality?
I've downloaded drupal 7.24 and petitions 7.x-2.0-beta19. Everything seemed to worked smoothly during installation and a clone of the Whitehouse Petitions website is available.
However, petitions cannot be created since a 404 error is produced when trying to access "/petitions/create" within the iframe.
I've seen that this very same issue has been reported before (#48). However, the issue appears as closed and this pull request is provided as a solution (#49).
Unfortunately, changing the file wh_petitions.form.inc with the version provided in pull request 49 does not solve the problem but, instead, produces a new one. The whole page is loaded into the iframe and the petition is still not created.
Password reset did not work for me with Apple's Safari browser, version 7.0.3. It did use the one time login to get me logged in, but did not present the password reset form. It took me right to petitions. I don't know if this was because I had visited a direct link to a petition prior to needing a password reset or if it's just a bug with some JavaScript somewhere that doesn't work with Safari.
Further, I could not find the password reset or user "screen" from the dashboard or petitions area and I also could not find a link to report a bug as an end user. Had I not thought to click on developers (being a programmer myself), I would not have ever found this github repo.
I don't use Drupal and haven't used this module, and this may be more of a MongoDB issue or feature, but I see a need to be able to export the petition data - name, city, state, date and signature # - to a CSV file or other export format.
Is there already a feature within the Drupal module for this? Is this a possible feature for a future version? Once the module uses MySQL?
Right now, I'd like to be able to download datasets from some of the current petitions for research. Yes, as data sets, the petitions have problems in sampling, anonymity, verification of users, etc. But still, it would be nice to export or download the data of a petition.
I am building a web application that will post petition signatures via the write API.
If I am trying to post a signature via the API at http://api.whitehouse.gov/v1/signatures for a petition that does not actually exist, will I get an error response?
i9ujh78jh0
The JSON representing a petition needs to have a "response" object that decouples presentation from the White House website.
Presently, developers have no choice but to forward their users to the White House website in order to view this response.
"response": {
"id": "681",
"url": "https://petitions.whitehouse.gov/response/message-president-obama-about-your-petition-reducing-gun-violence",
"associationTime": "1355963976"
}
So in this case users would have to browse to https://petitions.whitehouse.gov/response/message-president-obama-about-your-petition-reducing-gun-violence to view the response.
Instead of being redirected to the White House website to view the response, developers should be able to present the response in their applications.
Below is how the "response" object should be formatted to facilitate custom presentation of White House responses to petitions.
"response": {
"id": "681",
"author": "Bruce Reed",
"authorBio": "Bruce Reed is Chief of Staff to Vice President Biden",
"authorThumbnailUrl": "http://urlToAuthorThumbnailPic"
"body": "In the days since the tragedy in Newtown, Americans from all over the country have called for action to deter mass shootings and reduce gun violence. Hundreds of thousands of you have signed petitions on the White House's We the People petitions platform....[shortened to be concise]",
"videoUrl": "http://www.youtube.com/watch?feature=player_embedded&v=u5ynVMBxOus",
"url": "https://petitions.whitehouse.gov/response/message-president-obama-about-your-petition-reducing-gun-violence",
"applicablePetitions": ["681", "682", "683"],
"associationTime": "1355963976"
}
Description of key JSON values:
-author: author of the response
-authorBio: brief description of the author
-body: the body of the response.
-videoUrl: url of the video response, if there is one. If there is no video response, this value could be null.
-url: url of the White House response hosted on WhiteHouse.gov in case developers wish to defer to the White House's presentation.
applicablePetitions: an array of petition id's which reference the petitions for which this response is applicable.
If it is decided that it doesn't make sense to store all of these values as part of the petition response, then developers should be able to make a request for this response resource that provides the key information listed above.
Form some reason the step 5 is not working as expected for me:
I did not find a step on the web installer where its prompts me to add the mongo config lines. I arrived to the normal db selection and mongo is not one of the options. I assume I dont have to seup anything here because mysql and other wont be needed.
Yes, when a profile was asked on the instatter (first one) I did choose petitions.
Please tell me what I am doing wrong.
The only test code provided is some selenium tests that test core drupal functionality. All code unique to your application should have associated tests with the code. Drupal provides a testing framework to do this via the simpletest module.
Steps to repeat:
https://petitions.whitehouse.gov/petition/abolish-tsa-and-use-its-monstrous-budget-fund-more-sophisticated-less-
intrusive-counter-terrorism/c7L94bFB?utm_source=wethepeople&utm_medium=response&utm_campaign=tsa
Petition body:
"It has failed approximately 70% of undercover efficacy tests, and for all its excesses, has been unable to catch even a single terrorist since its creation."
Petition response:
"Over the past 10 years, TSA has strengthened security by creating successful programs and deploying technologies that were not in place prior to September 11, while also taking steps whenever possible to enhance the passenger experience."
hi there - i am noticing missing signatures for example on this petition:
is there a lag on posting the sigs?
On the README, you mention working on it, but I didn't find (or didn't understand) which of the branch is the one where it happens.
And the usual PITA question of the FLOSS world: ETA?
Individual petitions should provide an embeddable map that shows where its signatures come from based on the associated zip code. The embed should be small enough to be embedded on most blog posts (e.g. roughly 500px x 300px).
Additional requirements / options TK.
Several participants at previous White House hackathons have worked on mapping projects based on data from the We the People API. These projects include Catherine D'Ignazio's We the People Map and Mick Thompson Where the People, both of which are available on GitHub.
During install (install profile step) I am getting the error bellow. The list module does exist in modules/field/modules/list and this is a fresh Drupal and Petitions download as of today. OSX, PHP5.4, MySQL5.5, Mongo2.4.7 Any ideas would be appreciated, Thanks!
An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging information follows. Path: http://localhost/install.php?profile=petitions&locale=en&id=1&op=do StatusText: OK ResponseText: Home | Drupal @import url("http://localhost/modules/system/system.theme.css?0"); @import url("http://localhost/modules/system/system.messages.css?0"); @import url("http://localhost/modules/system/system.menus.css?0"); @import url("http://localhost/modules/system/system.base.css?0"); @import url("http://localhost/modules/field/theme/field.css?0"); @import url("http://localhost/modules/node/node.css?0"); @import url("http://localhost/modules/user/user.css?0"); @import url("http://localhost/profiles/petitions/modules/contrib/views/css/views.css?0"); @import url("http://localhost/modules/system/system.admin.css?0"); @import url("http://localhost/modules/system/system.maintenance.css?0"); @import url("http://localhost/profiles/petitions/modules/contrib/ctools/css/ctools.css?0"); @import url("http://localhost/themes/seven/reset.css?0"); @import url("http://localhost/themes/seven/style.css?0"); Home Installation tasksChoose profile(done)Choose language(done)Verify requirements(done)Set up database(done)Install profile(active)Configure site Finished Attempt to create a field of unknown type list_text.
We the People tracks individual signers internally, but only exposes each signature via the API. For the signatures endpoint, provide each signer's unique ID, and then provide a new endpoint for a query about that signer, to display the same data as in the existing signature query, but for every petition that they have signed.
I am building a web application that will post petition signatures via the write API. If I am trying to post a signature via the API at http://api.whitehouse.gov/v1/signatures and the service is down, will I get a response?
It seems that many petitions on serious issues are either ignored or given a weak response that doesn't address the questions raised in the petition.
During the fall of 2013 government shutdown the WeThePeople Petitions API was unavailable.
The service endpoint returned a correctly parsing JSON file with an error message about the shutdown. However the returned JSON was in an undocumented format, so while it was human readable, services using the feed silently failed. (Which is desired behavior).
Can we get added to the documentation the service status message so it can be presented to end users in case of further issues?
Thanks and welcome back guys.
This feature set would be better served as a suite of modules a la Ubercart.
That way the petition system can be used in conjunction with other profile distros out there or added to established sites. The way installation works as it is such that you can't have more than one install profile running at a time, so keeping this suite of modules in a profile context limits use in other scenarios. If you want to be able to default configure the setup just add a one-button "set me up" under an administration page.
A similar canadian project is using travis-ci:
https://github.com/wet-boew/wet-boew-drupal/blob/master/.travis.yml
Might want to steal some ideas from them?
gooooOOOO INTERNATIONAL COOPERATION! LET'S WORK TOGETHER
//cc @wet-boew
I am building a web application that will post petition signatures via the write API.
If I am trying to post a signature via the API at http://api.whitehouse.gov/v1/signatures to a petition that is more then 30 days old and has since been closed, will I get a response? If so, is there a different response if the petition was closed prior to the 30 days?
On petitions.whitehouse.org, whenever I sign a petition I am listed as being from Berkeley, CA. I do not live in Berkeley; in fact, I've moved three different times since my We the People account was created. But there is no way to change your location or other account information after the fact, at least that I've ever been able to find! This seems like a tremendous oversight, given how often people move.
If there is a user-facing way to do this, a second feature request should be opened for making that functionality more prominent, or visible at all.
There should be a way to browse all petitions eligible for response sorted by how long these responses are overdue.
There should also be a way to browse responses that were given (if I understand correctly, the only way to get to a response is if from the page of the petition that requested it), and also enable sorting them by how long they took to answer.
This information can make the petition system's effect on the White House measurable - especially if it's also made available in machine readable form (see #44).
Expected: Footer section should be completely in the foreground, sidebar should disappear underneath
Actual: Parts of the sidebar are in the foreground, and parts of the footer are in the foreground, creating a very sloppy effect!
Not sure if that's the specific issue or not, but my domain with a hyphen in the name (hosted via google apps) is unable to receive any sort of confirmation or password-reset emails from the whitehouse petitions website.
This has the effect of preventing me from registering.
When attempting to re-register, the system confirms that an account exists with my email address (and claims to send verification emails when I request them).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.