Git Product home page Git Product logo

ravindersravi / business-rules-motor-insurance Goto Github PK

View Code? Open in Web Editor NEW

This project forked from higson-io/business-rules-motor-insurance

0.0 0.0 0.0 4.25 MB

Hyperon - Motor Insurance Demo App. This is a sample application to demonstrate capabilities of Hyperon.io library (Java Business Rules Engine (BRE)/Java Pricing Engine). The application demonstrates responsive quotations for Car/Motor Insurance based on decision tables and Rhino functions (for math calculations). It shows different possible business rules configuration and overall BRMS performance as well.

License: Apache License 2.0

Java 71.99% JavaScript 12.28% HTML 9.11% Dockerfile 0.39% Less 6.24%

business-rules-motor-insurance's Introduction

Business Rules for Motor Insurance / demo app

This is a sample application to demonstrate capabilities of Hyperon.io library (Java Business Rules Engine (BRE)/Java Pricing Engine).

The application demonstrates a typical sales path of insurance products, in this particular case Car/Motor insurance. The first step (left panel in this example) customer or agent provides all data required to calculate quotations. Each change in the input data on the left panel (eg. Drivers age/Drivers Sex/Number of accidents in the last 5 years) triggers recalculations for all coverages in 3 pricing options (Bronze/Silver/Gold). There is no need for the "Re-Calculate" button as calculations are made instantly which significantly improves UX for the final customer.

The right panel is completely configured in Hyperon, all the rules dictating what to offer in that case and for what price. It's done in different ways to show all capabilities of Hyperon.

You can see an example of making a decision based on parameters (decision tables), simple ones, and also forwarding decision to the next decision table - because this rule engine allows you to stack decision tables onto each other. There are also examples of making a decision based on functions. The Hyperon allows you to implement functions in Rhino (JavaScript) and Groovy languages. Although everything in the right panel needs to be calculated after a change in the left panel, it works smoothly because of the very high performance of Hyperon. All the configuration is clear and easy to understand because it is organized in the business domain. Each visible element is modeled as a business object with attributes. These attributes are rules. The sample application calls them and get's a ready decision about what to show in that particular case. After downloading this demo you should start with browsing "Domain configuration" in Hyperon and all the configuration should be clear for you within minutes.

There is a second similar demo of Hyperon built around vehicle insurance subject link it differs with data storage implementation. It uses Hyperon Persistance - dynamic data model. It's another layer of flexibility you can add to your Java application but it is completely optional as you can see in this example and you can use Hyperon without hyperon persistance.

If want to learn more about how to use Hyperon, check the Hyperon tutorials.

On-line demo

This application can be accessed on-line at: https://motor-insurance-demo.hyperon.io/

Prerequisites

Make sure you have at least:

Java 1.8

Maven 3.3

To install go to:

https://maven.apache.org/download.cgi

Previous Maven versions might work as well but this was not checked.

NodeJS 4.4.1

To install go to:

  1. Windows or Mac OS

  2. Linux

To update:

npm install npm@latest -g

Hyperon Studio 1.5.22

  1. Go to:

https://www.hyperon.io/docs/download

  1. download bundle, unpack it to the directory of your choice and run it as described here.

Setup

Make sure that both commands mvn and npm are accessible through system path. If not, add them.

In file hyperon-demo-app.properties set hyperon.database.url to point Hyperon Studio H2 database file, e.g.:

hyperon.database.url=jdbc:h2:/srv/hyperon-studio-1.6.50/database/hyperon.demo;AUTO_SERVER=TRUE;MVCC=TRUE;IFEXISTS=TRUE

or on Windows

hyperon.database.url=jdbc:h2:c:/hyperon-studio-1.6.50/database/hyperon.demo;AUTO_SERVER=TRUE;MVCC=TRUE;IFEXISTS=TRUE

Running

Execute below maven command to run Spring Boot.

mvn clean package
mvn spring-boot:run

Application will be accessible on port 48080. If you need to use other port change it in hyperon-demo-app.properties -> server.port. URL: http://localhost:48080/

Running with Docker

Motor-demo docker image is available on docker hub:

hyperonio/motor-demo:latest

However, if you want to build this app on your own, we've provided a necessary Dockerfile. Before building the docker image, you need to create an executable war by using the command:

mvn clean package -Pall_in_one

Then, to build a docker image execute the code below:

docker build -t hyperonio/motor-demo .

If image is build, then application can be run in docker container like:

docker run -p 38080:8080 
    -e mpp.database.url=<jdbc_url_to_running_db>
    -e mpp.database.dialect=<choose>
    -e mpp.database.username=<db_username>
    -e mpp.database.password=<db_password>
    -e mpp.environment.id=hyperon_docker
    hyperonio/motor-demo

OR application can be run with bundle-h2-demo and hyperon-studio images using docker-compose based on docker-compose.yml. Simply run:

docker-compose up
  • By default Hyperon Studio will be available at: [host]:38080/hyperon/app
  • By default Demo application will be available at: [host]:48080/demo
  • By default Runtime REST will be available at: [host]:8081/api

Executable war

Enable maven profile "all_in_one" to build fully executable war archive, eg.

mvn clean package -Pall_in_one

The resulting war archive can be executed from shell:

./target/motor-insurance-1.0-SNAPSHOT.war

For more details about Spring Boot executables refer to https://docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html

Configuration files locations

Configuration files are searched for properties in following order (last matching overrides):

  1. classpath:hyperon-demo-app.properties
  2. file:${user.home}/conf/hyperon-demo-app.properties

Feedback

If you have any feedback regarding this App or Hyperon.io library do not hesitate to contact: [email protected].

business-rules-motor-insurance's People

Contributors

arturosiak-decerto avatar czareko avatar dependabot[bot] avatar maciejglowka-decerto avatar marcinnowak79 avatar piotrmarciniak-decerto avatar piotrsikora-decerto avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.