LocalData/localdata-api — pull request #61 by hampelm (2013-06-11 20:13:32+00:00)
Title: Naive API endoint for creating stats for a given survey

Use case: we want to provide basic overview information for any given survey. Many surveys are too large to efficiently do this in the browser.

This adds an endpoint at `api/surveys/:id/stats` that returns counts for each answer, like so:

{
survey: {
dumping: {
yes: 8,
no: 9
},
fire-damage: {
yes: 6
},
condition: {
good: 2,
poor: 3,
fair: 1,
excellent: 3
},
...
}
}

Known deficiencies:
- No caching. The data is recalculated on each request even if it hasn't changed
- Doesn't include stats on response times, users
- Data format may not be the best, depending on how we decide to consume the data (goal: no data transformation necessary on the client)