Skip to main content

Aggregation Example: Counts by status

This example counts segments with texts in gray, green and red status.

All project languages

We submit the following query on all segments in project with ID 3528. Note that you need to have manager level credentials for this to work.

CODE
POST /resources/statistics/aggregations
BODY (application/json):
{
	"scope": { "type": "Project", "projectid": 3528 },
	"aggregations": [ { "id": "textStatus" } ]
}

The textStatus aggregation returns counts of each status per each project language. In our project the source language is English and the single target language is French.

Note that in English there are 2237 source texts, all in default status. Of these only 174 are translated into French. 2 are flagged in red status and all others are in green status.

CODE
{
    "aggregations": {
        "textStatus": {
            "en": {
                "buckets": [
                    {
                        "key": 0,
                        "count": 2237,
                        "title": "No status"
                    },
                    {
                        "key": 1,
                        "count": 0,
                        "title": "Green"
                    },
                    {
                        "key": 2,
                        "count": 0,
                        "title": "Red"
                    }
                ],
                "total": 2237,
                "scanned": 2237,
                "scannedErrors": 0
            },
            "fr": {
                "buckets": [
                    {
                        "key": 0,
                        "count": 2234,
                        "title": "No status"
                    },
                    {
                        "key": 1,
                        "count": 172,
                        "title": "Green"
                    },
                    {
                        "key": 2,
                        "count": 2,
                        "title": "Red"
                    }
                ],
                "total": 2237,
                "scanned": 174,
                "scannedErrors": 0
            }
        }
    }
}

Note that in the target locale “es”, the value for scanned is much smaller then total. This means that the majority of Spanish translations were not yet populated at all, neither from pretranslation, human editing a QA or any other operation.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.