Real-Time Entity and Network Generation Action Set
Using the queryCompounds Action to Generate Entities and Networks for Specific Compounds
This section contains PROC CAS code.
Note: Input data must be accessible in your CAS session, either as a CAS table or as a transient-scope table. A CAS table has a two-level name: the first level is your CAS engine libref, and the second level is the table name. You refer to this table in the CAS procedure by specifying only the second level. For more information about two-level names, see Chapter 2, Shared Concepts (SAS Viya: Machine Learning Procedures). A transient-scope table is called directly from the action and exists in memory for the duration of the action. For more information about accessing data, see SAS Viya: System Programming Guide. For more information about PROC CAS and programming in CASL, see SAS Cloud Analytic Services: CASL Programmer’s Guide and SAS Cloud Analytic Services: CASL Reference.
This example illustrates how to use the queryCompounds action to generate entities and networks for specific documents. The example assumes that you have already run Example 32.2.
data mycas.query_compounds;
infile datalines dsd;
length compound_value $32. compound_type $32.;
input compound_value $ compound_type $;
datalines;
JAMES~MORRIS~11769, namedob
;
proc cas;
action rteng.queryCompounds / /* 1 */
compounds = {
{compoundValue="JAMES~MORRIS~11769" compoundType="namedob"} /* 2 */
}
/* compounds = {{name="query_compounds"}} 2 */
output = {name="query_compounds_out" replace=true} /* 3 */
outputCompoundValue = true /* 4 */
outputSubEntityId = true /* 5 */
softDeleteEntities = { /* 6 */
{
entityType="address" /* 7 */
temporalSplitting=true
hasAttribute={{attribute="role" value="business"}}
}
}
softDeleteLinks = { /* 8 */
{
documentType="claim" /* 9 */
entityType="individual"
hasAttribute={{attribute="role" value="supplier"}}
}
{
documentType="claim"
entityType="address"
hasAttribute={{attribute="role" value="supplier"}}
}
}
;
run;
quit;
Specific lines of the code (as numbered in the comments) are described as follows:
The
queryCompoundsaction from thertengaction set is being called.The list of compounds to query is specified; alternatively, a table that contains the compounds to query is specified.
The name of the output table that contains the networks is specified.
Setting the
outputCompoundValueparameter to TRUE results in the compound values being part of the output. This is useful for understanding why entities have formed and for understanding the data that are used to form them.Setting the
outputSubEntityIdparameter to TRUE results in the_subentity_id_column being included in the output. This is useful for understanding why an entity has been temporally split into multiple subentities.The list of entity soft-deletes is specified.
The address entity is soft-deleted when the role of the address is
business. Setting thetemporalSplittingparameter to TRUE indicates that this address can be temporally split. For this to work, thevalidFromandvalidToparameters must have been specified in the entity definition during thecreateCompoundStoreaction (see Example 32.1).The list of link soft-deletes is specified.
The link between the claim document and the individual entity is soft-deleted when the role of the individual in the claim is that the individual is the supplier.
Output 32.5.1 is the output table of the queryCompounds action. It contains a row for each compound that is formed on each network for the specific documents being queried. The compounds are grouped into entities; the grouping is denoted by the _entity_id_ variable. The links between entities and documents are grouped into networks; the grouping is denoted by the _network_id_ variable.
Output 32.5.1: queryCompounds Output Table
| _network_id_ | entity_type | _entity_id_ | _subentity_id_ | _soft_delete_ | document_type | document_id | record_id | compound_type | compound_value | ROLE | valid_from | valid_to |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | INDIVIDUAL | 1 | 0 | 0 | claim | CLAIM001 | CP101 | SSN | 12345 | CLAIMANT | . | . |
| 1 | INDIVIDUAL | 1 | 0 | 0 | claim | CLAIM001 | CP101 | NAMEDOB | JAMES~MORRIS~11769 | CLAIMANT | . | . |
| 1 | INDIVIDUAL | 1 | 0 | 0 | claim | CLAIM001 | CP101 | NAMEADDRESS | MORRIS~199 BISHOPSGATE~EC2M 3TY | CLAIMANT | . | . |
| 1 | INDIVIDUAL | 1 | 0 | 0 | claim | CLAIM004 | CP302 | SSN | 12345 | CLAIMANT | . | . |
| 1 | INDIVIDUAL | 1 | 0 | 0 | claim | CLAIM004 | CP302 | NAMEDOB | PHILLIP~MARTINEZ~9914 | CLAIMANT | . | . |
| 1 | INDIVIDUAL | 1 | 0 | 0 | policy | POLICY001 | POLICY001 | SSN | 12345 | 22MAY2018 | 15OCT2233 | |
| 1 | INDIVIDUAL | 1 | 0 | 0 | policy | POLICY001 | POLICY001 | NAMEDOB | JAMES~MORRIS~11769 | 22MAY2018 | 15OCT2233 | |
| 1 | INDIVIDUAL | 1 | 0 | 0 | policy | POLICY004 | POLICY004 | SSN | 98123 | 27OCT2014 | 15OCT2233 | |
| 1 | INDIVIDUAL | 1 | 0 | 0 | policy | POLICY004 | POLICY004 | NAMEADDRESS | MARTINEZ~45 RICHBORNE TERRACE~SW8 1AT | 27OCT2014 | 15OCT2233 | |
| 1 | INDIVIDUAL | 1 | 0 | 0 | policy | POLICY004 | POLICY004 | NAMEDOB | PHILLIP~MARTINEZ~9914 | 27OCT2014 | 15OCT2233 | |
| 1 | INDIVIDUAL | 2 | 0 | 1 | claim | CLAIM001 | CP103 | NAMEDOB | DOROTHY~GONZALEZ~9045 | SUPPLIER | . | . |
| 1 | INDIVIDUAL | 2 | 0 | 1 | claim | CLAIM001 | CP103 | NAMEADDRESS | GONZALEZ~JH AUTOS STRATTON DRIVE~SE25 3LS | SUPPLIER | . | . |
| 1 | INDIVIDUAL | 3 | 0 | 0 | claim | CLAIM001 | CP102 | SSN | 23456 | THIRD_PARTY | . | . |
| 1 | INDIVIDUAL | 3 | 0 | 0 | claim | CLAIM001 | CP102 | NAMEADDRESS | HARENBERG~406 ACRE LANE~SE15 3TY | THIRD_PARTY | . | . |
| 1 | INDIVIDUAL | 3 | 0 | 0 | claim | CLAIM001 | CP102 | NAMEDOB | STEVEN~HARENBERG~11045 | THIRD_PARTY | . | . |
| 1 | ADDRESS | 4 | 0 | 1 | claim | CLAIM001 | CP101 | STREETPOSTCODE | 199 BISHOPSGATE~EC2M 3TY | BUSINESS | 26APR2018 | 15OCT2233 |
| 1 | ADDRESS | 4 | 0 | 1 | claim | CLAIM001 | CP101 | STREETCITY | 199 BISHOPSGATE~LONDON | BUSINESS | 26APR2018 | 15OCT2233 |
| 1 | ADDRESS | 5 | 2 | 0 | claim | CLAIM001 | CP101 | STREETCITY | 136 BRIXTON ROAD~LONDON | RESIDENTIAL | 22MAY2018 | 15OCT2233 |
| 1 | ADDRESS | 5 | 2 | 0 | claim | CLAIM001 | CP101 | STREETPOSTCODE | 136 BRIXTON ROAD~SW9 7UP | RESIDENTIAL | 22MAY2018 | 15OCT2233 |
| 1 | ADDRESS | 5 | 2 | 0 | policy | POLICY001 | POLICY001 | STREETCITY | 136 BRIXTON ROAD~LONDON | 22MAY2018 | 15OCT2233 | |
| 1 | ADDRESS | 5 | 2 | 0 | policy | POLICY001 | POLICY001 | STREETPOSTCODE | 136 BRIXTON ROAD~SW9 7UP | 22MAY2018 | 15OCT2233 | |
| 1 | ADDRESS | 6 | 0 | 0 | policy | POLICY004 | POLICY004 | STREETCITY | 45 RICHBORNE TERRACE~LONDON | 27OCT2014 | 15OCT2233 | |
| 1 | ADDRESS | 6 | 0 | 0 | policy | POLICY004 | POLICY004 | STREETPOSTCODE | 45 RICHBORNE TERRACE~SW8 1AT | 27OCT2014 | 15OCT2233 | |
| 1 | ADDRESS | 7 | 0 | 0 | claim | CLAIM001 | CP102 | STREETCITY | 406 ACRE LANE~LONDON | RESIDENTIAL | . | . |
| 1 | ADDRESS | 7 | 0 | 0 | claim | CLAIM001 | CP102 | STREETPOSTCODE | 406 ACRE LANE~SE15 3TY | RESIDENTIAL | . | . |
| 1 | ADDRESS | 8 | 0 | 1 | claim | CLAIM001 | CP103 | STREETCITY | JH AUTOS STRATTON DRIVE~LONDON | SUPPLIER | . | . |
| 1 | ADDRESS | 8 | 0 | 1 | claim | CLAIM001 | CP103 | STREETPOSTCODE | JH AUTOS STRATTON DRIVE~SE25 3LS | SUPPLIER | . | . |
Using the queryCompounds Action to Generate Entities and Networks for Specific Compounds
This example is not available for the Lua programming language.
Using the queryCompounds Action to Generate Entities and Networks for Specific Compounds
This example is not available for the Python programming language.
Using the queryCompounds Action to Generate Entities and Networks for Specific Compounds
This example is not available for the R programming language.