Bug 831894 - RFE: Get Stats about Translation Documents via REST
RFE: Get Stats about Translation Documents via REST
Status: CLOSED CURRENTRELEASE
Product: Zanata
Classification: Community
Component: Component-Logic (Show other bugs)
unspecified
Unspecified Unspecified
unspecified Severity unspecified
: ---
: 2.0
Assigned To: Carlos Munoz
Ding-Yi Chen
:
Depends On:
Blocks: 756657 848988
  Show dependency treegraph
 
Reported: 2012-06-13 22:42 EDT by Lee Newson
Modified: 2012-11-07 01:18 EST (History)
5 users (show)

See Also:
Fixed In Version: 1.8.0-SNAPSHOT (20120821-1123)
Doc Type: Bug Fix
Doc Text:
Cause Zanata does not offer a way to query translation statistics via REST. Consequence External clients in need of translation stats from Zanata had to resort to screen scraping and other methods to get the information. Change Added Statistics REST endpoint to fetch translation statistic data from Zanata. Currently supports version and document level statistics. (Please see the REST API documentation for details on this service.) Result External clients are now able to fetch translation statistics via the REST API, without resorting to screen scraping.
Story Points: ---
Clone Of:
: 848988 (view as bug list)
Environment:
Last Closed: 2012-11-07 01:18:40 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Lee Newson 2012-06-13 22:42:17 EDT
Split from Bug #759983 point number 2. It sort of overlaps a bit with Bug #831887

Currently there isn't a proper way to tell what percentage a Translation Document is at via the REST API without trying to manually calculate it using the number of strings in the Source Document and the number of available translated text-flows in the Translation Document. As such it would be handy if there was a mechanism to get this type of information via the REST API.
Comment 1 Sean Flanigan 2012-06-13 23:39:27 EDT
Would you want to fetch all locale stats for a document at once, or separately?
Comment 2 Matthew Casperson 2012-06-18 23:40:17 EDT
Stats would be fetched at the document level and at the view, and return stats for all locales at once.
Comment 6 Sean Flanigan 2012-07-16 22:45:31 EDT
In terms of the API design, I think it should look something like this:

<stats-list [group="GROUP7"] project="foo_installation_guide" version="3.1" [docId="Author_Info"]>

    <translation-stats code="ja-JP" totalStrings="3000" translatedStrings="2900" need-review-strings="99" total-words="33217" translated-words="32846" need-review-words="1000" />

    ...

<stats-list>

(where group and docId are intended for other REST API points, at the project group level, or the document level),
with URL parameters to choose whether the word stats are included, and to request a single locale's stats.
Comment 7 Carlos Munoz 2012-08-08 18:46:09 EDT
Added a statistics REST API endpoint. Currently supports fetching stats at the iteration and document level in both XML and JSON formats.

Sample URL for iteration stats (GET):

http://<server>/rest/stats/<project-slug>/iter/<iteration-slug>

And for document stats (GET):

http://<server>/rest/stats/<project-slug>/iter/<iteration-slug>/doc/<docId>

(Doc id may contain slashes)

Please see the REST API documentation for the message format returned by these calls.

Additional query parameters for these endpoints:
word - Indicates whether to return Word level statistics
detail - (Only supported for the iteration level stats). Fetches detailed stats for documents contained in the iteration in the same call.
locale - Indicates the locale Ids to fetch stats for. May be provided multiple times to fetch stats for multiple locales. If not provided, stats for all available iteration locales will be returned.
Comment 9 Carlos Munoz 2012-08-08 18:54:28 EDT
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause
Zanata does not offer a way to query translation statistics via REST.

Consequence
External clients in need of translation stats from Zanata had to resort to screen scraping and other methods to get the information.

Change
Added Statistics REST endpoint to fetch translation statistic data from Zanata. Currently supports version and document level statistics. (Please see the REST API documentation for details on this service.)

Result
External clients are now able to fetch translation statistics via the REST API, without resorting to screen scraping.
Comment 10 Carlos Munoz 2012-08-08 18:56:19 EDT
Correction on the endpoints above. They should be:

Sample URL for iteration stats (GET):

http://<server>/rest/stats/proj/<project-slug>/iter/<iteration-slug>

And for document stats (GET):

http://<server>/rest/stats/proj/<project-slug>/iter/<iteration-slug>/doc/<docId>
Comment 11 Ding-Yi Chen 2012-08-10 00:00:58 EDT
VERIFIED with 1.8.0-SNAPSHOT (20120810-0025)
Comment 12 Carlos Munoz 2012-08-12 20:28:57 EDT
Reassigning to add client enhancements.
Comment 13 Carlos Munoz 2012-08-12 23:42:29 EDT
Added java and maven client statistics commands. For details on usage type mvn zanata:help -Dgoal=stats -Ddetail

Zanata maven client 1.8.0-SNAPSHOT

See:
https://github.com/zanata/zanata/commit/b3628c711f5e8239387902291aaf04f915d1ab24
https://github.com/zanata/zanata/commit/201587b0c50d78b54de3b7e13e40c9af5a40dea8
https://github.com/zanata/zanata/commit/89527b89a61e425723487185ae5cc3943c322fdb
Comment 14 Ding-Yi Chen 2012-08-16 22:18:58 EDT
VERIFIED with Zanata version 1.8.0-SNAPSHOT (20120816-1023)
Please note that the RFE of client support is filed as Bug 848988
Comment 15 Ding-Yi Chen 2012-08-16 23:52:55 EDT
Oops, it seems that it returns empty statistic for the document that has no translation but haven't been edited.

Reassigned.
Comment 17 Carlos Munoz 2012-08-20 02:24:09 EDT
Zanata now returns stats for all requested languages, even if they have not been translated.

See:
https://github.com/zanata/zanata/commit/91cfe0346544794743ea9c7f610fba31f7b67430
Comment 18 Ding-Yi Chen 2012-08-20 22:24:24 EDT
VERIFIED with Zanata version 1.8.0-SNAPSHOT (20120821-1123)
Comment 19 Sean Flanigan 2012-11-07 01:18:40 EST
Fix released in Zanata 2.0.

Note You need to log in before you can comment on or make changes to this bug.