Upgrade to Pro — share decks privately, control downloads, hide ads and more …

KieLive#24: DMN: squeeze the most out these features

KIE Community
February 09, 2021

KieLive#24: DMN: squeeze the most out these features

A pragmatic approach to Decision Management with DMN

Link to the live streaming: http://red.ht/KieLive24

KieLive#24: DMN: squeeze the most out these features

Decision Management is an important pillar of Business Automation and a key aspect of all Digital Transformation initiatives. DMN as an open standard is a very effective enabler of decision management both from a methodological but also pragmatic perspective, since the execution semantic is defined in the specification itself. We will delve into some key aspects of DMN in order to understand their characteristics, their advantages and limitations, and their best application in a cloud-native context too. This session is intended to provide interesting insights both to Business Analysts and Developers/Coders.

About the speaker:
"I contribute to the DMN execution engine used in Drools, Kogito and Red Hat Process Automation suite. I believe there is a whole new range of unexplored applications for Expert Systems (AI) within the Corporate business; additionally, I believe defining the Business Rules on the BRMS system not only enables knowledge inference from raw data but, most importantly, helps to shorten the distance between experts and analysts, between developers and end-users, business stakeholders."

Twitter: https://twitter.com/tari_manga

KIE Community

February 09, 2021
Tweet

More Decks by KIE Community

Other Decks in Technology

