osmlab / to-fix-backend

The to-fix server
BSD 3-Clause "New" or "Revised" License
15 stars 13 forks source link

Modification in to-fix API: group stats by tag #253

Closed tridip1931 closed 6 years ago

tridip1931 commented 6 years ago

👋

We have a requirement of grouping tags by status

The current API list status and tags count separately. It is very difficult to group status by tags in SQL

{
    "total": 1111,
    "status": {
        "status1": 6,
        "status2": 4,
        "status3": 5,
        "status4": 2,
        "status5": 1
    },
    "tags": {
        "tag1": 148,
        "tag2": 6,
        "tag3": 22,

    }

As per discussion with @batpad , it would be much simpler if we modify object to something like this instead of doing the work in mode

    {
        "tags": {
            "tag1": {
                "status1": 33,
                "status2": 55,
                "status3": 77,
            },
            "tag2": {
                "status1": 11,
                "status2": 22,
                "status3": 33,
            }
        }
    }
batpad commented 6 years ago

+cc @maning

batpad commented 6 years ago

@tridip1931 - do you think we can just change the current stats end-point to output things grouped by tag, or do you think we need to keep the current end-point and add an option / a new end-point for the new format proposed here?

tridip1931 commented 6 years ago

@batpad In terms of making it future proof and incoming future requirements, will it make sense to keep both end-points?