Legacy Dev Forum Posts

 View Only

Sign Up

Obtain exact calculation oservicelevel metric

  • 1.  Obtain exact calculation oservicelevel metric

    Posted 06-05-2025 18:09

    fenexdev | 2024-02-24 20:13:16 UTC | #1

    I'm having issues to calculate the today's service level of one and many queues. (Already gathered the list that I want to average and the individual ones I want to calculate.)

    Currently I'm using conversations/aggregates/query to return the "oServiceLevel" metric. Using this structure:

                    query = PureCloudPlatformClientV2.ConversationAggregationQuery()
                    query.interval = date_str
                    query.metrics = ['oServiceLevel']
                    query.group_by = ['queueId']
                    query.filter = PureCloudPlatformClientV2.ConversationAggregateQueryFilter()
                    query.filter.type = 'or'
                    query.filter.predicates = [PureCloudPlatformClientV2.ConversationAggregateQueryPredicate()]
                    query.filter.predicates[0].type = 'dimension'
                    query.filter.predicates[0].dimension = 'queueId'
                    query.filter.predicates[0].operator = 'matches'
                    query.filter.predicates[0].value = queue_id
    
                   
                    query_result = analytics_api.post_analytics_conversations_aggregates_query(query)
                    serviceLevel = query_result.results[0].data[0].metrics[0].stats.ratio

    And timestamp "[Today date]T00:00:00.000Z/[Tomorrow date]T00:00:00.000Z" While it does work to obtain "a value" It does not return the exact value that Genesys returns through the online platform which is what I need.

    As well for many queues group average service level for today, I group them all and do a little math to obtain the average, but same thing it doesn't return the proper value.

    The math:

    group_average_service_level = {k: round((sum(v) / len(v)) * 100) for k, v in group_service_levels.items()}

    Most likely there's a variable I'm not taking in mind but the Queue Performance tool from Genesys does, what it may be? How can I obtain the proper ServiceLevel to have it matching the one showing in the platform?

    Thank you and best regards.


    system | 2024-03-26 20:12:45 UTC | #2

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 24849