API do Phrase TMS

Agregações de análise (TMS)

O conteúdo de toda a Central de Ajuda é traduzido automaticamente de inglês pelo Phrase Language AI.

O armazenamento de dados que executa consultas de agregação é criado sobre o Elasticsearch (atualmente versão 1.7.x). O Elasticsearch fornece recursos de pesquisa e agregação em tempo real com a API do Google Analytics formando uma camada fina e com segurança aprimorada sobre ela. A linguagem de consulta e agregação do Elasticsearch é usada nos exemplos.

Índices

Diferentes tipos de dados vivem em diferentes índices. Por exemplo, os dados do trabalho vivem no índice jobPart e os dados de custos vivem no índice de custos . Os dados necessários podem ser especificados especificando o índice na URL do ponto de extremidade da API de agregação.

Documentos entre pais e filhos

Partes das informações sobre um trabalho estão em dois documentos diferentes no banco de dados do Elasticsearch. Esses documentos estão em uma relação pai-filho . Por exemplo, as informações sobre o projeto de um trabalho residem no documento pai, enquanto as informações sobre o trabalho em si residem no documento filho. Dependendo das informações necessárias, as agregações são antes da agregação pai-filho de dados ou depois dela, mas a própria agregação de dados deve estar presente em todas as consultas.

Modelos de dados de índice

Dados comuns

Analysis

{
  "id": string,
  "createdBy": <User>,
  "dateCreated": Data
  "dateDeleted": Data
  "dateTrashed": Data
  "deleted": boolean,
  "innerId": number,
  "name": string,
  "tags": string[],
  "trashed": booleano,
  "trashedBy": <User>,
  "type": string
}

Designação

{
  "name": string,
  "linguist": <User>,
  "vendor": <Vendor>
}

Portal do Remetente

{
  "id": string,
  "createdBy": <User>,
  "dateCreated": Data
  "dateDeleted": Data
  "dateTrashed": Data
  "deleted": boolean,
  "name": string,
  "tags": string[],
  "trashed": booleano,
  "urlId": string
}

Comprador

{
  "id": string,
  "name": string
}

Cliente

{
  "id": string,
  "dateCreated": Data
  "dateDeleted": Data
  "dateTrashed": Data
  "deleted": boolean,
  "externalId": string,
  "name": string,
  "tags": string[],
  "trashed": booleano,
}

CostCenter

{
  "id": string,
  "dateCreated": Data
  "dateDeleted": Data
  "dateTrashed": Data
  "deleted": boolean,
  "name": string,
  "tags": string[],
  "trashed": booleano,
}

Domínio

{
  "id": string,
  "dateCreated": Data
  "dateDeleted": Data
  "dateTrashed": Data
  "deleted": boolean,
  "name": string,
  "tags": string[],
  "Trashed": booleano
}

Trabalho

{
  "id": string,
  "createdBy": <User>,
  "dateCreated": Data
  "dateDeleted": Data
  "dateTrashed": Data
  "deleted": boolean,
  "extension": string,
  "fileName": string,
  "groupCount": number,
  "innerId": "1",
  "languagePair": string,
  "lastModified": Data
  "localePair": string,
  "sourceLanguage": string,
  "sourceLocale": string,
  "tags": string[],
  "targetLanguage": string,
  "targetLocale": string",
  "taskId": string,
  "trashed": booleano,
  "trashedBy": <User>,
  "uid": string
}

JobPart

{
  "id": "19",
  "assignedTo": <Assignment>,
  "beginIndex": number,
  "buyer": <Buyer>,
  "createdBy": <User>,
  "dateCreated": Data
  "dateDue": Data
  "endIndex": number,
  "groupCount": number,
  "innerId": string,
  "lastModified": Data
  "nível": número,
  "status": string,
  "tags": [],
  "uid": string,
  "workflowStep": <WorkflowStep>
}

MtEngine

{
  "id": string,
  "deleted": boolean,
  "default_: boolean,
  "includeTags": boolean,
  "name": string,
  "tags": string[],
  "type": string,
}

NetRateScheme

{
  "id": string,
  "createdBy": <User>,
  "dateCreated": Data
  "dateDeleted": Data
  "default_": boolean,
  "deleted": boolean,
  "externalId": string,
  "name": string,
  "tags": string[],
}

