Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: Estimate Agent Shift Length

  1. #1
    Join Date
    Aug 2012

    Question Estimate Agent Shift Length

    Hi All -

    I've been chewing on this one for a few days and not sure how i should go about it. I've got some chat data, which i can't share with you, that has information like 'ChatAgent' 'StartTime', and 'EndTime'

    My task is to calculate, with reasonable precision, how many hours an agent worked in a day. Obviously, I can't tap into any WFM system or alternate reports or I wouldn't be going down this road.

    I can think of 2 approaches:

    1) Shift Duration = Max(EndTime) - Min(StartTime), grouped by agent. This approach gets tricky if there is a lot of 'down time', where a person isn't chatting at the front or end of their shift. I actually don't think that this would be an issue because our agents stay pretty busy. That said, I'm running into issues where an agent's PREVIOUS shift from the day before crosses midnight. They end up looking like they've worked 20+ hours in some cases

    2) Calculate duration (EndTime - Starttime) for each chat and sum those values, grouped by agent. This seems like the best approach but it gets complicated because of concurrency. An agent can be chatting with more than one customer at a time. If a person averaged a concurrency of 2 chats, an 8 hour shift would result in 16 hours of work using this method (I only want to know that they worked 8 hrs)

    I found myself populating a database table with 24 hours of 10-second intervals, when I decided that there must be a better way :/

    Any ideas how to do this within a spoon transformation? I'm also starting to wonder if I should attempt to write a UDF for MySQL. I'll admit I've got hardly any experience writing UDFs for SQL though.


  2. #2
    Join Date
    Jul 2009


    I don't know about MySQL, but Postgres has some nice range datatype features:

    You could create a reference table in the Postgres database with your 10-second intervals throughout the day, load up all of the chats into another table, and join them to find out when agents were chatting with customers.

    This wouldn't help you detect whether agents are chatting with other agents, instead of customers...

  3. #3
    Join Date
    Jun 2012


    Quote Originally Posted by areese801 View Post
    Any ideas how to do this within a spoon transformation?
    My idea would be to delimit a shift by excessive idle time (120 minutes in step Threshold).
    Attached Files Attached Files
    So long, and thanks for all the fish.

  4. #4
    Join Date
    Aug 2012


    Thanks guys!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.