It's all about the answers!

Ask a question

oslc REST API: get the Rank of items


2
2
Daniel Llin Ferrero (3128) | asked Feb 12 '13, 6:33 a.m.
Hello!
I'm working on a python script to generate some information and reports from our Team Concert. I'm using the oslc REST API of RTC. The relevant projects in RTC have a Scrum process and therewith are heavily organized by using the "rank". Installed RTC version is 4.0.1.

I am already able to get all work items and the iterations (Product Backlog and Sprint Backlogs). The only thing that is still missing for my purpose is the order (ranking) of the items within their iterations.

So the question is:
For a given work item, how can I get the rank via REST?

Or a possible alternative:
For a given iteration, how can I get a list of the assigned work items, ordered by the items rank?

Comments
Andrea Ianni commented Dec 19 '13, 9:56 a.m. | edited Jan 12 '17, 6:02 p.m.

Hi all,
always about RANK values, is it this value stored in db or dw?
If yes, where?
I need to get this value and use in one custom BIRT report based on one JDBC data source.

Thanks in advance
Andrea


Liora Milbaum commented Dec 07 '14, 7:43 a.m.

 Andrea, Did you find a solution how to present the RANK value in a BIRT report? 


Liora


1
Andrea Ianni commented Dec 09 '14, 8:16 a.m.

Hi Liora
no, I did found no solution for that :(
At the moment, we use a custom attribute in order to sort our stories/epics.

Ciao
Andrea

Accepted answer


permanent link
Sharoon Shetty Kuriyala (55133) | answered Feb 13 '13, 9:15 a.m.
JAZZ DEVELOPER
No as of today we do not have an api that fetches the rank values. The current design of ranking is such that only the sequence value is stored in the repository. The calculation of an integer ranking is done at the client side. 

Thanks,
Sharoon
Ralph Schoon selected this answer as the correct answer

Comments
Daniel Llin Ferrero commented Feb 13 '13, 9:44 a.m. | edited Jan 12 '17, 6:00 p.m.

 Hello Sharoon,

thanks for your comment.

I found a curious "custom attribute" in the reporting API's work itm representation with the key "com.ibm.team.apt.attribute.planitem.priority...". Beside a priority literal, it contains a character string whose order seems to correspond to the ranking.

Is this the "sequence value" you mentioned? If not, where can I found that?

It's no problem not to have an integer ranking as long as I can reproduce the ranking order.


Sharoon Shetty Kuriyala commented Feb 13 '13, 9:59 a.m.
JAZZ DEVELOPER
The attribute you see is the Ranking attribute which by default is configured to be a priority attribute but can be any enumeration attribute. Ranking in RTC works based on stack based ranking. The coarse grained stack is defined by the Ranking attribute which is configured in the process spec editor of the project. Within each stack you have absolute ranking which is based on the position of the work item in the plan which is the order or sequence of the work item.
 

You can read more details in the article https://jazz.net/library/article/1033, if you have not yet seen it.


The sequence value is an internal attribute so you might not be able fetch those values, please open an enhancement request if you need the support to get the ranking order as an api.

Thanks,
Sharoon 


Daniel Llin Ferrero commented Feb 13 '13, 10:37 a.m. | edited Jan 12 '17, 6:01 p.m.

 Hmm... maybe we have a little misunderstanding. :)

I give you an example:

When I ask for a work item via the Report REST API, I get an XML response that includes the following extension element:

<allExtensions>
<helperId>_jZiMQHUEEeKvMP-wL7rdmQ</helperId>
<key>
com.ibm.team.apt.attribute.planitem.priority._pm7NmRYUEd6L1tNIGdz5qQ
</key>
<type>smallStringValue</type>
<booleanValue/>
<integerValue/>
<longValue/>
<doubleValue>0.0</doubleValue>
<smallStringValue>priority.literal.l01 O00003<</smallStringValue>
<displayValue>priority.literal.l01 O00003<</displayValue>
<mediumStringValue/>
<largeStringValue/>
<timestampValue/>
<decimalValue/>
</allExtensions>

The value is "priority.literal.l01 O00003" where the part before the white space decodes the enumeration element of the priority (none, low, medium, high). The string after the white space is the "character string" I mentioned in my last post. So, at a first glance, it seems that an two-step-order - first by the priority category and secondly by the curious string after the white space - leads to a complete ranking.

Is that possible? If not, what is meaning of that "extension" node?

Thanks!


Sharoon Shetty Kuriyala commented Feb 13 '13, 12:55 p.m.
JAZZ DEVELOPER

