Omniscope Custom Blocks › Preparation/Business-Hours-SLA

Business Hours and SLA

Elapsed business hours between timestamps within opening hours, excluding weekends and holidays, with SLA due times and met / breached status.

Preparation › Date Python visokio-agents

Open the demo in Omniscope Download demo.ioz Sample data: tickets.csv Source on GitHub

Items tagged visokio-agents are community examples built by Visokio's agents, to extend Omniscope's core blocks and views with popular, specialist and more unusual use cases, and to show what anyone, people or agents, can build on Omniscope. They are tested by automated tests and were run on a real Omniscope server. They were not reviewed by Omniscope's core team, so they are not on a par with the core blocks and views, which have years of manual, functional and unit tests behind them. About

Omniscope custom block · Preparation

Resolution times in business hours, within opening hours and skipping weekends and bank holidays, with SLA due times and met or breached for every ticket.

Python · pandas, numpy · nothing extra to install

The problem it solves

A ticket opened at 16:00 on a Friday and fixed at 10:00 on Monday took 66 hours, or 2.5 working hours. Service levels are agreed in working time, but timestamps are in calendar time, and converting between them, with bank holidays, is an awkward calculation.

This block measures every ticket in business hours, works out when its SLA falls due, flags met and breached (including open tickets already past due) and summarises by priority.

How it works

What goes in

Tickets

600 synthetic service desk tickets, November 2025.

Ticket Priority Team Opened Resolved
INC40109 P4 Applications 2025-11-03 10:26 2025-11-04 14:13
INC40584 P4 Network 2025-11-03 10:52 2025-11-05 10:46
INC40068 P3 Network 2025-11-03 11:22 2025-11-03 12:09
INC40135 P3 Network 2025-11-03 11:23 2025-11-03 18:27
INC40378 P3 Service Desk 2025-11-03 11:25 2025-11-10 06:19
INC40065 P1 Applications 2025-11-03 11:51 2025-11-03 13:54

600 rows in the sample file.

The options

Option Demo setting What it does
Opened (start) field Opened When each item was opened.
Resolved (end) field Resolved Empty = still open.
Priority field (optional) Priority Priority of each item, for the SLA hours by priority.
SLA hours by priority P1=4, P2=8, P3=24, P4=40 For example: P1=4, P2=8, P3=24, P4=40
As of (for open items) 2025-11-28 17:00 Default: the latest time in the data.
Opening time 09:00 Start of the working day, as HH:MM.
Closing time 17:30 End of the working day, as HH:MM.
Public holidays England and Wales Public holidays that do not count as working time.

What comes out

Tickets (first rows)

Ticket Priority Opened Resolved Business Hours Elapsed Calendar Hours Elapsed SLA Hours SLA Due SLA Status Business Hours To Spare
INC40109 P4 Mon 03 Nov 10:26 Tue 04 Nov 14:13 12.28 27.78 40 Fri 07 Nov 16:26 Met 27.72
INC40584 P4 Mon 03 Nov 10:52 Wed 05 Nov 10:46 16.9 47.9 40 Fri 07 Nov 16:52 Met 23.1
INC40068 P3 Mon 03 Nov 11:22 Mon 03 Nov 12:09 0.78 0.78 24 Thu 06 Nov 09:52 Met 23.22
INC40135 P3 Mon 03 Nov 11:23 Mon 03 Nov 18:27 6.12 7.07 24 Thu 06 Nov 09:53 Met 17.88
INC40378 P3 Mon 03 Nov 11:25 Mon 10 Nov 06:19 40.08 162.90 24 Thu 06 Nov 09:55 Breached -16.08
INC40065 P1 Mon 03 Nov 11:51 Mon 03 Nov 13:54 2.05 2.05 4 Mon 03 Nov 15:51 Met 1.95
INC40118 P1 Mon 03 Nov 12:01 Mon 03 Nov 14:08 2.12 2.12 4 Mon 03 Nov 16:01 Met 1.88
INC40206 P2 Mon 03 Nov 12:01 Mon 03 Nov 16:28 4.45 4.45 8 Tue 04 Nov 11:31 Met 3.55
INC40586 P4 Mon 03 Nov 12:58 Mon 03 Nov 22:49 4.53 9.85 40 Mon 10 Nov 10:28 Met 35.47
INC40161 P2 Mon 03 Nov 13:00 Mon 03 Nov 18:44 4.5 5.73 8 Tue 04 Nov 12:30 Met 3.5

