Cityscore
Cityscore is a CoB city-performance metric devised by the Mayors office, calculated and managed by the analytics team.
Drupal (via https://www.boston.gov) is used to provide a public endpoint or micro service which can be used by other departments or external organizations to retrieve current cityscore data for use in their own applications.
Load Cityscore Data
POST
https://www.boston.gov/rest/cityscore/load
This secure endpoint is used by analytics to load and update the current cityscore data.
Request Body
payload
string
A JSON formatted array of cityscore metric objects.
api-key
string
Authentication token
// Message received and processed correctly.
{
"status": "success",
"message": "cityscore updated"
}
// No api-key provided in post form.
{
"status": "error",
"message": "error missing token"
}
// No payload provided in post form.
{
"status": "error",
"message": "error no payload"
}
// JSON in payload is not corretly encoded.
{
"status": "error",
"message": "bad json in payload"
}
// Not all metric objects were loaded.
{
"status": "error",
"message": "Not all records saved"
}
Payload Format.
[
{
"metric_name" : "311 CONSTITUENT EXPERIENCE SURVEYS",
"score_calculated_ts" : "2018-11-28T12:10:59Z",
"score_final_table_ts" : "2018-11-28T17:11:01Z",
"previous_day_score" : null,
"previous_week_score" : null,
"previous_month_score" : 5.990000,
"previous_quarter_score" : 1.063380,
"score_day_name" : "Tuesday"
},
{
....
}
]
Get Cityscore Totals
GET
https://www.boston.gov/rest/cityscore/json
This public endpoint returns the latest cityscore indicator value.
{
"day":0.98,
"week":0.97,
"month":1.01,
"quarter":0.96,
"date_posted":"01\/16\/2019"
}
Get Cityscore HTML Table
GET
https://www.boston.gov/rest/cityscore/html
This public endpoint returns an HTML string which contains a cityscore metric table using the CoB style.
<div class="view view-cityscore view-id-cityscore view-display-id-html_cs_table view-dom-id-1ca52cee94c665121a6ce66a2cbf7fe9">
<div class="view-content">
<table class="views-table cols-0">
<tbody>
<tr>
<td>
<tr class="cs__table-row">
<td>311 CONSTITUENT EXPERIENCE SURVEYS</td>
<td class="cs__low cs__table--centered">0.95</td>
<td class="cs__table--centered">-</td>
<td class="cs__table--centered">1.99</td>
<td class="cs__table--centered">1.06</td>
</tr>
</td>
</tr>
</tbody>
</table>
</div>
<div class="view-footer">
<script>
<!--//--><![CDATA[// ><!--
jQuery('table.views-table').append('<thead><tr class="cs__table-header"><th>Topic<th class="cs__table--centered">Day<th class="cs__table--centered">Week<th class="cs__table--centered">Month<th class="cs__table--centered">QTR');
//--><!]]>
</script>
</div>
</div>
</div>
Last updated
Was this helpful?