Skip to content

Commit eb50963

Browse files
committed
Docs, version bump
1 parent 2ddc5be commit eb50963

File tree

3 files changed

+66
-8
lines changed

3 files changed

+66
-8
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# go-congress CHANGELOG
22

3-
## Unreleased
3+
## 0.1.0
44

55
- Storing connection information to the ProPublica API
6-
- Fetching a list of all members of a chamber in a particular session of Congress, or all current members from a state
6+
- Fetching a list of all members of a chamber in a particular session of Congress, or all current members from a state/district
7+
- Fetching a list of incoming or outgoing members
78
- Fetching detailed information about one member

README.md

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,58 @@
11
# ProPublica Congress API Go SDK
22

3-
A Golang API client for interacting with the [ProPublica Congress API](https://www.propublica.org/datastore/api/propublica-congress-api), which provides access to some of the most extensive data available about the United States Congress, both its current sessions and going decades into the past. **This library is in no was affiliated with ProPublica or Congress.**
3+
A Golang API client for interacting with the [ProPublica Congress API](https://www.propublica.org/datastore/api/propublica-congress-api), which provides access to some of the most extensive data available about the United States Congress, both its current sessions and going decades into the past. **This library is in no was affiliated with ProPublica or Congress.**
4+
5+
## Getting started
6+
7+
Add `import "github.com/rabdill/go-congress/congress"` to the top of your script or application file, with the rest of your imports. From there, all you need to start making calls is a client:
8+
9+
```go
10+
c := congress.Client{
11+
Endpoint: "https://api.propublica.org/congress/v1",
12+
Key: "KEYgoesHERE123",
13+
}
14+
```
15+
16+
(You can request a free API key from ProPublica [on their website](https://www.propublica.org/datastore/api/propublica-congress-api), which also has the [API documentation](https://projects.propublica.org/api-docs/congress-api/).)
17+
18+
Authenticating to the Congress API is simple and happens without intervention; you can jump right into making calls now:
19+
20+
```go
21+
members, _ := c.GetDepartingMembers(115, "senate")
22+
```
23+
24+
If you just want to test things out (and make sure your key is working), you can create a file called `main.go` in the root of this repository and paste this code in:
25+
26+
```go
27+
package main
28+
29+
import (
30+
"fmt"
31+
32+
"github.com/rabdill/go-congress/congress"
33+
)
34+
35+
func main() {
36+
c := congress.Client{
37+
Endpoint: "https://api.propublica.org/congress/v1",
38+
Key: "KEYgoesHERE123",
39+
}
40+
// answer, err := c.GetMembers(115, "senate")
41+
// answer, err := c.GetMember("K000388")
42+
43+
// answer, err := c.GetChamberMembersByState("nj", "house")
44+
// answer, err := c.GetChamberMembersByDistrict("nj", 1, "senate")
45+
// answer, err := c.GetMembersByState("nj")
46+
47+
// answer, err := c.GetNewMembers()
48+
answer, err := c.GetDepartingMembers(115, "senate")
49+
if err != nil {
50+
fmt.Printf("\nOh no!\n|%s|\n", err)
51+
}
52+
53+
fmt.Printf("\nRESULT COUNT: |%v|", len(answer))
54+
fmt.Printf("\n\n\n!!!RESULTS!!!\n\n%+v\n", answer)
55+
}
56+
```
57+
58+
From there, all you'll need to do is run `go run main.go` and it should print out a list of members departing the current Senate. Uncommenting any of the other calls will give you different sets of results.

congress/member.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ type TrackingIDs struct {
3535
// politician's ID in their databases.
3636
ICPSR string `json:"icpsr_id,omitempty"`
3737

38-
// CRP is the politician's ID from theCenter for Responsive Politics,
38+
// CRP is the politician's ID from the Center for Responsive Politics,
3939
// which runs OpenSecrets.org.
4040
CRP string `json:"crp_id,omitempty"`
4141

@@ -56,7 +56,7 @@ type MemberSummary struct {
5656
Title string `json:"title"`
5757
ShortTitle string `json:"short_title"`
5858
InOffice bool `json:"in_office"`
59-
SenateClass string `json:"senate_class,omitempty"` // TODO: Is this a different field for House members?
59+
SenateClass string `json:"senate_class,omitempty"`
6060
StateRank string `json:"state_rank,omitempty"`
6161
Party string `json:"party"`
6262
Leadership string `json:"leadership_role,omitempty"`
@@ -87,9 +87,11 @@ type MemberSummary struct {
8787
// DW-NOMINATE (Dynamic Weighted NOMINAl Three-step Estimation) estimation.
8888
DWNominate float32 `json:"dw_nominate"`
8989

90-
// *tk no idea what these are
90+
// IdealPoint indicates a politician's position on the left/right spectrum
9191
IdealPoint string `json:"ideal_point"`
92-
OCD string `json:"ocd_id,omitempty"`
92+
93+
// OCD is the ID of the politician's district within the Open Civic Data project.
94+
OCD string `json:"ocd_id,omitempty"`
9395
}
9496

9597
// MemberDetails holds the data of a member of Congress when it is requested
@@ -126,7 +128,7 @@ type MemberSearch struct {
126128

127129
// MemberInTransition is the format of data sent from ProPublica
128130
// about a single member when searching for members who are either
129-
// new or leaving office. It doesn't really look like the others.
131+
// new or leaving office. It doesn't really match the others.
130132
type MemberInTransition struct {
131133
ID string `json:"id"`
132134
FirstName string `json:"first_name"`

0 commit comments

Comments
 (0)