As a mission-critical, core component of Sky’s infrastructure, powering multiple front-ends, content management systems and various routes to market, the multi-channel Products and Pricing engine handles thousands of sophisticated business rules to evaluate customer profiles and baskets. It helps Sky make the most appropriate offers to maximize long-term value for both the customer and the business. Fully data-driven, the system includes a Catalogue Services component, a powerful business rules engine, customer portfolio management, e-commerce basket and call centre support. It is optimized for speed and availability, serving tens of millions of users on a daily basis. The in-house designed business rules engine reliably handles complex dependencies and inter-relations between products, offers, discounts, eligibility rules and regulatory requirements and has had a profound positive effect on Sky’s bottom-line over the years. The engine also feeds transactional data into analytics and reporting solutions.
What was included in the scope of the project?
Spread over several modular components, the business software we developed for Sky included the following capabilities:
- A business-friendly interface for defining and maintaining a highly dynamic product portfolio of any size as well as the scheduling of an unlimited variety of offers, pricing rules and other criteria. The interface supports complex workflows, validations and reporting;
- A powerful business rules engine that can process customer information and run it through thousands of business rules to determine the pricing, applicable offers and a variety of other parameters for any sales transaction (for both new and existing customers);
- The “Catalogue Services” component – a web-based API situated at the bottom of the software stack and powering multi-channel sales services and front-ends (e.g. direct / call-center, retail / partners, on-line, mobile).
- A number of integrations with proprietary systems and third-party components, fulfillment / warehouse / delivery systems, call centre software, etc.
- A suite of additional tools to help with customer and data migration from legacy systems; as well as bespoke data visualisation and reporting tools.
What is a business rules engine?
A business rule is a statement describing a business policy or procedure. For example: a customer can have no more than one “Sports” subscription at any time. Or: a customer buying a “Sky Sports Month Pass” in the Republic of Ireland should be charged XX Euro per month. Or something more complex like: In the the UK, all customers buying their first “Sky Sports Month Pass” in April should get a discounted rate of Y GBP per month for the first 3 months.
A business rules engine is a software component allowing staff who are non-programmers to easily add, modify or piece together business logic in whatever ways are currently required by the business. A well-designed business rules engine can help transform the entire business into a data-driven enterprise, able to respond to changing customer demands and managerial decisions in near real-time. This also means that implementing new business rules or changing existing ones requires little or no code changes.
What does the Sky business rules engine do?
The Catalogue Services engine exposes data-driven REST API end-points, which other components use to answer questions, such as:
- For a given customer (or territory / market segment), what products are currently available for sale? What prices can Sky display for these products?
- For a given customer and a selection of products, is the selection valid, given Sky’s current policies, promotions and restrictions? How much should the customer pay up-front? What will be their recurring (monthly) charges? What currently available offers and discounts are they eligible for?
- Once they place an order for the products in their basket, what should the customer actually receive, in terms of order fulfilment? What needs to be shipped and when? What services need to be enabled, disabled or modified in their account?
- If an existing customer subscription needs to be renewed soon, how much should they be charged? Are there any known price changes coming up? Any upcoming changes to the offers they are eligible for?
The software is written in pure Python with a bespoke, high-performance in-memory graph database and business rules engine. The Python Flask web framework is used to expose a number of REST-ful APIs to the other micro-services components in Sky’s tech stack and to various client-facing front-ends. It uses the Kubernetes container orchestration system to run on Sky’s proprietary cloud infrastructure and on Amazon’s AWS cloud.
Python was initially chosen because it provides a way to quickly and easily build a working prototype that can be tweaked at will without a large commitment of resources. Because Python code is generally compact and easy to understand, it made it possible for team members from different backgrounds and departments within the business to review and contribute. As the software grew and was deployed to production (with a comprehensive test framework and an automated CI/CD delivery pipeline), Python proved to be reliable and flexible enough to take on all of the expected production load. With occasional small tweaks and performance improvements, the software has been able to handle all spikes and business-driven increases in traffic that have been thrown at it.
A further comprehensive suite of non-functional performance and reliability tests now ensure that the platform can safely handle at least an order of magnitude increase in the volume and frequency of requests it receives. The average response time for all API end-points exposed by the system is under 100ms, including network latency, data lookups and all the complex business logic that takes place under the hood.
More importantly, because well-structured Python code is easy to refactor and maintain, the entire platform was able to be developed, maintained and enhanced over the years with a team of no more than 5 core developers at any given time.
International on-line expansion
Around 2016, we further re-purposed the same platform for international use by Sky’s new on-line brand – NowTV. The software was enhanced to handle multiple currencies and support millions of new customers in new territories. Thanks to the agile, modular design of the software it was easy to implement significant functional and performance improvements to ensure the new brand could hit the ground running and meet growing on-line demand for OTT streaming media.
Following the success of the Product and Pricing Engine and the Catalogue Services components we created for Sky, our new role was to re-design, optimise and continuously enhance this solution to power all of commerce across multiple territories and partner channels for NowTV. We further created tailored tools in Python to migrate over 12 million existing UK customer accounts to the new platform.
The new, expanded software provides a dynamic view of NowTV’s product and offers catalogue, adjusted for any territory, sales channel, route to market, customer group or even for individual customers. It can also evaluate any target basket selection and determine the customer’s eligibility for all required products, as well as any applicable manually-selected or auto-applied offers. The APIs can then annotate the customer’s basket selection with the correct pricing information, discounts, credits, rewards, vouchers, recurring and non-recurring payments, legal key facts and the results of any other business rules that were applied.