codeforamerica / srtracker

Open311 Service Request Status Site
BSD 3-Clause "New" or "Revised" License
20 stars 23 forks source link

Show `attributes` on SR details page? #82

Open Mr0grog opened 9 years ago

Mr0grog commented 9 years ago

While fixing #80, I just noticed that Chicago’s Open311 server is now returning an SR’s attributes (the additional detail questions you have to answer when submitting an SR) when using the extensions=true flag.

For example, “building violations” in Chicago might come with any of these attributes:

It would be pretty nice to show these.


Example case: http://311api.cityofchicago.org/open311/v2/requests/14-02000061.json?extensions=true

[{
  "service_request_id": "14-02211982",
  "status": "open",
  "service_code": "4fd3bd72e750846c530000cd",
  ...
  "attributes": {
    "WHATISTH": "THE CALLER STATES THAT THE GARAGE ROOF HAS COLLASPED. AND HAS BEEN LIKE THIS FOR SEVERAL YEARS. AND THE OWNER'S IS NOT REPARING NOR TEARING DOWN THE GARAGE. HAZARDOUS AND UNSAFE..",
    "OWNEROC1": "YES"
  },
  ...
}]

You can look up the attribute names via [api base url]/services/[service code].json, e.g. http://311api.cityofchicago.org/open311/v2/services/4fd3bd72e750846c530000cd.json

{
  "service_code": "4fd3bd72e750846c530000cd",
  "attributes": [
    {
      "variable": true,
      "code": "WHATISTH",
      "datatype": "text",
      "required": false,
      "order": 1,
      "description": "What is the actual problem being encountered?"
    },
    ...
  ]
}
Mr0grog commented 9 years ago

Note: we should get in touch with someone over at Chicago DoIT to make sure there aren’t any privacy concerns here like there were in general description field.

Mr0grog commented 9 years ago

Actually, ha, there almost certainly is, as in the example above—“give mobile # for updates.” :(