Bug 831894 - RFE: Get Stats about Translation Documents via REST
Summary: RFE: Get Stats about Translation Documents via REST
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Zanata
Classification: Retired
Component: Component-Logic
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: 2.0
Assignee: Carlos Munoz
QA Contact: Ding-Yi Chen
URL:
Whiteboard:
Depends On:
Blocks: 756657 848988
TreeView+ depends on / blocked
 
Reported: 2012-06-14 02:42 UTC by Lee Newson
Modified: 2012-11-07 06:18 UTC (History)
5 users (show)

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 06:18:40 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 831887 0 unspecified CLOSED RFE: List available Translation Locales via REST API 2021-02-22 00:41:40 UTC

Internal Links: 831887

Description Lee Newson 2012-06-14 02:42:17 UTC
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-14 03:39:27 UTC
Would you want to fetch all locale stats for a document at once, or separately?

Comment 2 Matthew Casperson 2012-06-19 03:40:17 UTC
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-17 02:45:31 UTC
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 22:46:09 UTC
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 22:54:28 UTC
    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 22:56:19 UTC
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 04:00:58 UTC
VERIFIED with 1.8.0-SNAPSHOT (20120810-0025)

Comment 12 Carlos Munoz 2012-08-13 00:28:57 UTC
Reassigning to add client enhancements.

Comment 13 Carlos Munoz 2012-08-13 03:42:29 UTC
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-17 02:18:58 UTC
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-17 03:52:55 UTC
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 06:24:09 UTC
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-21 02:24:24 UTC
VERIFIED with Zanata version 1.8.0-SNAPSHOT (20120821-1123)

Comment 19 Sean Flanigan 2012-11-07 06:18:40 UTC
Fix released in Zanata 2.0.


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