Skip to content

Commit 7e36b5f

Browse files
committed
flesh out methods
1 parent 9342c93 commit 7e36b5f

File tree

1 file changed

+149
-48
lines changed

1 file changed

+149
-48
lines changed

proposals/drafts/reconciliation.rst

Lines changed: 149 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,10 @@ API
7777
:query birth_date: (optional) the birth date of the politician
7878
:status 200 OK: no error, returns a list of possible ids with match scores
7979
:status 404 Not Found: could not find any possible matches
80-
:status 402 Payment required: If the balance between data added (puts and posts on `/identifier`) and searches is out of wack. This reduce
8180
:status 429 Too Many Requests: Rate limiting
8281

8382
:reqheader Authorization: optional OAuth token to authenticate
84-
:resheader Balance: Balance between data added and data searched
83+
:resheader Balance: Balance between data added (search requests) and data searched (identifier post)
8584

8685

8786
**Example request**:
@@ -98,14 +97,14 @@ API
9897

9998
HTTP/1.1 200 OK
10099
Vary: Accept
101-
Content-Type: text/javascript
102-
103-
[{"politician": {"jurisdiction_id": "ocd-jurisdiction/country:us/state:il/place:chicago/government",
104-
"name": "Ed Burke",
105-
"ocd_id": "ocd-person/912c8ddf-8d04-4f7f-847d-2daf84e096e2"
106-
"birth_date": null,
107-
"posts": {"role": "Alderman", "label": "Ward 3"}
108-
},
100+
Content-Type: text/json
101+
102+
[{"best reference": {"jurisdiction_id": "ocd-jurisdiction/country:us/state:il/place:chicago/government",
103+
"name": "Ed Burke",
104+
"birth_date": null,
105+
"post": {"role": "Alderman", "label": "Ward 3"}
106+
},
107+
"ocd_id": "ocd-person/912c8ddf-8d04-4f7f-847d-2daf84e096e2",
109108
"match_score": 0.74}
110109
]
111110

@@ -118,45 +117,158 @@ API
118117
:status 200 OK: no error
119118
:status 404 Not Found: no politician with that identifier found
120119
:status 301 Moved Permanently: if an ocd_identifier has been merged into another identifier, redirect to :http:get:`/identifier/(str:new_ocd_identifier)`
121-
:status 300 Multiple Choices: this id has split, return options
120+
:status 300 Multiple Choices: this id has split, return options
121+
122+
**Example request**:
123+
124+
.. sourcecode:: http
125+
126+
GET /identifier/ocd-person/912c8ddf-8d04-4f7f-847d-2daf84e096e2 HTTP/1.1
127+
Host: example.com
128+
Accept: application/json, text/javascript
129+
130+
**Example response**:
131+
132+
HTTP/1.1 200 OK
133+
Vary: Accept
134+
Content-Type: text/json
135+
136+
{"references": [{"jurisdiction_id": "ocd-jurisdiction/country:us/state:il/place:chicago/government",
137+
"name": "Ed Burke",
138+
"birth_date": null,
139+
"post": {"role": "Alderman", "label": "Ward 3"}
140+
}],
141+
"ocd_id": "ocd-person/912c8ddf-8d04-4f7f-847d-2daf84e096e2"}
142+
122143

123144
.. http:post:: /identifier
124145
125146
Mint new ocd identifier
126147

127148
:form name: a name of the politician
128149
:form jurisdiction_id: an OCD id for the jurisdiction of the organization that the politician is seeking election into or is a member of
129-
:form office: (optional) a name of the office
150+
:form post: (optional) a name of the office
130151
:form birth_date: (optional) the birth date of the politician
131152
:form active_date: (optional) a date, date range, year, year range when the politician was seeking or held this office
132153
:reqheader Authorization: OAuth token to authenticate
133154
:status 201 Created: returns ocd_identifier
155+
:status 412 Precondition Failed: required information is missing or malformed
156+
:status 401 Unauthorized: missing or invalid authorization token
157+
158+
**Example Request**:
159+
160+
.. sourcecode:: http
161+
162+
POST /identifier HTTP/1.1
163+
Host: example.com
164+
Accept: application/json, text/javascript
165+
Content-Type: application/json
166+
Authorization: "Authorization: credentials"
167+
168+
{"name": "Danny Solis",
169+
"jurisdiction_id": "ocd-jurisdiction/country:us/state:il/place:chicago/government",
170+
"post": {"role": "Alderman", "label": "Ward 14"}}
171+
172+
**Example Response**:
173+
174+
HTTP/1.1 201 OK
175+
Vary: Accept
176+
Content-Type: text/json
177+
178+
{"ocd_id": "ocd-person/v12caddf-gdag-2faf-147d-bfas84e096e2"}
134179

135180
.. http:put:: /identifier/(str:ocd_identifier)
136181
137182
Add data about politician
138183

139184
:param ocd_identifier: politician's OCD identifier
140185
:type ocd_identifier: str
141-
:form name: a name of the politician
186+
:form name: (optional) a name of the politician
142187
:form jurisdiction_id: an OCD id for the jurisdiction of the organization that the politician is seeking election into or is a member of
143188
:form office: (optional) a name of the office
144189
:form birth_date: (optional) the birth date of the politician
145190
:form active_date: (optional) a date, date range, year, year range when the politician was seeking or held this office
146191
:reqheader Authorization: OAuth token to authenticate
147-
:status 201 Created: return record id
192+
:status 200 Created: return record
193+
194+
**Example Request**:
195+
196+
.. sourcecode:: http
197+
198+
PUT /identifier/ocd-person/912c8ddf-8d04-4f7f-847d-2daf84e096e2 HTTP/1.1
199+
Host: example.com
200+
Accept: application/json, text/javascript
201+
Content-Type: application/json
202+
Authorization: "Authorization: credentials"
203+
204+
{"name": "Edward Burke",
205+
"ocd-jurisdiction/country:us/state:il/place:chicago/government"}
206+
207+
**Example Response**:
208+
209+
HTTP/1.1 201 OK
210+
Vary: Accept
211+
Content-Type: text/json
212+
213+
{"references": {109234: {"jurisdiction_id": "ocd-jurisdiction/country:us/state:il/place:chicago/government",
214+
"name": "Ed Burke",
215+
"birth_date": null,
216+
"post": {"role": "Alderman", "label": "Ward 3"}
217+
},
218+
109236: {"jurisdiction_id": "ocd-jurisdiction/country:us/state:il/place:chicago/government",
219+
"name": "Edward Burke",
220+
"birth_date": null,
221+
"post": null
222+
}},
223+
"ocd_id": "ocd-person/912c8ddf-8d04-4f7f-847d-2daf84e096e2"}
148224

149225
.. http::delete:: /identifier/(str:ocd_identifier)
150226
151227
Delete the record from politician id
152228

229+
:reqheader Authorization: OAuth token to authenticate
230+
:status 204 No Content: delete identifier
231+
153232
.. http:post:: /merge
154233
155234
Merges identifiers
156235

157236
:form ids: array of ids to merge
158237
:reqheader Authorization: OAuth token to authenticate
159238
:status 201 Created: returns surviving ocd_identifier
239+
240+
**Example Request**:
241+
242+
.. sourcecode:: http
243+
244+
POST /merge HTTP/1.1
245+
Host: example.com
246+
Accept: application/json, text/javascript
247+
Content-Type: application/json
248+
Authorization: "Authorization: credentials"
249+
250+
["ocd-person/912c8ddf-8d04-4f7f-847d-2daf84e096e2", "ocd-person/v12caddf-gdag-2faf-147d-bfas84e096e2"]
251+
252+
**Example Response**:
253+
254+
HTTP/1.1 201 OK
255+
Vary: Accept
256+
Content-Type: text/json
257+
258+
{"references": {109234: {"jurisdiction_id": "ocd-jurisdiction/country:us/state:il/place:chicago/government",
259+
"name": "Ed Burke",
260+
"birth_date": null,
261+
"post": {"role": "Alderman", "label": "Ward 3"}
262+
},
263+
109236: {"jurisdiction_id": "ocd-jurisdiction/country:us/state:il/place:chicago/government",
264+
"name": "Edward Burke",
265+
"birth_date": null,
266+
"post": null
267+
},
268+
109235: {"name": "Danny Solis",
269+
"jurisdiction_id": "ocd-jurisdiction/country:us/state:il/place:chicago/government",
270+
"post": {"role": "Alderman", "label": "Ward 14"}},
271+
"ocd_id": "ocd-person/912c8ddf-8d04-4f7f-847d-2daf84e096e2"}
160272

161273
.. http:post:: /split/(str:ocd_identifier)
162274
@@ -167,30 +279,35 @@ API
167279
:type ocd_identifier: str
168280
:form ids: array of reference ids to remove and turn into new id
169281
:reqheader Authorization: OAuth token to authenticate
170-
:status 201 Created: returns new ocd_identifiers for both sides of the split
282+
:status 201 Created: returns new ocd_identifiers for the split
171283

172-
173-
174-
Governance
175-
__________
176-
177-
mint, merge, and split are powerful claims that can will affect other users.
284+
.. sourcecode:: http
285+
286+
POST /split/ocd-person/912c8ddf-8d04-4f7f-847d-2daf84e096e2 HTTP/1.1
287+
Host: example.com
288+
Accept: application/json, text/javascript
289+
Content-Type: application/json
290+
Authorization: "Authorization: credentials"
178291

179-
proposed permission model
292+
[109235]
180293

181-
unprivileged
294+
**Example Response**:
295+
296+
HTTP/1.1 201 OK
297+
Vary: Accept
298+
Content-Type: text/json
182299

183-
- match methods
184-
- id methods
300+
{"ocd_id": "ocd-person/912c8ddf-8d04-4f7f-847d-2daf84e096e2"}
301+
185302

186-
publisher
303+
Governance
304+
__________
187305

188-
- mint method
189-
- merge method
190-
- split method
306+
`mint`, `merge`, and `split` are powerful claims that should be reserved
307+
to trusted publishers.
191308

192-
publishers will get notifications if the entities they uploaded are
193-
changed by another publisher, and can take action.
309+
Publishers will get notifications if the entities they uploaded are
310+
changed by another publisher.
194311

195312

196313
Bulk access
@@ -199,31 +316,15 @@ Bulk access
199316
The underlying data for the service will be available as a daily backup
200317

201318

202-
203319
Copyright of OCD identifiers
204320
----------------------------
205321

206322
They will be dedicated to the public domain
207323

208-
Publisshers will need to agree that they will not upload data that is
324+
Publishers will need to agree that they will not upload data that is
209325
under copyright, and agree to dedicate all data to the public domain.
210326

211327

212-
213-
214-
215-
216-
217-
218-
219-
- http://journals.plos.org/plosbiology/article?id=10.1371/journal.pbio.2001414
220-
- https://web.archive.org/web/20161108220043/https://www.newschallenge.org/challenge/elections/entries/politician-reconciliation-service
221-
- https://web.archive.org/web/20130609195642/https://www.newschallenge.org/open/open-government/submission/civic-data-standardization-bootstrapper/
222-
- https://github.com/newsdev/nyt-entity-service
223-
- https://github.com/pudo/nomenklatura
224-
- google refine reconcilliation and freebase
225-
226-
227328
Copyright
228329
=========
229330
This document has been placed in the public domain per the Creative Commons CC0 1.0 Universal license (http://creativecommons.org/publicdomain/zero/1.0/deed).

0 commit comments

Comments
 (0)