PriceList

{
  "id": string,
  "createdBy": <User>,
  "currency": string,
  "dateCreated": Data
  "dateDeleted": Data
  "dateTrashed": Data
  "default_": boolean,
  "deleted": boolean,
  "name": string,
  "tags": string[],
  "trashed": booleano,
  "unit": string
}

Projeto

{
  "id": string,
  "buyer": <Buyer>,
  "client": <Client>,
  "costCenter": <CostCenter>,
  "createdBy": <User>,
  "dateCreated": Data
  "dateDeleted": Data
  "dateDue": Data
  "dateTrashed": Data
  "deleted": boolean,
  "domain": <Domain>,
  "innerId": number,
  "languagePairs": string[],
  "localePairs": string[],
  "mtEngine": <MtEngine>,
  "name": string,
  "note": string,
  "owner": <User>,
  "sourceLanguage": string,
  "sourceLocale": string,
  "status": string,
  "subDomain": <SubDomain>,
  "tags": string[],
  "targetLanguages": string[],
  "targetLocales": string[],
  "trashed": booleano,
  "trashedBy": <User>,
  "uid": string,
  "vendor": <Vendor>
}

Citação

{
  "id": string,
  "criado por: <usuário>,
  "currency": string,
  "dateCreated": Data
  "dateDeleted": Data
  "dateTrashed": Data
  "deleted": boolean,
  "innerId": string,
  "name": string,
  "status": string,
  "tags": string[],
  "trashed": booleano,
  "trashedBy": <User>,
  "unit": string
}

Serviço

{
  "id": string,
  "dateCreated": Data
  "dateDeleted": Data
  "dateTrashed": Data
  "deleted": boolean,
  "name": string,
  "publicName": string,
  "tags": string[],
  "trashed": booleano,
  "type": string
}

SubDomain

{
  "id": string,
  "dateCreated": Data
  "dateDeleted": Data
  "dateTrashed": Data
  "deleted": boolean,
  "name": string,
  "tags": string[],
  "Trashed": booleano
}

Utilizador

{
  "id": número,
  "active": boolean,
  "dateCreated": Data
  "dateDeleted": Data
  "dateTrashed": Data
  "deleted": boolean,
  "email": string,
  "firstName": string,
  "fullName": string,
  "innerId": number,
  "jobTitle": string,
  "lastName": string,
  "locale": string,
  "note": string,
  "role": string,
  "tags": string[],
  "timeZone": string,
  "trashed": booleano,
  "userName": string
}

Fornecedor

{
  "id": string,
  "candidate": boolean,
  "dateCreated": Data
  "dateDeleted": Data
  "dateTrashed": Data
  "deleted": boolean,
  "tags": string[],
  "token": string,
  "Trashed": booleano
}

WorkflowStep

{
  "id": string,
  "abbreviation": string,
  "dateDeleted": Data
  "dateTrashed": Data
  "name": string,
  "ordem": número,
  "tags": string[],
  "Trashed": booleano
}

Analysis Index

Agregação de dados

"data": {
  "children": {
    "type": "analysisType"
  }
}

Documento pai

{
  "automationWidget": <AutomationWidget>,
  "project": <Project>,
  "service": <Service>
}

Documento filho

{
  "analysis": <Analysis>,
  "jobPart": <JobPart>,
  "job": <Job>,
  "netRateScheme": <NetRateScheme>,

  "prioridade": número,
  "data": {
    "mt": {
      "match0": {
        "characters": number,
        "páginas": número,
        "percent": number,
        "segments": number,
        "words": number
      },
      "match100": {
        "characters": number,
        "páginas": número,
        "percent": number,
        "segments": number,
        "words": number
      },
      "match50": {
        "characters": number,
        "páginas": número,
        "percent": number,
        "segments": number,
        "words": number
      },
      "match75": {
        "characters": number,
        "páginas": número,
        "percent": number,
        "segments": number,
        "words": number
      },
      "match85": {
        "characters": number,
        "páginas": número,
        "percent": number,
        "segments": number,
        "words": number
      },
      "match95": {
        "characters": number,
        "páginas": número,
        "percent": number,
        "segments": number,
        "words": number
      }
    },
    "repetitions": {
      "characters": number,
      "páginas": número,
      "percent": number,
      "segments": number,
      "words": number
    },
    "tm": {
      "match0": {
        "characters": number,
        "páginas": número,
        "percent": number,
        "segments": number,
        "words": number
      },
      "match100": {
        "characters": number,
        "páginas": número,
        "percent": number,
        "segments": number,
        "words": number
      },
      "match101": {
        "characters": number,
        "páginas": número,
        "percent": number,
        "segments": number,
        "words": number
      },
      "match50": {
        "characters": number,
        "páginas": número,
        "percent": number,
        "segments": number,
        "words": number
      },
      "match75": {
        "characters": number,
        "páginas": número,
        "percent": number,
        "segments": number,
        "words": number
      },
      "match85": {
        "characters": number,
        "páginas": número,
        "percent": number,
        "segments": number,
        "words": number
      },
      "match95": {
        "characters": number,
        "páginas": número,
        "percent": number,
        "segments": number,
        "words": number
      }
    },
    "total": {
      "characters": number,
      "páginas": número,
      "percent": number,
      "segments": number,
      "words": number
    }
  }
}

