This commit is contained in:
Eric Mill
2013-08-30 10:15:03 -04:00
parent ad746608a6
commit e034e47b24
2 changed files with 133 additions and 32 deletions

137
LICENSE
View File

@@ -1,24 +1,121 @@
This is free and unencumbered software released into the public domain. Creative Commons Legal Code
Anyone is free to copy, modify, publish, use, compile, sell, or CC0 1.0 Universal
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
of this software dedicate any and all copyright interest in the LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
software to the public domain. We make this dedication for the benefit ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
of the public at large and to the detriment of our heirs and INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
successors. We intend this dedication to be an overt act of REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
relinquishment in perpetuity of all present and future rights to this PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
software under copyright law. THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, Statement of Purpose
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/> The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.
For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.

View File

@@ -38,7 +38,7 @@ Collecting the data
The general form to start the scraping process is: The general form to start the scraping process is:
./run <data-type> [--force] [--fast] [other options] ./run <data-type> [--force] [--fast] [other options]
where data-type is one of: where data-type is one of:
* bills * bills
@@ -90,11 +90,11 @@ Scraping votes
Similar commands are available for roll call votes. Start with: Similar commands are available for roll call votes. Start with:
./run votes ./run votes
You can supply a few kinds of flags, such as limit and congress as above. Votes are grouped by the Senate and House into two sessions per Congress, which (in modern times) roughly follow the calendar years. Senate votes are numbered uniquely by session. House vote numbering continues consecutively throughout the Congress. To get votes from 2012, run: You can supply a few kinds of flags, such as limit and congress as above. Votes are grouped by the Senate and House into two sessions per Congress, which (in modern times) roughly follow the calendar years. Senate votes are numbered uniquely by session. House vote numbering continues consecutively throughout the Congress. To get votes from 2012, run:
./run votes --congress=112 --session=2012 ./run votes --congress=112 --session=2012
To get only a specific vote, pass in the ID for the vote. For the Senate vote 50 in the 2nd session of the 112th Congress: To get only a specific vote, pass in the ID for the vote. For the Senate vote 50 in the 2nd session of the 112th Congress:
./run votes --vote_id=s50-112.2012 ./run votes --vote_id=s50-112.2012
@@ -102,12 +102,12 @@ To get only a specific vote, pass in the ID for the vote. For the Senate vote 50
Scraping GPO FDSys and Bill Text Scraping GPO FDSys and Bill Text
-------------------------------- --------------------------------
The scraper for GPO FDSys provides infrastructure for other tasks, such as fetching bill text. FDSys is organized by collection (bills, committee reports, etc.) and year. The scraper for GPO FDSys provides infrastructure for other tasks, such as fetching bill text. FDSys is organized by collection (bills, committee reports, etc.) and year.
To download all bill text, run: To download all bill text, run:
./run fdsys --collections=BILLS --congress=112 --store=pdf,mods,xml,text ./run fdsys --collections=BILLS --congress=112 --store=pdf,mods,xml,text
Bill text is stored in a text-versions directory within each bill directory, e.g.: Bill text is stored in a text-versions directory within each bill directory, e.g.:
data/112/bills/hr/hr68/text-versions/ih/document.pdf data/112/bills/hr/hr68/text-versions/ih/document.pdf
@@ -116,7 +116,7 @@ Bill text is stored in a text-versions directory within each bill directory, e.g
data/112/bills/hr/hr68/text-versions/ih/document.html (original HTML wrapper around plain text) data/112/bills/hr/hr68/text-versions/ih/document.html (original HTML wrapper around plain text)
data/112/bills/hr/hr68/text-versions/ih/document.txt (UTF-8 encoded) data/112/bills/hr/hr68/text-versions/ih/document.txt (UTF-8 encoded)
data/112/bills/hr/hr68/text-versions/ih/data.json (common metadata extracted from mods.xml) data/112/bills/hr/hr68/text-versions/ih/data.json (common metadata extracted from mods.xml)
The subdirectory name indicates the bill text version code assigned by GPO (ih, enr, etc.). The mods.xml file has metadata from GPO, some of which is also extracted into data.json. Use the JSON file to determine which is the most recent text version if you want to find the most recent text of a bill. The subdirectory name indicates the bill text version code assigned by GPO (ih, enr, etc.). The mods.xml file has metadata from GPO, some of which is also extracted into data.json. Use the JSON file to determine which is the most recent text version if you want to find the most recent text of a bill.
Running the command again will smartly update changed files by scanning through FDSys's sitemaps. Running the command again will smartly update changed files by scanning through FDSys's sitemaps.
@@ -128,7 +128,7 @@ A separate task called bill_versions will download just the mods.xml files (if t
data/112/bills/hjres/hjres6/text-versions/ih/data.json data/112/bills/hjres/hjres6/text-versions/ih/data.json
Use bill_versions if you only need the MODS and JSON files, or to update the JSON files in bulk if our data format changes. Use bill_versions if you only need the MODS and JSON files, or to update the JSON files in bulk if our data format changes.
Back on the fdsys scraper, the stored files for other collections (besides bills) are organized in a more generic way: in data/fdsys/COLLECTION/YEAR/PKGID. The PKGID is the package identifier for the file on FDSys. For instance: Back on the fdsys scraper, the stored files for other collections (besides bills) are organized in a more generic way: in data/fdsys/COLLECTION/YEAR/PKGID. The PKGID is the package identifier for the file on FDSys. For instance:
./run fdsys --collections=STATUTE --year=1982 --store=mods ./run fdsys --collections=STATUTE --year=1982 --store=mods
@@ -137,7 +137,7 @@ Back on the fdsys scraper, the stored files for other collections (besides bills
The collections argument can take a comma-separated list of collections. To get a list of collection names, use: The collections argument can take a comma-separated list of collections. To get a list of collection names, use:
./run fdsys --list-collections ./run fdsys --list-collections
All arguments are optional. Without --store, the script just updates a local copy of the sitemap files in cache/fdsys/sitemap/YEAR/COLLECTION.xml. Use --cached to force the use of cached files and not hit the network except when a file does not exist. Use --force to download all files anew. All arguments are optional. Without --store, the script just updates a local copy of the sitemap files in cache/fdsys/sitemap/YEAR/COLLECTION.xml. Use --cached to force the use of cached files and not hit the network except when a file does not exist. Use --force to download all files anew.
Committee Meetings Committee Meetings
@@ -146,13 +146,13 @@ Committee Meetings
The committee_meetings scraper pulls upcoming House and Senate committee meetings from http://docs.house.gov/Committee and http://www.senate.gov/general/committee_schedules/hearings.xml, respectively. To run the scraper: The committee_meetings scraper pulls upcoming House and Senate committee meetings from http://docs.house.gov/Committee and http://www.senate.gov/general/committee_schedules/hearings.xml, respectively. To run the scraper:
./run committee_meetings --force --debug ./run committee_meetings --force --debug
This outputs two JSON files: data/committee_meetings_house.json and data/committee_meetings_senate.json. This outputs two JSON files: data/committee_meetings_house.json and data/committee_meetings_senate.json.
Each meeting is assigned a GUID. If you re-run the scraper (without deleting the output JSON files), the GUIDs will be preserved from run to run so that you can tell when meetings are added or revised. For Senate committee meetings, we preserve the GUID by a heuristic. The House provides stable IDs. Each meeting is assigned a GUID. If you re-run the scraper (without deleting the output JSON files), the GUIDs will be preserved from run to run so that you can tell when meetings are added or revised. For Senate committee meetings, we preserve the GUID by a heuristic. The House provides stable IDs.
The House-side scraper is very slow. Each meeting is requested from a separate file whose response time seems to be pretty slow. The House-side scraper is very slow. Each meeting is requested from a separate file whose response time seems to be pretty slow.
Options Options
------- -------
@@ -169,7 +169,7 @@ Since the --force flag forces a download and parse of every object, the --fast f
For bills and amendments, the --fast flag will only download bills that appear to have new activity based on whether the bill's search result listing on pages like http://thomas.loc.gov/cgi-bin/bdquery/d?d113:0:./list/bss/d113HR.lst: have changed. This doesn't detect all changes to a bill, but it results in a much faster scrape by not having to fetch the pages for every bill. You should still do a complete re-download (without `--fast`) every so often to ensure data is fully current. For bills and amendments, the --fast flag will only download bills that appear to have new activity based on whether the bill's search result listing on pages like http://thomas.loc.gov/cgi-bin/bdquery/d?d113:0:./list/bss/d113HR.lst: have changed. This doesn't detect all changes to a bill, but it results in a much faster scrape by not having to fetch the pages for every bill. You should still do a complete re-download (without `--fast`) every so often to ensure data is fully current.
For votes, the --fast flag will have the scraper download only votes taken in the last three days, which is the time during which most vote changes and corrections are posted. For votes, the --fast flag will have the scraper download only votes taken in the last three days, which is the time during which most vote changes and corrections are posted.
Debugging messages are hidden by default. To include them, run with --log=info or --debug. To hide even warnings, run with --log=error. Debugging messages are hidden by default. To include them, run with --log=info or --debug. To hide even warnings, run with --log=error.
To get emailed with errors, copy config.yml.example to config.yml and fill in the SMTP options. The script will automatically use the details when a parsing or execution error occurs. To get emailed with errors, copy config.yml.example to config.yml and fill in the SMTP options. The script will automatically use the details when a parsing or execution error occurs.
@@ -223,6 +223,10 @@ Who's Using This Data
Here are the ones we know about: Here are the ones we know about:
* [GovTrack.us](http://govtrack.us) * [GovTrack.us](http://govtrack.us)
* [Sunlight Congress API](http://sunlightlabs.github.com/congress/) * [Sunlight Congress API](http://sunlightlabs.github.com/congress/)
* [Scout](https://scout.sunlightfoundation.com/) * [Scout](https://scout.sunlightfoundation.com/)
### License
All data and code in this project is [licensed under CC0](LICENSE) ([summary](http://creativecommons.org/publicdomain/zero/1.0/)).