Skip to content

Rights availability computation service written in C++, for JSON based rights queries. (for the media industry), pre-release beta.

License

Notifications You must be signed in to change notification settings

phill-holland/the-rights-machine

Repository files navigation

The Rights Machine (pre-release BETA)

Rights Availability Reporting System.

When selling a particular asset, such as a TV programme and/or series a number of rights are attached to it detailing it's broadcast rights, for a fix period of time, within a given territory, language and transmission mediums (such as Live Broadcast TV, or Over the Internet, with services such as Netflix).

This system simplifies the concept of acquired rights, excluded rights and granted rights, reducing the problem to positive rights and negatives, all rights can be viewed as a function of either adding or removing rights, although the traditional notion can still be kept.

Presented here is a rights management system for the computation of those rights, allowing a person to quickly determine unexploited sales opportunities related to those assets, the system is designed to be fast at computing this information for a large number of assets, in bulk.

It is designed to be provided "as-a-service" inside the cloud and to be as simple to use as possible. Typical Rights Management systems come at great expense and unavailable at smaller scales to small/medium sized businesses, whilst also being largely restricted to the Media industry. The system presented here has also been designed to be flexible, allowing arbitrary rights assignments, with up to 10 components (typically these might include language, country, TX Methods, but are not limited to these, extra components can be added easily)

There is also potential for the this system to enable the development of a "real-time" broadcast TV channel, which can automatic calculate a broadcast schedule for a channel in seconds, without human intervention determined by it's rights availability and other statistics, such as popularity of a particular show, at the particular time of day.

Other applications are many beyond the Media industry, in-fact if you have a large number of digital assets that you sell globally (such as music and/or computer games) that may have a fixed term of sales (i.e. expires on a certain date, or in perpetuity) then this system would be useful to you.

This software is in the early stages of development (pre-release BETA), and requires more support and backing if it proves to be useful to a large group of people, whilst it functions correctly, it still lacks polish and scalability. This software has been written from scratch after 10+ years extensive experience working in the rights management software industry.

Summary of Features

  • 10 Rights Components per Rights Lines - Configurable to More
  • Interchangeable Computation Engines (from CPU to GPU when you're dealing with millions of lines of rights information)
  • Real-Time Computations (no need to wait for whole rights data to be transmitted, will be processed with a partial JSON file)
  • Switchable Rights Data Queue from In-Memory to In-Database.
  • Designed for High Performance
  • Capable of identifying rights opportunities not yet exploited

Usage

Whilst the system can be integrated into other systems via a Web Rest API, we wanted it to be accessible to all, no matter how big the company using it is, to this end, a spreadsheet has been provided with some sample data included, demonstrating it's use and configuration, you simply edit the data, and then in the menu bar, click Availability->Check, which should then refresh the "Results" worksheet. You can create rights queries using the "Queries" spreadsheet, using the rights data in the "Rights" worksheet.

Google Sheets Template

The google sheet version needs some back-end code to work (showing in the spreadsheet folder of this repo), which makes a remote call and posts all the data into the spreadsheet into the service hosted in the cloud.

Technical

Requirements

The system has been written entirely in C++ for maximum performance, it was originally designed to be compiled on a Linux based system (such as Ubuntu). In it's current form, it is very lightweight and does not require much resources. Although it has database support, this is not currently enabled within the current build of the code.

The installation example below also requires that docker and docker-compose is already pre-installed.

Rights are processed in an asynchronise manor, whilst loading a JSON data file stream into the service, it will not wait for the whole data file to be loaded, before it starts processing and returning results.

Installation

Inside this code repo is provided a Dockerfile and docker-compose.yaml for simplicity. Currently the spreadsheet examples are hosted on a remote server, but also be self-hosted for greater performance on your local network.

To start, at the terminal window in the pre-existing directory containing the docker-compose.yaml file, type;

docker-compose build
docker-compose up -d

This may take some time to complete, the docker file has two stages, the first stage is building the code inside the container, and then a second container is built with just the runtime within.

The code during build also installs a debian package, obtain from the PPA repo within this Github account.

There are also a number of VSCode support files provided (and a workspace file) including a devcontainer, which is recommended for editing the code.

Automated Testing

A set of tests are included in the code, supported by the google testing suite (they require a little work at the moment, with an async call needed to wait for the response from the server)

Manual Testing

Curl can be used to issue a simple test query to the service (or indeed Postman), as shown below;

curl --header "Content-Type: application/json"  --request POST --data-binary @body.json http://127.0.0.1:5454

For example queries, the json structure below (for a basic availability check) can be written to a file called body.json, for use with the example above (more example also available within the test/data directory);

{
	"task" :
	{
		"queries" :
		[
			{
				"start" : "2018-01-02",
				"end" : "2018-05-01",
				"components" :
				[
					{
						"name" : "country",
						"elements" :
						[
							{ "value" : "england" },
							{ "value" : "france" }
						]
					}
					,
					{
						"name" : "language",
						"elements" :
						[
							{ "value" : "english" },
							{ "value" : "french" }
						]
					}
				]
			}
		],
		"items":
		[
			{
				"name" : "myitem",
				"lines" :
				[
					{
						"start" : "2018-01-01",
						"end" : "2019-01-01",
						"exclusivity" : 0,
						"type" : 0,
						"components" :
						[
							{
								"name" : "country",
								"elements" :
								[
									{ "value" : "england" },
									{ "value" : "france" }
								]
							}
							,
							{
								"name" : "language",
								"elements" :
								[
									{ "value" : "english" },
									{ "value" : "french" }
								]
							}
						]
					}
					,
					{
						"start" : "2018-06-01",
						"end" : "2019-08-01",
						"exclusivity" : 0,
						"type" : 1,
						"components" :
						[
							{
								"name" : "country",
								"elements" :
								[
									{ "value" : "england" },
									{ "value" : "france" }
								]
							}
							,
							{
								"name" : "language",
								"elements" :
								[
									{ "value" : "english" },
									{ "value" : "french" }
								]
							}
						]
					}
				]
			}
		]
	}
}

Todo

  • Enabling SSL/Https Support
  • OAuth2 Username+Password Authentication
  • Load Balancing and Auto Scaling
  • CUDA Testing
  • Persistent Query Storage
  • NUGET Package for DOTNET
  • Add Configuration File
  • Benchmarking for performance logging

Support

If you find a problem, or a bug, feel free to contact me, but support is currently limited due to time constraints.

About

Rights availability computation service written in C++, for JSON based rights queries. (for the media industry), pre-release beta.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published