View this page in the latest version of Appian. Use Models in a Process Share Share via LinkedIn Reddit Email Copy Link Print On This Page The capabilities described on this page are included in Appian's advanced and premium capability tiers. Usage limits may apply. This page describes how to integrate an AI-powered document extraction model into another process model within your Appian application. Integrate extraction into your process model Once you've built and tested a document extraction model, you can integrate it into an existing process model. At a high level, you'll complete the following steps: Set up record types. Create or update your process model. Integrate reconciliation tasks. Add a trigger to your DocCenter extraction model. Test and deploy. Step 1: Set up your record types To be useful, extraction results must be saved to your data fabric. To do this, set up record types to save those results from DocCenter. These record types also serve as the basis of reconciliation tasks, so it is essential to structure data in logical ways. Tip: Throughout these instructions, we use insurance loss runs as an example. Loss runs summarize a policyholder's claims history and often contain both header-level policy information and tabular claims data. The record type names and fields below are suggestions, which you can adapt to your own application or use case as needed. First, you create two record types: Record type to store your document, fields, and the associated extraction instance (e.g. ABC Loss Run), containing these fields: id Primary key; Number (Integer) appianDocumentId Number (Integer) extractionInstanceId Number (Integer) insuredName Text accountNumber Text policyNumber Text brokerCompany Text policyTerm Text printDate Date lossRunDate Date Record type to store individual claims (tables) in the loss run (e.g. ABC Loss Run Claims), containing these fields: id Primary key; Number (Integer) lossRunId Number (Integer) claimNumber Text dateOfLoss Date status Text lossPaid Number (Decimal) expensePaid Number (Decimal) lossReserve Number (Decimal) expenseReserve Number (Decimal) totalIncurred Number (Decimal) claimType Text lossType Text lossDescription Text location Text You'll add record type relationships to show connections between record types, and make it easier to reference the data in those related record types. You can add relationships when you set up your data model or afterward. Tip: If your application manages documents in the context of cases or other record types, consider creating additional fields and relationships to associate those record types with these new record types. Loss runs typically contain tabular claims data with multiple claims per document. The second record type captures this table structure, allowing you to extract and store each individual claim from the document. Create the following record type relationships. These instructions use the example record type names listed above. Replace these names with the ones you've chosen for your new record types: In the document record type (ABC Loss Run), add two relationships: Add a relationship with AIA Extraction Instance (a record type within the DocCenter application): Relationship Type: One-to-one ABC Loss Run - extractionInstanceId AIA Extraction Instance - id Add a relationship with ABC Loss Run Claims: Relationship Type: One-to-many ABC Loss Run: id ABC Loss Run Claims: lossRunId Allow this record type to write and delete related records In the extracted fields record type (ABC Loss Run Claims), add one relationship: Add a relationship with ABC Loss Run: Relationship Type: Many-to-one ABC Loss Run Claims: lossRunId ABC Loss Run: id Tip: Although ABC Loss Run has a relationship to AIA Extraction Instance, you don't need to create the same relationship in the AIA Extraction Instance record type. We recommend you don't edit AIA Extraction Instance record type at all. Your data model should resemble this diagram: Step 2: Create or update your process model Now that you've created some supporting design objects, you're ready to put them together in a process model. After you work through the steps in this section, your process model will look something like this: Scroll or drag to pan · ⌘+/⌘− to zoom · Esc to close This section walks you through how to: Create process variables. Configure a start form. Add extraction as a subprocess. Optional: Retrieve multiple extraction instances. Create a subprocess to map extracted data. Call the subprocess from the parent process model. To begin, create a new process model or open an existing process model where you want to integrate extraction. Create process variables Once you create a process model, you'll need to create process variables to pass data. Variable name Type Value Parameter? Required? Multiple? Hidden? cancel Boolean - Yes No No No document Document - Yes Yes No No extractionInstance AIA Extraction Instance (Record Type) - No N/A No No lossRun ABC Loss Run (Record Type) - No N/A No No usageGroup Group - Yes No Yes No Create the usageGroup variable only if you attribute AI action consumption to your own Appian groups. See Attribute AI action consumption to a usage group. Configure a start form In this example, documents are passed into the process model through a start form. Regardless of how you configure document ingestion, pass the document ID to the process model and map it to pv!document. Add extraction as a subprocess In the palette, find the subprocess node. Drag the node to the canvas and drop it after the Start Node. Open the subprocess properties. Click the Setup tab. In the Run this process model field, select the AIA Extraction Run Model Version process model. Configure the Input Variables as follows: Variable Description Required? document (Document) Map with pv!document. If running a multi-node instance (MNI), use pv!document[tp!instanceIndex] to explicitly index the array. Although Appian automatically indexes an array input to a non-array subprocess parameter, using tp!instanceIndex is recommended as a best practice. Yes input (Text) Leave empty. No isDocumentTestCase (Boolean) Leave empty. No modelKey (Text) Key for extraction model Yes – this value is set when you create an extraction model. For example: "lossRunExtraction". You can also view the model key on the Update Details screen. modelSuiteId (Number (Integer)) Leave empty. Used only when triggering test runs of the model. No modelVersionId (Number (Integer)) Leave empty. Version ID for extraction model. No testRunProcessId (Number (Integer)) Leave empty. Used to manually choose which version of the model to run. When left blank, uses the latest published version. No usageGroups (Group) Optional. Accepts multiple groups. Appian groups to attribute this execution's AI action consumption to. DocCenter adds the groups you pass alongside the AIA All Users system group. Available in DocCenter 4.4 and later. See Attribute AI action consumption to a usage group. No Configure the Output Variables as follows: Variable Map To extractionInstance ExtractionInstance Note: When using MNI to process multiple documents, do not rely on the subprocess output variable to return all extraction instances. Instead, use a script task immediately after the extraction subprocess to query for the newly created extraction instances. See Optional: Retrieve multiple extraction instances for details. Click OK. Attribute AI action consumption to a usage group A usage group is an Appian group that can be passed into AI calls so that the resulting AI action consumption is recorded against that group. Passing usage groups is optional and is available in DocCenter 4.4 and later. Pass the usageGroups parameter when several business units share one extraction model and each unit's AI action consumption must be reported separately. DocCenter adds the groups you pass alongside the AIA All Users system group that every DocCenter AI call carries. A common pattern is to attribute consumption to the group that invoked the work. For example, a submission intake application passes the group for the team that owns each submission, so a single loss run extraction model reports consumption separately for commercial lines and personal lines. To attribute all consumption from one model to the same business unit, pass a constant instead. If you pass no usage groups, DocCenter records the consumption against the AIA All Users system group only. To attribute consumption from a classification model, pass usageGroups to the AIA Classification Run Model Version process model the same way. Confirm DocCenter applied the usage groups After you run a document through the process model, check that DocCenter recorded the groups you passed: In the Extraction page group, click Instances. Click the name of the instance you ran. Go to the AI Usage tab. Review the tags beside each AI call name, such as Text Bounding Boxes or Extraction. Each AI call shows the usage groups DocCenter recorded for it. Classification instances display usage group tags the same way. In the Classification page group, click Instances, click an instance, and go to the AI Usage tab. If a call shows only AIA All Users, the process model passed no usage groups for that execution. DocCenter also records usage groups in the AI audit log. Optional: Retrieve multiple extraction instances If you are processing multiple documents using multi-node instances (MNI), add a script task immediately after the extraction subprocess to query for the newly created extraction instances. This is the only reliable method to collect all extraction instances, since MNI output mapping only returns a single result. To retrieve extraction instances: In the palette, find the Script task. Drag the node to the canvas and drop it after the extraction subprocess. Click the Data tab and select Outputs. Click New Custom Output. For Expression, create an expression that queries for the extraction instances associated with your documents. For example, query the AIA Extraction Instance record type, filtering by the document IDs you submitted for extraction. In the Target field, select the extractionInstance process variable. Click OK. Create a subprocess to map extracted data To help keep the parent process tidy, we recommend creating a new process model for the next few steps. This process model will be added as a subprocess to the overall process model you worked on in the previous steps. For demonstration purposes, we'll call this second process ABC Map Extracted Loss Run Data. Create process variables Create the following process variables to pass data to and from the parent process: Variable name Type Value Parameter? Required? Multiple? Hidden? extractionInstance AIA Extraction Instance (Record Type) - Yes N/A No No lossRun ABC Loss Run (Record Type) - Yes N/A No No Map extracted data In your process, add a script task to cast the extracted data to your record fields. You'll leverage the expression rule rule!AIA_API_Extraction_ConvertInstanceIdToMap, which is included with the DocCenter application. In the palette, find the Script task. Click the Data tab and select Outputs. Click New Custom Output. The Expression Properties for the node output display. For Expression, open the expression editor to create an expression to cast data to the record type: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 a!localVariables( local!fields: rule!AIA_API_Extraction_ConvertInstanceIdToMap(pv!extractionInstance[recordType!AIA Extraction Instance.id]), recordType!ABC Loss Run( recordType!ABC Loss Run.id: /* The ID field uses logic in this expression so you can use this subprocess to map data during initial extraction or after reconciliation. */ a!defaultValue( /*on initial extraction, lossRun can be passed in directly from parent process*/ value: pv!lossRun[recordType!ABC Loss Run.id], /*on trigger, query for existing record using the Appian document id*/ default: rule!SHRD_UTIL_QueryRecord( recordType: recordType!ABC Loss Run, returnType: "SINGLE_OBJECT", filters: a!queryFilter( field: recordType!ABC Loss Run.appianDocumentId, operator: "=", value: pv!extractionInstance[recordType!AIA Extraction Instance.documentId] ) )[recordType!ABC Loss Run.id] ), recordType!ABC Loss Run.extractionInstanceId: pv!extractionInstance[recordType!AIA Extraction Instance.id], recordType!ABC Loss Run.appianDocumentId: pv!extractionInstance[recordType!AIA Extraction Instance.documentId], recordType!ABC Loss Run.insuredName: local!fields.insuredName, recordType!ABC Loss Run.accountNumber: local!fields.accountNumber, recordType!ABC Loss Run.policyNumber: local!fields.policyNumber, recordType!ABC Loss Run.brokerCompany: local!fields.brokerCompany, recordType!ABC Loss Run.policyTerm: local!fields.policyTerm, recordType!ABC Loss Run.printDate: local!fields.printDate, recordType!ABC Loss Run.lossRunDate: local!fields.lossRunDate, /* leverage the record type relationship to create claim records for each table that was extracted. */ recordType!ABC Loss Run.abcLossRunClaim: /* loop through each table that was extracted and map it to the ABC Loss Run Claim record type fields */ a!forEach( items: local!fields.claims, expression: recordType!ABC Loss Run Claims( recordType!ABC Loss Run Claims.lossRunId: pv!lossRun[recordType!ABC Loss Run.id], recordType!ABC Loss Run Claims.claimNumber: fv!item.claimNumber, recordType!ABC Loss Run Claims.dateOfLoss: fv!item.dateOfLoss, recordType!ABC Loss Run Claims.status: fv!item.status, recordType!ABC Loss Run Claims.lossPaid: fv!item.lossPaid, recordType!ABC Loss Run Claims.expensePaid: fv!item.expensePaid, recordType!ABC Loss Run Claims.lossReserve: fv!item.lossReserve, recordType!ABC Loss Run Claims.expenseReserve: fv!item.expenseReserve, recordType!ABC Loss Run Claims.totalIncurred: fv!item.totalIncurred, recordType!ABC Loss Run Claims.claimType: fv!item.claimType, recordType!ABC Loss Run Claims.lossType: fv!item.lossType, recordType!ABC Loss Run Claims.lossDescription: fv!item.lossDescription, recordType!ABC Loss Run Claims.location: fv!item.location ) ) ) ) Click SAVE AND CLOSE. In the Target field, select the lossRun process variable. Click OK. Call the subprocess from the parent process model After you save and publish the subprocess to map extracted data, you need to call it from the parent process. Return to the parent process which you began editing in step 1. In the palette, find the subprocess node. Drag the node to the canvas and drop it after the Start Node. Open the subprocess properties. Click the Setup tab. In the Run this process model field, select the process model you created in the previous step (ABC Map Extracted Loss Run Data). Configure the Input Variables as follows: Variable Process variable extractionInstance pv!extractionInstance lossRun pv!lossRun lossRunClaims pv!lossRunClaims Click OK. Step 3: Determine when and how you want to reconcile results To help ensure accuracy, you may want to build reconciliation tasks into your document extraction workflow. After reconciliation, model accuracy and other performance metrics are updated at a field, document, and model version level. Reconciliation is only needed if an extraction instance has a status of Extracted with Errors, or if a user identifies incorrect data during downstream processing. DocCenter includes a Reconcile Fields related action on the AIA Extraction Instance record type to reconcile results. You can launch this action as a related action on the instance within DocCenter. If you prefer, you could also add the related action to any interface you choose. For example, you might find it useful to create an interface that shows only instances that contain errors in their extractions. A separate interface could be useful to help surface extraction instances requiring reconciliation within the application or workflow reviewers are completing work. Step 4: Add a trigger to map reconciled fields Finally, you'll add a trigger to automatically map and write the reconciled values to the ABC Loss Run record type. In DocCenter, go to Extraction > Models. Select the model you're using to extract data. Go to the Triggers tab. Click CREATE TRIGGER. In the Run this process model field, select the process model that maps reconciled data and writes to your record type. For example, your process model might use the Write Records smart service. If you want to initiate other downstream workflows following reconciliation, you can add additional triggers. Triggers are useful to start other processes that rely on the reconciled data, such as sending claims information to an underwriter for review or flagging high-severity claims for further investigation. Optional step: Add downstream processes Document processing often fits in the context of a broader process model. For example, after data is extracted from a loss run, that data may be used to start related processes, like assessing risk for policy renewal, flagging claims that exceed a threshold for underwriter review, or generating a summary report for the broker. How you integrate a downstream process is unique to your business. You can integrate additional processes as subprocesses, especially if you want to use unreconciled data. If you plan to leverage reconciled data in a downstream process, use additional triggers to easily and automatically start a process after the reconciliation task is complete. Step 5: Test and deploy Remember to test your process model thoroughly before deployment to ensure it works as expected. Once finished, deploy your models to higher environments. Feedback Was this page helpful? SHARE FEEDBACK Loading...