Transcript

  1. Cloud-native application development has become the preferred model for crafting

    the innovative applications required of digital transformation strategy. Modern programming techniques now exploit shared-distributed cloud architectures, portable container technology and discrete microservices designed to quickly assemble logic , automate processes and adapt when needed. — 451 Research, 2018
  2. AI = + + Extract information from data analysis Model

    the human knowledge and expertise Solve complex problems to better resources allocations + + “The Future of Enterprise AI and Digital Decisions” Machine Learning Digital Decisioning Maths Optimization Ref: Forrester Research, Inc., “The Future of Enterprise AI and Digital Decisions”, BRAIN 2019, Bolzano Rules and Artificial INtelligence Summit Sep 2019
  3. Decision Process Business Automation Mathematical Optimization Vehicle Routing // Socrates

    is human. session.insert(new Human("Socrates")); rule "All humans are mortals" when $h : Human() then insertLogical( new Mortal( $h.getName() ) ); end query "Is Socrates mortal?" Mortal( name == "Socrates" ) end
  4. • Formal methodologies and best practices ◦ Availability of books,

    training, best practices ◦ Availability of professionals, cost reduction • Tools to help with knowledge capturing/mining/modelling ◦ A common ground where IT and Business can meet and collaborate • Scalable, cloud based, dynamic runtimes ◦ Means to draw results from the join effort • Integrated BAM KPI monitoring and analysis for decision services ◦ Means to optimize and improve
  5. DMN, which stands for Decision Model and Notation, is a

    relatively new standard managed by OMG, the organization behind BPMN. … [DMN] is trying to do for Business Decision Management what BPMN did for Business Process Management a decade ago: empower the business to take charge of the logic that drives its operations, through a vendor-independent diagramming language. – Bruce Silver, http://methodandstyle.com/what-is-dmn
  6. • A standard for Decision Management from OMG • A

    sibling and complementary standard to BPMN (processes) and CMMN (case management) • Standardizes decision automation from modelling to execution
  7. • A standard with the potential to drive radical change

    in the DM market ◦ Similar to the impact BPMN caused on the BPM market 10 years ago • A complement to analytics and AI models in general: ◦ DMN integrates with analytic models and provides explainable white box decisions ◦ Important to meet requirements like GDPR compliance • A complement to blockchain smart contract implementations
  8. • DMN models are one of the supported Drools assets

    ◦ New capability behind the same API ◦ DMN and DRL overlap only for a subset of Drools features ◦ The strength of DMN lies on its standard language, business appeal, and ease of documentation • DMN focus on Decisions, not Rules • DMN models are stateless only ◦ Statefulness can be emulated by retaining state on the client See also https://stackoverflow.com/a/52343002/893991
  9. See also https://stackoverflow.com/a/52343002/893991 DMN DRL includes Decision Table paradigm ⬤

    ⬤ Stateless ⬤ ⬤ Stateful long-running sessions with mutability ◑ ⬤ CEP ◑ ⬤ a Standard notation ⬤ ◐
  10. kie-dmn-validation: static analysis toolings • validation of DMN against specification

    XSDs • static validation of DMN file ◦ e.g.: pre-compilation phase semantic validations (duplicate names, etc.) ◦ fun-fact: static validation is performed with… Drools rules! • compilation phase checks • decision tables static analysis ◦ implementing Method & Style checks ◦ semantic checks ◦ Hit Policy recommender ◦ MC/DC test case generator*
  11. Decision Table static analysis features • Table completeness ◦ no

    gaps in the rules • Table consistency ◦ overlaps properly handled by hit policy • Subsumption ◦ rules that could be combined • Rule masking ◦ in P tables where some rule is never the top priority • "Misleading rules" in P tables • Normalization checks • Consistent with DMN expectations ◦ imported ItemDefinition types ◦ null handling ◦ FEEL expressions in output ◦ etc. • Warns about enumerated columns • Consolidated user-friendly messages
  12. The same validation is interoperable from toolings, editors, to build

    systems Contraction: Rules [1, 3] can be combined for contraction by joining on input 1 Overlap detected: Overlap values: [ 660, "Bad" ] for rules: [2, 4]. UNIQUE hit policy decision tables can only have one matching rule. Gap detected: [ >660, "Fair" ]
  13. Another fun example: Misleading rule When this decision table results

    in “CHECK” ? Example taken from Vanthienen
  14. Another fun example: Misleading rule DMN: Rule 4 is a

    misleading rule. It could be misleading over other rules, such as rule: 2 Example taken from Vanthienen
  15. Hit policy recommender in a nutshell • If there are

    Gaps, no recommendations. • If No Gaps and no Overlaps: recommend UNIQUE where possible. • If No Gaps , but Overlaps with same output: recommend ANY • If No Gaps , but Overlaps with different output: recommend PRIORITY where possible
  16. • Principles for re-use: ◦ Import Decision Services, BKMs for

    decision logic re-use ◦ Import ItemDefinitions for data structure (dictionary) re-use • At the edge of (pure) functional approach: ◦ today’s date use-case ◦ send a notification/email (with BPMN) use-case ◦ message routing (with Apache Camel) use-case
  17. • Principles for re-use: ◦ Import Decision Services, BKMs for

    decision logic re-use ◦ Import ItemDefinitions for data structure (dictionary) re-use • At the edge of (pure) functional approach: ◦ today’s date use-case ◦ send a notification/email (with BPMN) use-case ◦ message routing (with Apache Camel) use-case
  18. from("direct:hl7") .bean(HL7RoutingEventParser .class, "buildRoutingEvent(${body})" ) .claimCheck(ClaimCheckOperation .Push) .process(toMap) .process(toDMNCommand) .to("kie-local://ksession1?channel=default")

    // Drools+DMN processing .process(dmnToHeader) .claimCheck(ClaimCheckOperation .Pop) .to("log:com.redhat.idaas?level=DEBUG&showAll=true&multiline=true" ) .transform().simple("${body.messageData}" ) .filter(simple("${header.topicsHeader} contains 'MMSAllADT'")) .to("kafka:MMSAllADT?brokers={{idaas.kafka.bootstrap}} ") .end() .filter(simple("${header.topicsHeader} contains 'MMSDischarges'")) .to("kafka:MMSDischarges?brokers={{idaas.kafka.bootstrap}} ") .end();
  19. • The OpenAPI Specification ◦ a broadly adopted industry standard

    for describing modern APIs • Out-of-the-box support for DMN ItemDefinitions, DMN evaluations • An API contract generated automatically from a DMN model • Can also be used to generate/stub clients with ease
  20. • Think decisions, not rules • Focus on communication, documentation,

    common language • Cost reduction: availability of professionals, books, training • No vendor lock-in: DMN standardizes syntax and semantics ◦ DMN TCK: https://dmn-tck.github.io/tck • Native cloud based deployment on OpenShift
  21. References: DMN Patterns For all levels: Medium/Advanced level: Y-Combinator with

    DMN/FEEL https://blog.kie.org/2020/04/functional-programming-in-dmn-it- feels-like-recursing-my-university-studies-again.html
  22. Resources https://youtu.be/zaTw1c5-47c https://youtu.be/EVXp2q_8yFw Drools featuring DMN support - https://drools.org/learn/dmn.html Learn

    DMN - http://learn-dmn-in-15-minutes.com Kogito - http://kogito.kie.org/ TrustyAI introduction: https://blog.kie.org/2020/06/trusty-ai-introduction.html TrustyAI introduction talk: https://www.youtube.com/watch?v=HdEwp2RhG7w Red Hat Business Process Automation: https://www.redhat.com/en/products/process-automation
  23. A pragmatic approach to Decision Management with DMN Abstract: Decision

    Management is an important pillar of Business Automation and a key aspect of all Digital Transformation initiatives. DMN as an open standard is a very effective enabler of decision management both from a methodological but also pragmatic perspective, since the execution semantic is defined in the specification itself. We will delve into some key aspects of DMN in order to understand their characteristics, their advantages and limitations, and their best application in a cloud-native context too. This session is intended to provide interesting insights both to Business Analysts and Developers/Coders. Speaker: Matteo Mortari I contribute to the DMN execution engine used in Drools, Kogito and Red Hat Process Automation suite. I believe there is a whole new range of unexplored applications for Expert Systems (AI) within the Corporate business; additionally, I believe defining the Business Rules on the BRMS system not only enables knowledge inference from raw data but, most importantly, helps to shorten the distance between experts and analysts, between developers and end-users, business stakeholders.