Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement statistics API #170

Open
nuest opened this issue Dec 18, 2013 · 2 comments
Open

Implement statistics API #170

nuest opened this issue Dec 18, 2013 · 2 comments

Comments

@nuest
Copy link
Contributor

nuest commented Dec 18, 2013

The API was designed from the client perspective and is documented in an issue for enviroCar-www, see enviroCar/enviroCar-www#109

API sketch transferred from the enviroCar-www issue is below, let's continue discussion here.

  • /api/statistics/
    • already exists
    • change into a list of available statistics resource (like https://envirocar.org/api/stable/) and provide the content under api/statistics/phenomenon/:phenomenonid
  • /rest/statistics/project
  • /api/statistics/project?fields={:id}
    • return just the information for one identifier (value, id, description, unit)
  • /api/statistics/project/:year/:month/:week?fields={:id}
    • the same information as above but only for specific months or days
    • examples
      • /rest/statistics/project/
      • /rest/statistics/project/2013/8/23
      • /rest/statistics/project/2013/8?fields={emission:co2,tracklength}
{
   "source":"www.envirocar.org/api/statistics",
   "statistics":[
      {
         "value":12345.6,
         "id":"tracklength",
         "description":"The accumulated number of the kilometers of all tracks on the enviroCar server.",
         "unit":"km"
      }
   ]
}
@nuest
Copy link
Contributor Author

nuest commented Dec 18, 2013

architecture on the server side:

  • statistics information must be stored somewhere and cannot be calculated on demand for all requests
  • statistics could be
    • updated with every track upload
    • updated with a nightly task
    • updated manually

@nuest
Copy link
Contributor Author

nuest commented Sep 2, 2014

Regional statistics, e.g. for a local community, a country, continent or all data, could be encapsulated as WPS processes and should be cached. This would also allow a "divide and conquer" approach to statistics: Calculating stats for Europe results in calculating the stats for each country, (for each Bundesland). All cached statistics are only updated if a new track was added (comparing the hashes of a list of track ids?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant