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

Featuring group stats #112

Open
KhaledBousrih opened this issue Oct 13, 2021 · 0 comments
Open

Featuring group stats #112

KhaledBousrih opened this issue Oct 13, 2021 · 0 comments
Assignees

Comments

@KhaledBousrih
Copy link
Collaborator

The stats endpoint provides global informations about the requested model

{
  "objects_count": 125,
  "num_total_pages": 2,
  "max_allowed_objects_per_page": 100,
  "timestamp_start": 0.0,
  "timestamp_end": 701184650.0,
  "page_urls": {
    "page1": "https://<webapp>/api/v1.1/my-model/",
    "page2": "https://<webapp>/api/v1.1/my-model/?page=2"
  }
}

It would be usefull to group the objects count by a field name, to have a counter of the each value.

For example, we could get the count of teh objects by status:

{
  "objects_count": 125,
  "num_total_pages": 2,
  "max_allowed_objects_per_page": 100,
  "timestamp_start": 0.0,
  "timestamp_end": 701184650.0,
  "page_urls": {
    "page1": "https://<webapp>/api/v1.1/my-model/",
    "page2": "https://<webapp>/api/v1.1/my-model/?page=2"
  },
  "results":{
    "status":{
      "COMPLETED": 113,
      "FAILED": 12
    }
  }
}

We could also specify more than one field name, and get the counter of the values of these fields (separated or combined, depending on the user's needs):

Separated:

{
  "objects_count": 125,
  "num_total_pages": 2,
  "max_allowed_objects_per_page": 100,
  "timestamp_start": 0.0,
  "timestamp_end": 701184650.0,
  "page_urls": {
    "page1": "https://<webapp>/api/v1.1/my-model/",
    "page2": "https://<webapp>/api/v1.1/my-model/?page=2"
  },
  "results":{
    "status":{
      "COMPLETED": 113,
      "FAILED": 12
    },
    "archived":{
      "true": 53,
      "false": 72
    }
  }
}

combined:

{
  "objects_count": 125,
  "num_total_pages": 2,
  "max_allowed_objects_per_page": 100,
  "timestamp_start": 0.0,
  "timestamp_end": 701184650.0,
  "page_urls": {
    "page1": "https://<webapp>/api/v1.1/my-model/",
    "page2": "https://<webapp>/api/v1.1/my-model/?page=2"
  },
  "results":{
    "status,archived":{
      "COMPLETED,true": 45,
      "COMPLETED,false": 68,
      "FAILED,true": 8,
      "FAILED,false": 4
    }
  }
}
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