Carbon Overview | → Portal |
Carbon is a set of libraries by Red Centre Software that allows software developers to easily embed cross-tabulation functionality in their own applications. The powerful cross-tabulation engine that drives Red Centre Software's showcase product Ruby has been lifted out of Ruby and converted into a set of general purpose libraries that can be consumed by a variety of application types on different platforms.
Carbon inherits from Ruby the high-end professional cross-tabulation features that are unequalled in competitive products. Carbon can perform data exchange in a variety of popular standard formats and it can tabulate huge amounts of data and variables into reports while applying filters, weights, nesting, significance, bases, and many other advanced options.
The Carbon libraries are available as public NuGet packages for developers using the .NET platform, and a C++ library is available for special usage scenarios (discussed below). Carbon can be used immediately without any account registration, but there is a limit of 1,000 cases and 500 variables when using the 'free' account. This limit should be high enough to allow analysis of moderate amounts of data in realistic usage scenarios. Carbon is capable of processing very large amounts of complex data, and an account must be created to unlock this capacity. Registered accounts are provided with technical support, DP support and a quota of cloud storage. For more information see the Pricing section on the company Carbon product page.
Using some NuGet packages and a relatively small amount of code, developers can add cross-tabulation
functionality to their applications. The report output can be presented in desktop applications using
the most appropriate techniques, or services can deliver the output to remote clients such as web browsers.
|
The expanding reach of the .NET Framework from Windows® into the macOS, Linux and UNIX operating systems means that developers on all of those systems can develop scripts, services and applications that expose cross-tabulation functionality.
The following left screenshot shows cross-tabulation results being displayed by a UNIX command line application. The right screenshot shows a native macOS desktop app displaying plain text output. In a production app, Mac developers would feed the report output into a native control of their choice for attractive presentation.
Command line on UNIX |
macOS Window |
The following left screenshot shows a csx script running in the Windows command prompt to generate multiple reports and merge and save them as a HTML page. The right screenshot shows plain text output in a WPF desktop program, which in production would use a grid or similar rich UI control to display the report results.
csx script on Windows |
Windows WPF application |
The Carbon engine can be used in a variety of application types and hosting environments and it can generate cross-tabulation reports in a variety of formats such as TSV, CSV, XML, HTML, JSON and XLSX (Excel workbook). This overall flexibility enables some interesting usage scenarios.
Carbon reports can be fed into rich UI controls in desktop applications to produce attractive table and chart presentations.
Carbon can produce JSON which is in the exact shape required by the Python pandas library to create dataframes which can then be passed into many of the data visualisation packages available in the Python ecosystem (discussed below).
Carbon provides methods to save and reload its internal state, so that it can be used efficiently inside high-demand and high-concurrency environments like operating system services or web services. These services could be used to provide cross-tabulation reports to remote apps.
Carbon provides a large API that can be used to build complex apps around cross-tabulation. It's possible to list and manage jobs, saved reports, variables and everything that is composed to make a job. Apps can use this information to create a full suite of functionality that helps users compose, run and manage cross-tabulation reports.
The following projects are available GitHub as examples for software developers who want to write apps that call Carbon.
Carbon.Example.Command A simple command line Visual Studio project containing the minimum code required to generate a Carbon cross-tabulation report. | |
Carbon.Example.Desktop A reasonably sophisticated Visual Studio WPF desktop project that exercises a large surface area of the Carbon API to demonstrate the management of jobs and reports. |
The Carbon libraries can be called from many of the .NET platform scripting hosts that are available such as rcsx.exe from Red Centre Software, dotnet-script, Visual Studio Code, Visual Studio and notepad++. Data processing professionals can utilise the power of scripting to perform bulk data transformation and reporting.
For more information see:
Scripting Overview An overview of how C# scripting support can be installed. The different types of scripting hosts are explained and compared. | |
Introduction to the RedCentre Carbon Libraries and Applications Instructions on how to install the standard folders of scripts, apps, tools and data provided by Red Centre Software. Many sample scripts are provided, as well as the rcsx.exe script runner and the powerful Diamond desktop application. | |
Carbon Scripting A detailed discussion of how the customised rcsx.exe script hosting command can be used to automate common data processing and reporting tasks. | |
Scripting Samples A GitHub project containing set of application agnostic sample scripts that call Carbon. These scripts are designed to be run via the dotnet-script hosting tool. |
An alternative to running C# scripts from the command line as described in the previous section is run them in notebooks inside Visual Studio Code.
Notebooks are documents that contain a mix of rich Markdown, executable code snippets, and accompanying rich output. These are all separated into distinct cells and can be interleaved in any order. Notebooks effectively provide a way to run scripts in a rich GUI.
Carbon.Example.Notebooks-CS A GitHub project containing a set of C# interactive notebooks with code and commentary that demonstrate how to call the Carbon API. |
The core crosstab engine functionality of Carbon is available in a Windows library authored in the C++ language. Following casual IT naming conventions, this library is often referred to as the native Carbon library to indicate that it not interoperable with the other NuGet provided Carbon libraries which are referred to as the managed Carbon libraries.
The native Carbon library has slightly reduced functionality compared to the managed set, and it can only be used on the Windows operating system, but it is specifically designed to be used in special hosting environments where only native libraries can be used. The power of the native Carbon library can be unleashed in VBA code in the modern Microsoft Office suite. It is possible to write VBA code in Excel that imports data from external sources or worksheets, runs cross-tabulation and delivers the results directly into workbooks cells. This technique can be used to create complex interactive dashboards inside Excel.
For more information on the Carbon native library see:
Carbon C++ Engine API A technical discussion of the API of the C++ Carbon library. |
The Carbon API includes some methods that are designed to be easy to call from Python applications. The Python language community contains many dedicated groups involved in data processing and visualisation, and Carbon provides a way for them to add cross-tabulation processing that is far more powerful than what is available in standard Python packages.
Carbon can transform JSON data series through cross-tabulation processing and return JSON results in the shape of pandas dataframes which can then be fed into other popular Python packages to generate charts or specialised reports. As a simple example, the following data could be input to Carbon:
{ "top": [ "Female", "Male", "Male", "Male", "Male", "Female", "Female", "Male", "Male", "Female" ], "side": ["30", "64", "30", "18", "30", "64", "30", "79", "64", "19" ] }
Carbon would return JSON in dataframe format that would print like this:
Female Male 30 2 2 64 1 2 18 0 1 79 0 1 19 1 0
The Python and .NET software development platforms and runtimes are significantly different, so special programming techniques are required to bridge the two platforms.
Red Centre Software has experimented with the pythonnet package which allows Python code to directly interoperate with the .NET 4.0+ CLR. However, fragile assembly version dependencies in .NET 6.0 combined with the need for binding redirects caused research to suspend in favour of using a web service as the platform bridge.
Red Centre Software has published a web service that exposes Carbon functionality to remote clients using the exchange of standard REST style messages. Python clients can invoke the web service endpoints using the requests package. Other languages can use the web service using whatever techniques are suitable for their software platform.
For more information helpful to Python clients see:
Carbon.Example.Notebooks-Python A GitHub project containing a set of Python interactive notebooks with code and commentary that demonstrate how to call the Carbon API through a REST style web service. |
Note that the web service published by Red Centre Software is experimental and is being used for development and demonstrations. The service may move or be renamed at an unpredictable future time. Full Swagger generated service documentation can be found at this address:
https://rcsapps.azurewebsites.net/carbon/swagger/
Return to the Development Portal
Last updated: 02-Nov-2022