Calculating Service Level from raw Analytics interval data

How do I get an accurate Service Level percentage from the raw interval data returned by the Analytics API? The getAnalyticsQueuesQueuesIntervals endpoint gives me offerCount and handleCount, but service level is usually defined as the percentage of offers handled within a specific threshold, like 20 seconds. The raw interval data doesn’t seem to have a handleTime field that I can sum up and compare against the threshold.

I’m trying to replicate the ‘Service Level’ metric from the UI using the JS SDK. Here’s what I’m doing:

const intervals = await analyticsApi.getAnalyticsQueuesQueuesIntervals({
 interval: 'PT1H',
 view: 'cumulative',
 select: ['offerCount', 'handleCount']
});

The response looks like this:

[
 {
 "interval": "2023-10-27T10:00:00.000Z",
 "offerCount": 150,
 "handleCount": 140
 },
 ...
]

If I just do (handleCount / offerCount) * 100, I get a high number, but it doesn’t account for the time threshold. Some of those 140 handles might have taken 5 minutes. The UI shows a Service Level of 85%, but my calculation gives 93%.

Is there a different view or select field that includes the distribution of handle times? I’ve looked through the cumulative and realtime views, but nothing jumps out. Maybe I need to query the interactions level instead of queues? Or is there a specific formula for combining the interval data that I’m missing? The docs are a bit sparse on the exact math for SL from raw intervals.