Excel is great for collecting data. But once things get more complicated, you may be asking "what next"?
- Your Excel calculations are good. Maybe too good - now you can't follow what is going on. Wouldn't something a little bit clearer be better?
- Are you sharing your spreadsheets? What if somebody changes a formula without you noticing?
- Your business absolutely needs to be sure the rules are being applied - and you need a way of checking what those rules are later.
- You need to extract information from Excel to feed into Machine Learning pipelines, but have no easy, robust way to do it.
Powered by KIE from IBM and RedHat Drools, Red-Piranha allows you to state your Excel business rules in a simple when ... then format that everybody can understand. It acts as a bridge between Excel / Microsoft Office and Business Rules and workflow Engine (including AI and Planner) from Red Hat.
Instead of having your knowledge 'disappear' into complicated formulas that you can't read, a Rules Engine keeps things in a simple 'English' like format. Even better, because of the way it works 'under the covers' it is faster and more powerful than code translated into a technical language.
While you don't need the books to use Red Piranha (or vice versa), both talk about the same problem; Rules Based AI, and applying these business rules to your Excel Data. Both are from Packt Publishing..
A business rule is a simple statement that represents some important aspect of a business. By capturing the rules for your business --the logic that governs its operation-- you gain the ability to create systems fully aligned with your business needs.
All people have business rules. Examples of a 'real' busniess rules that can be fed into the engine are:
When the market rises by more than 25%, Then sell the stockWhen the total is less than €100 And the claimant is low risk Then transfer the funds
Because business rules can be written in 'near English' language they are much more meaningful to non-technical domain experts. In this format, the knowledge they contain is easier to manage, maintain and share. They also carry the advantage of separating the meaning of the business from the actual technical implementation.
By default, KIE and Drools doesn't read in Excel Data. Red Piranha fills in this gap with:
- A user Interface to run the rules from your desktop / web browser
- Conversion of your Excel Data into a format the rule engine can read.
- Applies Rules based AI to your Excel Data.
- Conversion of the outout back into a (different) Excel file or other format.
- Samples to get your started.
- Information to show you what is going on within the Rule Engine.
- View in your favourite browser
- Running on Localhost (your local machine)
- Current Settings - shows the current input file, the rules being applied to it, the output file.
- Samples to help you get started.
- Progress messages - did the rules run successfully?
- More detailled messages from within the Rule Engine
- Information from Input files - what our co nversion from Excel into Java Objects looks like.
- Information output - what the information coming out of the rule engine looks like before we save it as Excel.
It is also possible to run the project in GitHub Code spaces.
- Click on the blue
codebutton above - Select the
Codespacestab. - Select the button to
Create Codespace on main
The Project follows a standard structure, using the Spring Boot Framework and the Maven build tool. So if you're a Java developer, it's pretty easy for you to download and run.
- Download and install Java
- Download and install Apache Maven
- Download (or checkout) the code from this GitHub Repository, unzip it if needed.
- Open the
codefolder within this project in a console / terminal. You'll know you're in the correct place if you see apom.xmlfile. - Start the application using
mvn spring-boot:run - Open a Browser and point at
http://localhost:7000/
Samples are integrated into the page at this link - so take a look at them as a next step.
Once the VSCode Editor and Terminal is open in your browser, follow the laptop instructions above from step 3.
If you're into Docker, a packaged example is available on Dockerhub. https://hub.docker.com/repository/docker/paulbrowne/redpiranha
When running the image, map port 7000, so that you can connect your browser to the application running within docker.
The docker build is not yet automated, so could be slightly (or a lot) behind the code in this repository.
Opening the Red Piranha webpage (normally at http://localhost:7000/) will show a list of ready to go samples.
Each of the samples has a readme.html to explain what the sample is showcasing. If you want to open in your editor, these are located in code/src/main/resources/examples .
- Sample 1 - a simple hello world
- Sample 2 - slightly more sophisticated example with rule based decision making
- Sample 3 - making decisions on Excel data using a graphical decision model (DMN)
- Sample 4 - Complex Excel document, extracting data using named ranges and rule based validation, output to a single CSV file
- Sample 5 - Multiple Excel documents in one folder, extracting data using named ranges and rule based validation, output to a single csv file
After running
The top part of screen will alter - showing the base directory, input file, business rules, DSL (Language mapping) and output file used.

The bottom part of screen will also update - it will show messages as the sample runs, and a snapshot of the data before and after the business rules (to allow you to write your rules).

- For longer running examples (e.g. Example 5) it is sometimes better to run them without the web interface.
- Passing the example number into the application will run the
example as listed in
èxamples.json. - For example
mvn spring-boot:run -Dspring-boot.run.arguments=--examples=5will run the fith sample.



