Consider the notion of an input stream of intertwined records representing a user interaction (for example a product purchase). Imagine we receive records that indicate a user has placed a product in their shopping basket. At some time later, they perform a check-out ... or ... abandon their cart.
I thus receive a stream of records such as:
Transaction: 123, Added item A to basket
Transaction: 123, Added item B to basket
...
Transaction: 123, Checked out basket
My goal is to output from the pipeline the aggregate of the transaction. For example, given the above, I want to output:
Transaction 123, Items A, B, ... Sale completed
or if no check-out occurs within 24 hours from the last event:
Transaction 123, Items A, B, ... Sale abandoned
... and this is where I'm stuck. I feel that there is some way to think about this story from an Apache Beam pipeline perspective but I'm afraid I'm at a loss on where to begin. I'm thinking that I somehow want to window the records by both transaction and termination and only emit a batch for processing when either an end of transaction record is received or some time interval has elapsed since the last record seen.
Data based window markers have an inherent assumption on ordering of data which is not supported by Beam. In the above schenario, it is assumed that checkout event will come after all the add to the cart events.
However to solve this problem in a crude way you can use State along with Session window to express this in a crude way.
PCollection-RawEvents: Read raw events
PCollection-1: PCollection-RawEvents -> Apply 24 hour SessionWindow to all events.
PCollection-Checkout: PCollection-1 -> Push all the elements for a key in BagState. Read back the state and publish the event Transaction 123, Items A, B, ... Sale completed when you get checkout event Transaction: 123, Checked out basket.
PCollection-Abandon: PCollection-1 -> GroupByKey -> Publish Transaction 123, Items A, B, ... Sale abandoned if Transaction: 123, Checked out basket is not present.
PCollection-Unified: Flatten (PCollection-Checkout, PCollection-Abandon)
I have a schema where Product contains many revisions ProductRevision which say in which status the product is and it is connected to specific ProductParts configuration with nodes for each Part. Each Part can be used in many ProductParts and each ProductParts is used usually in three revisions (status New, Tested and Production). If ProductParts is changed, a new revision is created with status New and connected with previons last revision.
I have there also shortcuts like relationships LATEST, LATEST_NEW, LATEST_TESTED and LATEST_PRODUCTION which connect Product directly with latest node of revision, latest node of revision in status New, etc.
Command for creating simple example is here
CREATE (p:Product {Name:"Test1"})-[:REVISION {Created:datetime()}]->
(pr1:ProductRevision {Status:"New", Created:datetime()})-[:USING]->(pp:ProductParts)
CREATE (pp)-[:CONTAINS]->(p1:Part {Id:1})
CREATE (pp)-[:CONTAINS]->(p2:Part {Id:2})
CREATE (pr1)-[:REVISION {Created:datetime()}]->(pr2:ProductRevision {Status:"Tested", Created:datetime()})-[:USING]->(pp)
CREATE (pr2)-[:REVISION {Created:datetime()}]->(pr3:ProductRevision {Status:"Production", Created:datetime()})-[:USING]->(pp)
CREATE (ppChanged:ProductParts)
CREATE (ppChanged)-[:USING]->(p1)
CREATE (ppChanged)-[:USING]->(p3:Part {Id:3})
CREATE (pr3)-[:REVISION {Created:datetime()}]->(pr4:ProductRevision {Status:"New", Created:datetime()})-[:USING]->(ppChanged)
CREATE (pr4)-[:REVISION {Created:datetime()}]->(pr5:ProductRevision {Status:"Tested", Created:datetime()})-[:USING]->(ppChanged)
CREATE (p)-[:LATEST {Created:datetime()}]->(pr5)
CREATE (p)-[:LATEST_NEW {Created:datetime()}]->(pr4)
CREATE (p)-[:LATEST_TESTED {Created:datetime()}]->(pr5)
CREATE (p)-[:LATEST_PRODUCTION {Created:datetime()}]->(pr3)
So and I need to get chain like (Product)-(ProductParts)-(Part) where ProductParts is connected through latest revision in specific status, e.g. Tested or Production.
I wanted to use shortcuts relationships LATEST_* but it doesn't work as I expected. I tried query like
MATCH (p:Product)-[:LATEST_TESTED|LATEST_PRODUCTION]-(pr:ProductRevision)--(pp:ProductParts)--(pa:Part)
WITH *, max(pr.Created) as prc
RETURN p,pr,prc,pp,pa
but it returns all ProductParts with specific status not only the last one.
If I don't return pr relation between Product and ProductParts missing.
Exists any way how to get following result when I want latest revision with specific status Tested or Production
(:Product {Name: "Test"}) --> (:ProductRevision {Status:"Tested"}) --> (:ProductParts) --> (:Part {Id:1})
. \-> (:Part {Id:3})
You have to split your request in two parts:
- First, get the latest ProductRevision you are interested in
- Second, get all ProductParts and Parts related to the ProductRevision
MATCH (p:Product)-[:LATEST_TESTED|LATEST_PRODUCTION]-(pr:ProductRevision)
WITH p, pr
ORDER BY pr.Created DESC
LIMIT 1
MATCH (pr)--(pp:ProductParts)--(pa:Part)
RETURN p, pr, pp, pa
The first MATCH gets the latest ProductRevision by ordering the results descending and keeping only the first result
The second MATCH gets the rest of the information you need.
I've some simple queries in my Team Foundation Server 2015, .e.g,. to count the open WorkItems. Now I want to track this in history and want to know, how many WorkItems were open one week or one month ago?
So, can I run a query in the past to a date x? Or is the only way to get such historical data to start today and write down all values from now on to have the history in the future?
This will only work in VSO or TFS 2015+
You can use the queries in new REST API's with the ASOF operator.
You would do an HTTP POST with content like below
{
"query": "Select [System.Id], [System.Title], [System.State] From WorkItems Where [System.AssignedTo] = #Me AND [State] <> 'Closed' AND [State] <> 'Done' AND [State] <> 'Removed' ASOF '01 Sep 2015' order by [Microsoft.VSTS.Common.Priority] asc, [System.CreatedDate] desc"
}
to the url
http://[Server]/[Collection]/[TeamProject]/_apis/wit/wiql?api-version=1.0
and then you will get a response back with each work item Id that that query returns and then you can get the details for those work items using the other Rest API that takes in a list of work item Ids (look for _apis/wit/WorkItems on the Rest API link below).
So you would need to use code and not just the UI but you shouldn't need to use the object model to do this.
Rest API Queries - http://r3f.co/1g5cYIw
ASOF - http://r3f.co/1g5cSRg
It is impossible to use TFS work item queries to get historical work items. You need to work with TFS API.
Please check this blog for the details on how to get work item histories via API.
http://geekswithblogs.net/TarunArora/archive/2011/08/21/tfs-sdk-work-item-history-visualizer-using-tfs-api.aspx
How do I write a query in TFS to show me users that have added comments in the history section of a work item in the past 2 days?
Team Project = # Project
And Work Item Type = [Any]
And History Contains MY_KEY_PHRASE
And Changed Date >= #Today - 2
Since Contains cannot be null we have to add a value to the History search.
MY_KEY_PHRASE = Whatever you want to put in your comments field, as a standard, to identify changes (such as "comments" or "cc" or "." etcetera).
The easiest solution is to use prefix before any comments, so any one need to write comments just write "Comments:" keyword followed by carriage return before his comments and then
Edit the query
Add new criteria as the following:
(And/Or)--> And
(Field)---> History
(Operator)--> Contains
(Value)--> Comments
Thanks
M.Radwan
We use Jira extensively in our project, but I often have a hard time finding issues, that I know, I have been working on earlier. Usually, if some case is reported, that seems familiar to something I have been working on in the past, but I don't remember exactly what and when.
Usually, an issue is reported, then our scrum master assigns it to the developer, the developer fixes it (hopefully) and then passes it to the tester (yay, it works!). But then it is no longer assigned to me, and I have a hard finding old issues, that I remember vaguely.
I thought, perhaps it is possible to see the assigned history of an issue, there might be a way to form an advanced search/filter, that finds all issues, that at some time has been assigned to me.
Has anyone done this?
This is meanwhile possible by means of the JIRA Query Language (JQL) operator 'WAS', which has been introduced in JIRA 4.3 and extended in JIRA 4.4 to cover assignees and reporters as well, for example:
project = "Angry Nerds" and (assignee was 'johnsmith' or reporter was 'johnsmith')
General-purpose query for whichever 'current user':
assignee was currentUser()
This filter can be conveniently shared & anybody can put it on their dashboard, etc and it will return results specific to them.. Not supported on all old JIRA versions though.
This was my most-requested JIRA feature ever.
Check out JIRA Toolkit plugin - Participants custom field
https://studio.plugins.atlassian.com/wiki/display/JTOOL/JIRA+Toolkit+Plugin
This field allows you to easily track issues that you've "participated in". These are defined to be any issues you've commented on, raised or are the current assignee. See also the [JIRA Extended Participants] plugin.
Update
This works without plugins:
assignee was currentUser() OR reporter was currentUser() ORDER BY updated DESC
The original answer
This query worked for me:
Participants = currentUser()
try "assignee was username". it would get all tickets been assigned to the user before.
You can find issues by worklog entries directly in the database:
select distinct ji.pkey from jiraissue ji inner join worklog wl on ji.id=wl.issueid where wl.author='some_username';
I agree this should be implemented in the UI though.
For those that will be using JIRA 5+, there is also CHANGED operator that looks at the field changing to specific value within specific time range.
assignee CHANGED TO currentUser() AFTER startOfYear() BEFORE now()
More here: https://confluence.atlassian.com/display/JIRA052/Advanced+Searching#AdvancedSearching-CHANGED
Just another way how to achieve the same result, but might be useful for other cases.
was is not supported to assignee field when I tried recently. You must use CHANGED, FROM, TO keywords to filter.
I'm using something like this:
project = MindBlowingProject AND (assignee in (currentUser()) OR assignee CHANGED from (currentUser()) OR reporter in (currentUser())) ORDER BY updated DESC
So there are 3 scenarios:
1 - I changed it in some way - assignee changed by [UserName],
2 - I changed the status ( closed it, whatever) - OR status changed by [UserName],
3 - I still have it - OR assignee = [UserName]
So the whole query (assuming that the changed statement is allowed is:
assignee changed by [UserName] OR status changed by [UserName] OR assignee = [UserName]
I think the most sensible approach is to search the issue-history. The only thing, that is not logged there, is who accessed the issue (just watching, without changing anything).
But you can't search the ticket-history without database access (as far as I know, please correct me if I'm wrong)
So, to search all issues with "someUserName" in the issuehistory, you have to inner join the table changegroup (and maybe the table changeitem from there).
Example:
select ji.id,issuenum,summary,creator,assignee,ji.created,updated,c.id as histid,c.author from jiraissue ji inner join changegroup c on ji.id=c.issueid where c.author like 'someUserName';
c.id as histid ==> this is the number/id of the entry in the (issue-)"History" tab
Meaning: if there ever was a change by the user "someUserName" it is logged in the History and it will be listet with this query
The following example will just list every disting issue, where the "myusername" was found in the History after the date 20180501:
select distinct ji.id,issuenum,summary,creator,assignee,ji.created,updated,c.author from jiraissue ji inner join changegroup c on ji.id=c.issueid where c.author like 'myusername' and ji.created > '2018-05-01T00:00:00.000';
I annotated the necessary relation here:
From menu select Tempo->Reports
Select date-range
and you should see report.
I tried the below SQL query and it gives data of all the issues and all the assignees that were ever assigned to an issue. Any change in the assignee for any issue is captured by below query:
select distinct
p.pkey +'-'+cast(ji.issuenum as varchar(max)),
ji.SUMMARY,
cast(ci.OLDSTRING as nvarchar(max)) as 'Old value',
cast(ci.NEWSTRING as nvarchar(max)) as 'New value'
from
jiraissue ji
join project p on p.id = ji.PROJECT
join changegroup cg on cg.issueid = ji.id
join changeitem ci on ci.groupid = cg.id and FIELD = 'assignee'
Anyone looking for the query would find this useful : )
-Neha 'D' Pal