Índice da API

Agregação de dados

"data": {
  "children": {
    "type": "apiType"
  }
}

Documento pai

{
  "user": <User>
}

Documento filho

{
  "request": {
    "date": Data
    "host": cadeia de caracteres,
    "ipv4": string,
    "ipv6": string,
    "location": string,
    "método": string
  },
  "response": {
    "date": Data
    "duração": número,
    "status": número
  },
  "api": {
    "action": string,
    "asynch": boolean,
    "type": string,
    "uri": string,
    "ver": string
  }
}

Índice de Custos

Agregação de dados

"data": {
  "children": {
    "type": "costsType"
  }
}

Documento pai

{
  "automationWidget": <AutomationWidget>,
  "project": <Project>,
  "service": <Service>
}

Documento filho

{
  "analysis": <Analysis>,
  "job": <Job>,
  "jobPart": <JobPart>,
  "netRateScheme": <NetRateScheme>,
  "priceList": <PriceList>,
  "quote": <Quote>,
  "workflowStep": <WorkflowStep>,
  
  "prioridade": número,
  "data": {
    "mt": {
      "match0": number,
      "match100": number,
      "match50": number,
      "match75": number,
      "match85": number,
      "match95": number
    },
    "repetições": número,
    "tm": {
      "match0": number,
      "match100": number,
      "match101": number,
      "match50": number,
      "match75": number,
      "match85": number,
      "match95": number
    },
    "total": number
  }
}

Índice jobPart

Agregação de dados

"data": {
  "children": {
    "type": "jobPartType"
  }
}

Documento pai

{
  "automationWidget": <AutomationWidget>,
  "project": <Project>,
  "service": <Service>
}

Documento filho