The value that you see here is what is stored as it is in the repository. It needs to be processed and presented in a representation that can be understood and interpreted by the user. Currently since we do not officially support an api to fetch the Rank values, its missing. There is an existing enhancement to view the rank values in a query in eclipse client which also has the same underlying reason for not being supported.
Cannot query on rank number of work item in queries (186360)


Ben Spiller commented Apr 24 '13, 10:38 a.m.

Thanks for that info. 


Given that I think you're saying the ability to get/set rank isn't supported in the rest (or Java) api right now (even though it's a very essential part of the model of an agile plan), I think we'd be really interested to know if there's ANY way to do this - even if it's 'unsupported': is there some way to use today's RTC 4.0.1 to get and/or set the rank of work items (within each priority bucket), e.g. by changing those mysterious strings after the priority.literal.101 string above. Is it ok to set them to any arbitrary value so long as the relative lexical order of those strings indicates the rank order of the items, or do they have to be set to something special that lines up with other data in the repository?

To re-iterate, I'm not at all asking for a way to get/set user-friendly consecutive integers for rank (like in the web UI) - any of us could write some code to simulate that if we need it - I just need some way to get and set the relative rank of items, even if not officially supported. Is this possible? Thanks!


Ben Spiller commented May 03 '13, 10:12 a.m.

Any info on this (however informal/unsupported) would be hugely helpful...I really need to be able to get/set rank from the API


Many thanks
Ben


Daniel Llin Ferrero commented May 03 '13, 12:07 p.m.

see my post below.... :)

showing 5 of 7 show 2 more comments

One other answer



permanent link
Daniel Llin Ferrero (3128) | answered May 03 '13, 12:04 p.m.
edited May 03 '13, 12:06 p.m.

Hey Ben,

look at my post above. I use this approach at the moment and it's suitable. To fit the rank best, even if an item is not ranked within RTC, do a first sorting by the work item id.

I give you a short Python code snippet I use at the moment for the ranking. Maybe it's useful.

 

First, I put all items (in fact I use the history items, but that's not important) into a list and calculate a 4-tuple for each item like this:

aptPriority_nodes = history_node.findall("allExtensions[key='com.ibm.team.apt.attribute.planitem.priority._pm7NmRYUEd6L1tNIGdz5qQ']/smallStringValue")
        priority = history_node.find('priority/id').text
        id_rank_string = "%012d"%int(item.identifier)
        if len(aptPriority_nodes) == 0 or aptPriority_nodes[0].text == None:
            aptPriority = None
            aptRank = None
        else:
            apt_parts = aptPriority_nodes[0].text.partition(' ')
            aptPriority = apt_parts[0]
            aptRank = apt_parts[2]
        rank = (priority,aptPriority,aptRank,id_rank_string)

 

Than I can get a suitable ranking with this sorting:

        for item in itemlist:
            if item.get_rank()[2] == None:
                logging.warn("Item %(id)s should get ranked but no ranking is provided by RTC! Ranking may be not in sync with RTC for this item."%({'id':item.identifier}))
            if item.get_rank()[1] != None and item.get_rank()[1] != item.get_rank()[0]:
                logging.warn("The priority of item %(id)s was set back to  “Unassigned” that leads to an RTC internal inconsistency. Ranking may be not in sync with RTC for this item."%({'id':item.identifier}))
        # first oder: by id, descending
        itemlist.sort(key=lambda item: item.get_rank()[3],reverse=True)
        # second order: by rank string
        itemlist.sort(key=lambda item: item.get_rank()[2])
        # by ranked or unranked
        itemlist.sort(key=lambda item: item.get_rank()[1],reverse=True)
        # last order: by priority literal, descending
        itemlist.sort(key=lambda item: item.get_rank()[0],reverse=True)

It works for me. It's not so hard to investigate the logic. It's sad that RTC has no official and documented way to do that. I think it's a core functionality of real Backlog Management Tools.

Hope that helps.


Comments
Ben Spiller commented May 03 '13, 12:10 p.m.

Thanks Daniel, great example. 


I also wonder (and it may need someone from IBM to help with this one) whether it's also safe to set/update the rank by writing some string into this field. If their algorithm is just to do a lexicographic sort of the rank strings then it wouldn't be too hard for us to make up our own and write them to the database. 

It's sad that RTC has no official and documented way to do that. I think it's a core functionality of real Backlog Management Tools.

Yes, totally, I couldn't believe this isn't being exposed properly in the apis

Thanks
Ben


Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.