/
parse-json.Rmd
184 lines (139 loc) · 5.72 KB
/
parse-json.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
---
title: "Documentation of parsed JSON files"
# date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Documentation of parsed JSON files}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
warning = FALSE,
message = FALSE
)
```
```{r}
library(legiscanrr)
library(dplyr)
```
## Bill metadata
Bill meta-data. Returned from `parse_bill()` function.
* `bill_id`: **Internal identifier** for bill used by LegiScan.
* `change_hash`: MD5 hash of bill detail information
* `url`: LegiScan URL for bill detail
* `state_link`: State legislature URL for bill detail
* `status`: Final status of the bill. Numeric id, See [lookup table vignette](../articles/lookup-table.html) for descriptions.
* `status_date`: Date of final status
* `state`: Abbreviation of the State
* `state_id`: **Internal identifier** for state. (note: 1-50 for states, 51-DC, 52-Congress)
* `bill_number`: Bill number as assigned in legislative session. **Not** unique identifier. Only unique within state-session.
* `bill_type`: Type of the bill instrument text. See [lookup table vignette](../articles/lookup-table.html) for descriptions.
* `bill_type_id`: See above above.
* `body`: Originating body/chamber for the bill
* `body_id`: **Internal identifier** for body
* `current_body`: Current body/chamber
* `current_body_id`: **Internal identifier** for body
* `title`: Short title of bill
* `description`: Long title and description of bill
* `pending_committee_id`: **Internal identifier** for committee
* `session_id`: **Internal identifier** for legislative session
* `session_name`: Session name
* `session_title`: Normalized session title
* `year_start`: Starting year of the session
* `year_end`: Ending year of the session
* `special`: Flag for special sessions (0, 1)
```{r}
HB1 <- system.file("extdata", "bill/HB1.json", package = "legiscanrr")
parse_bill(HB1) %>% rmarkdown::paged_table()
```
## Bill full text
Bill text information. Returned from `get_bill_text()`. See `decode_bill_text()` and [vignette](../articles/decode-bill-text.html) for how to retrieve text from the base64 encoded document.
* `doc_id`: **Internal identifier** for bill text document
* `bill_id`: **Internal identifier** for bill
* `date`: Date of text (if available)
* `type`: Type of draft text. See [lookup table vignette](../articles/lookup-table.html) for descriptions.
* `type_id`: **Internal identifier** for bill text type
* `doc`: Base64 encoded document
```{r}
get_bill_text(doc_id = 1877162)
```
## Bill progress
Returned from `parse_bill_progress()` function. Includes important event only. **Not** complete action history.
* `date`: Progress event date
* `event`: **Internal identifier** for progress event type id. See [lookup table vignette](../articles/lookup-table.html) for descriptions.
* `bill_id`: **Internal identifier** for bill
```{r}
parse_bill_progress(HB1) %>% rmarkdown::paged_table()
```
## Bill sponsors
Returned from `parse_bill_sponsor()`.
* `people_id`: **Internal identifier** for legislator
* `party_id`: **Internal identifier** for party
* `party`: Legislator party affiliation
* `name`: Legislator full name
* `sponsor_type_id`: **Internal identifier** for sponsor type. See [lookup table vignette](../articles/lookup-table.html) for descriptions.
* `sponsor_order`: Index of order in sponsorship list
* `committee_sponsor`: Flag for committee sponsor (0, 1)
* `committee_id`: **Internal identifier** for committee
* `bill_id`: **Internal identifier** for bill
```{r}
parse_bill_sponsor(HB1) %>% rmarkdown::paged_table()
```
## Legislator information
Returned from `parse_people()`.
* `people_id`: **Internal identifier** for legislator
* `person_hash`: MD5 hash for legislator personal detail information
* `state_id`: **Internal identifier** for state
* `party_id`: **Internal identifier** for party
* `party`: Legislator party affiliation
* `role_id`: **Internal identifier** for legislator role
* `role`: Legislator role (e.g. representative, senator)
* `name`: Legislator full name
* `first_name`v
* `middle_name`
* `last_name`
* `suffix`
* `nickname`
* `district`: Legislative district
* `ftm_eid`: [FollowTheMoney.org](https://www.followthemoney.org/) EID
* `votesmart_id`: [VoteSmart.org](https://votesmart.org/) ID
* `opensecrets_id`: [OpenSecrets.org](https://www.opensecrets.org) ID (Congress Only)
* `ballotpedia`: [Ballotpedia](https://ballotpedia.org/Main_Page) name
* `committee_sponsor`: Flag for committee sponsor (0, 1)
* `committee_id`: **Internal identifier** for committee
```{r}
person_8630 <- system.file("extdata", "people/8630.json", package = "legiscanrr")
parse_people(person_8630) %>% rmarkdown::paged_table()
```
## Legislator vote records
Returned from `parse_person_vote()`.
* `people_id`: **Internal identifier** for legislator
* `vote_id`: Numeric id for vote
* `vote_text`: Description of vote (Yea/Nay/Abstain/Absent)
* `roll_call_id`: **Internal identifier** for roll call vote
```{r}
vote_154366 <- system.file("extdata", "vote/154366.json", package = "legiscanrr")
parse_person_vote(vote_154366) %>% rmarkdown::paged_table()
```
## Roll call votes
Returned from `parse_rollcall_vote()`.
* `roll_call_id`: **Internal identifier** for roll call vote
* `bill_id`: **Internal identifier** for bill
* `date`: Vote date
* `desc`: Description of vote
* `yea`: Count of Yea votes
* `nay`: Count of Nay votes
* `nv`: Count of not voting/abstain
* `absent`: Count of absents
* `total`: Total number of votes
* `passed`: Vote passage (0, 1)
* `chamber`: Chamber of vote
* `chamber_id`: **Internal identifier** for chamber
```{r}
parse_rollcall_vote(vote_154366) %>% rmarkdown::paged_table()
```
## Keys for join
![](img/dataset_ERD.png)