{
  "job": <Job>,
  "jobPart": <JobPart>

  "data": {
    "counts": {
      "chars": {
      "total": number,
      "confirmado": número,
      "notConfirmed": number,
      "bloqueado": número,
      "notLocked": number,
      "confirmedAndLocked": number,
      "notConfirmedAndLocked": number,
      "concluído": número,
      "notCompleted": number
    },
    "groups": {
      "total": number
    },
    "segments": {
      "total": number,
      "confirmado": número,
      "notConfirmed": number,
      "bloqueado": número,
      "notLocked": number,
      "confirmedAndLocked": number,
      "notConfirmedAndLocked": number,
      "concluído": número,
      "notCompleted": number,
      "mt": {
        "postEdited": number,
        "relevant": number,
        "notRelevant": number
      },
      "qa": {
        "verificado": número,
        "notChecked": number
      }
    },
    "words": {
      "total": number,
      "confirmado": número,
      "notConfirmed": number,
      "bloqueado": número,
      "notLocked": number,
      "confirmedAndLocked": number,
      "notConfirmedAndLocked": number,
      "concluído": número,
      "notCompleted": number
    },
    "qa": {
      "avisos": número,
      "ignoredWarnings": number,
      "notIgnoredWarnings": number
    }
  }
}

Exemplos

  • As solicitações HTTP são executadas no Postman.

  • Faça login por meio de um perfil PM ou Admin e obtenha um token de login usando uma API de login.

  • Solicitações POST para api/v3/analytics/jobPart?token=< your_login_token>

Número total de empregos

Consulta

{
  "aggregations": {
    "data": {
      "children": {
        "type": "jobPartType"
      }
    }
  }
}

Resposta

{
  "hits": {
    "total": 359
  },
  "aggregations": {
    "data": {
      "doc_count": 14417
    }
  }
}

No campo agregações , a agregação de dados respondeu com 14.417 documentos correspondentes mostrados no campo doc_count .

Número total de palavras de origem

Consulta

{
  "aggregations": {
    "data": {
      "children": {
        "type": "jobPartType"
      },
      "aggs": {
        "wordCount": {
          "sum": {
            "field": "data.volume.words"
          }
        }
      }
    }
  }
}

Resposta

{
  "hits": {
    "total": 359
  },
  "aggregations": {
    "data": {
      "doc_count": 14417,
      "wordCount": {
        "value": 6893067
      }
    }
  }
}

Número total de palavras de origem dividido pelo idioma de destino

Consulta

{
  "aggregations": {
    "data": {
      "children": {
        "type": "jobPartType"
      },
      "aggs": {
        "byTargetLanguage": {
          "terms": {
            "field": "job.targetLanguage",
            "size": 3
          },
          "aggs": {
            "wordCount": {
              "sum": {
                "field": "data.volume.words"
              }
            }
          }
        }
      }
    }
  }
}

Resposta

{
  "hits": {
    "total": 359
  },
  "aggregations": {
    "data": {
      "byTargetLanguage": {
        "doc_count_error_upper_bound": 0,
        "sum_other_doc_count": 10071,
        "buckets": [
          {
            "doc_count": 1835,
            "wordCount": {
              "value": 702721
            },
            "key": "cs"
          },
          {
            "doc_count": 1491,
            "wordCount": {
              "value": 2602529
            },
            "key": "de"
          },
          {
            "doc_count": 1020,
            "wordCount": {
              "value": 92676
            },
            "key": "fi"
          }
        ]
      },
      "doc_count": 14417
    }
  }
}

A entidade buckets é mostrada na resposta. Quando o módulo de análise é solicitado a dividir os dados por alguma categoria, o resultado é representado como uma lista de buckets. Cada bucket contém uma chave que define quais dados esse bucket representa (neste caso, um idioma de destino) e um valor (outras agregações) específico apenas para essa parte do conjunto de dados.

Número total de trabalhos divididos pelo status do projeto

Consulta

{
  "aggregations": {
    "projectStatus": {
      "terms": {
        "field": "project.status"
      },
      "aggs": {
        "data": {
          "children": {
            "type": "jobPartType"
          }
        }
      }
    }
  }
}

Resposta

{
  "hits": {
    "total": 359
  },
  "aggregations": {
    "projectStatus": {
      "doc_count_error_upper_bound": 0,
      "sum_other_doc_count": 0,
      "buckets": [
        {
          "doc_count": 326,
          "data": {
            "doc_count": 14318
          },
          "key": "NEW"
        },
        {
          "doc_count": 31,
          "data": {
            "doc_count": 89
          },
          "key": "CONCLUÍDO"
        },
        {
          "doc_count": 1,
          "data": {
            "doc_count": 4
          },
          "key": "ASSIGNED"
        },
        {
          "doc_count": 1,
          "data": {
            "doc_count": 6
          },
          "key": "DECLINED_BY_VENDOR"
        }
      ]
    }
  }
}

O módulo Analytics foi instruído a dividir os dados por status do projeto antes da agregação de dados .

Número total de empregos de novos projetos

Consulta

{
  "filter": {
    "term": {
      "project.status": "NEW"
    }
  },
  "aggregations": {
    "data": {
      "children": {
        "type": "jobPartType"
      }
    }
  }
}

Resposta

{
  "hits": {
    "total": 326
  },
  "aggregations": {
    "data": {
      "doc_count": 14318
    }
  }
}

O campo de filtro é usado na consulta. Isso reduz os dados antes de seguir as agregações.

Esse artigo foi útil?

Sorry about that! In what way was it not helpful?

The article didn’t address my problem.
I couldn’t understand the article.
The feature doesn’t do what I need.
Other reason.

Note that feedback is provided anonymously so we aren't able to reply to questions.
If you'd like to ask a question, submit a request to our Support team.
Thank you for your feedback.