BookmarkSubscribeRSS Feed

Capturing Intelligent Decisioning 5.4 Generated Code

Started ‎04-15-2020 by
Modified ‎04-15-2020 by
Views 5,484

SAS Intelligent Decisioning is a cool little tool with lots of deployment functionality built in. However, as you field workers know, it usually only takes about 5 minutes before your customer is asking to deploy decision logic in some novel and unsupported way. So how can we get decision and rule set generated code to incorporate in other applications like ESP, remote SAS servers, etc.?

 

Making the Call

For the purposes of this post, we're only concerned with extracting the generated decision code. So let's look at an example of the actual command used to extract the code:

 

https://intviya01.race.sas.com/decisions/flows/0b2a6c4f-afa3-4440-9705-16299cbc346c/code?codeTarget=...

As you can see, the command is a REST GET. It uses the Viya Decision Management REST API. Breaking the command into pieces, we can see how to use it:

 

  • Viya server: intviya01.race.sas.com (Not a real server name)
  • API Command: /decisions/flows/{Decision ID}/code
  • Decision ID: 0b2a6c4f-afa3-4440-9705-16299cbc346c
  • Options:
    • codeTarget: MICROANALYTICSERVICE
    • lookupMode: inline
    • isGeneratedRuleFiredColumn: false

 

For more information on the API and options, see the doc here and here. You can get the Decision ID from the Intelligent Decisioning User Interface (Decision --> Properties Tab) among other places.

 

The example above extracts the code from a Decision but you can also extract Rule Set code. A sample Rule Set code extraction call is below. Note the different URL path (/businessRules/ruleSets/😞

 

https://intviya01.race.sas.com/businessRules/ruleSets/a44445ab-3f65-4cc4-a206-bfe2e014e206/code?code...

Below is an example of the API command being rendered through Chrome and producing the decision code.

 

DS2Code.png

Select any image to see a larger version.
Mobile users: To view the images, select the "Full" version at the bottom of the page.

 

 

Authentication

Running the API command in Chrome as shown above will trigger the Viya UI login screen for authentication.

 

More information on authentication to Viya's REST API can be found here, https://blogs.sas.com/content/sgf/2019/01/25/authentication-to-sas-viya/.

 

Notes and Considerations

  • The code can be rendered a few different ways. Change the codeTarget between MICROANALYTICS and CAS and the lookupMode among format, inline, and package to see which variation suites your needs. The doc is here.
  • For most applications, you want to use lookupMode=inline as that puts all of the decision components in one file.
  • The Decision code will contain lots of extra supporting code components including logging and administrative functions
  • Intelligent Decisioning logic is rendered via SAS DS2 packages. The Decision itself as well as each individual component -- rule set, predictive model, custom code node -- will be defined as a package. The Decision package acts as a driver program calling the other packages. Branch logic is included in the main Decision package.
  • The generated code is intended to run in the codeTarget specified. Using it in any other platform or circumstance will likely require modification.

Search for more content from our group: SAS Global Enablement & Learning.

.

Version history
Last update:
‎04-15-2020 03:57 PM
Updated by:
Contributors

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Labels
Article Tags