Summary by priority

Priority Items Closed Open Met Breached Open And Breached Met Rate (closed) Median Business Hours Median Calendar Hours
P1 53 53 0 38 15 0 0.717 1.75 3.9
P2 125 125 0 112 13 0 0.896 2.117 6.767
P3 278 271 7 259 12 1 0.956 5.633 17.25
P4 144 140 4 137 3 2 0.979 8.5 32.78
All 600 589 11 546 43 3 0.927 4.483 14.68
Calendar time overstates how long tickets took in working time, most for lower priorities that wait overnight (synthetic data).
Calendar time overstates how long tickets took in working time, most for lower priorities that wait overnight (synthetic data).

Calendar time overstates how long tickets took in working time, most for lower priorities that wait overnight (synthetic data).

P1 has the tightest target and the lowest met rate.
P1 has the tightest target and the lowest met rate.

P1 has the tightest target and the lowest met rate.

Where it pays off

IT and customer service: Service desk SLAs

Response and resolution times in business hours by priority, team and month, with open tickets at risk.

Financial services: Complaint handling

Time to acknowledge and resolve complaints in working days and hours against regulatory targets.

Public sector: Case and request targets

Information requests, planning applications or casework measured in working time.

Logistics and B2B: Order processing

Order-to-dispatch time within warehouse opening hours, by customer contract.

Use cases describe typical scenarios and are illustrative.

Why do this in Omniscope

How it fits into an Omniscope workflow

Ticket system export → Business Hours and SLA → Report (met rate, breaches) → Email output (open and breached)

Load tickets on a schedule; Working Days gives whole-day versions of the same calculation, Date Dimension the calendar.

Email the open and breached tickets to team leads; show met rates by priority and month in a Report.

In one step

Business hours net of weekends and holidays, and SLA status for each item.

Try it

  1. Open the demo project (demo.iox on the demo server, or import demo.ioz from this folder): synthetic service desk tickets with priorities.
  2. The question: are we meeting our SLAs, measured the way the contract measures them?
  3. Open the block: opened and resolved fields, P1=4, P2=8, P3=24, P4=40, opening hours 09:00 to 17:30. Run it.
  4. Look at the summary: 93% met overall, P1 lowest; and the 3 open tickets already past due.
  5. Change the opening hours or add a closure day and re-run.

Running in Omniscope

Omniscope workflow
Omniscope workflow

The demo project's workflow: the sample data, the block, and a Validate data check on its output.

Language and libraries

Python. It uses pandas and numpy, plus the Python standard library (datetime, re).

pandas and numpy are part of Omniscope's Docker Python image, and the block was run in both host mode and Docker mode on an Omniscope server, with the same results. It needs nothing else installed.

Tested

The demo workflow ran without errors on an Omniscope server, giving 600 records in Items and 5 in Summary. Automated tests cover normal data, empty input, wrong types and large input.

Reference

Fields it reads

NameTypeWhat it does
Opened (start) fieldFieldWhen each item was opened.
Resolved (end) fieldFieldEmpty = still open.
Priority field (optional)FieldPriority of each item, for the SLA hours by priority.
SLA hours field (optional)Field

Options

NameTypeWhat it does
SLA hours by priorityTextFor example: P1=4, P2=8, P3=24, P4=40
SLA hours for everything elseNumber0 = none.
As of (for open items)TextDefault: the latest time in the data.
Opening timeTextStart of the working day, as HH:MM.
Closing timeTextEnd of the working day, as HH:MM.
WeekendChoice
Public holidaysChoicePublic holidays that do not count as working time.
Extra closure datesTextComma-separated, for example: 2025-12-24, 2025-12-31

Outputs

OutputWhat it holds
ItemsThe input with business and calendar hours, open flag, SLA hours, SLA due, SLA status and hours to spare.
SummaryPer priority and overall: items, closed, open, met, breached, met rate, median hours.