In the second flow, we will submit documents that will be processed and the extracted contents stored in an Amazon Bedrock Knowledge Base, to create a Retrieval Augmented Generation (RAG) database. We will then build a Bedrock Agent to process an insurance claim. The agent will use Generative AI to determine the eligibility of the claim, and update the claims database.
You have now completed the install and setup of the solution to process Insurance Claims. Our deployed solution has the components shown. If you have not completed this step, please go back and complete the deployment steps here before proceeding.
BDA is a generative-AI powered capability of Amazon Bedrock that enables you to automate your end-to-end Intelligent Document Processing (IDP) workflows quickly, accurately and at scale. A blueprint is a structural representation of your desired output for a specific document type (e.g. invoices, drivers licenses or IRS form 1099-INT). We then feed new unseen documents into the solution, for BDA to detect the document type, apply the correct blueprint and send the extracted results for downstream processing.
We now need to populate the knowledge base with the content from our claims Evidence of Coverage documents. There are sample documents available in the path assets/data/claims_review/eoc
. We can use the claims-cli command-line interface add these document to the claims EOC knowledge base.
More details - Sync your data with your Amazon Bedrock knowledge base
Note
Before continuing:
- Ensure you are in the root directory of this repository which is
guidance-for-multimodal-data-processing-using-amazon-bedrock-data-automation
- Ensure you have the python virtual environment still active. See Create and activate a virtual environment
Run the following commands to add each of the EoC documents to S3 and start the ingestion process
./claims-cli.sh upload-eoc-document --file assets/data/claims_review/eoc/Evidence_of_Coverage_-_FakeHealth_Standard.pdf
./claims-cli.sh upload-eoc-document --file assets/data/claims_review/eoc/Evidence_of_Coverage_-_FakeHealth_Plus.pdf
./claims-cli.sh upload-eoc-document --file assets/data/claims_review/eoc/Evidence_of_Coverage_-_FakeHealth_Premium.pdf
The output shows the Ingestion process starting and completing.
In this step, we will use Bedrock in the AWS Console to view and access the Insurance EOC Knowledge Base. We will use the console to issue prompts
-
Open the Amazon Bedrock Console and Click on
Knowledge Bases
underBuilder Tools
in the the sidebar to navigate to the Knowledge Bases view -
In the Knowledge Bases view, select the Knowledge Base named
claims-eoc-kb
and click onTest Knowledge Base
-
In the
Test Knowledge Base
pane on the right side of the page, Click Select model, select a model of choice from the available models and Click Apply.
Note
Choose the model of your choice and please follow the model provider acceptable end user policy. Results will vary based on the foundational model chosen
- With the model selected, we are ready to test our Claims Evidence of Coverage knowledge base. You can ask a question in natural language to retrieve relevant response. For example
What are the treatments covered under the Premium Plan?
-
The Knowledge base retrieves the relevant EoC document for the Premium plan and responds to the question
We will now submit a new lending application to BDA. BDA will process the insurance claim, and check for coverage against the EOC documents in the Knowledge Base.
We can use the claims-cli again to do this. A few sample claims forms are available in assets/data/claims_review/cms_155
- Upload a claim form using the cli. Keep a note of the
claim-reference-id
in the output
./claims-cli.sh submit-claim --file assets/data/claims_review/cms_1500/sample1_cms-1500-P.pdf
When the form is succesfully uploaded, the cli outputs a success mesage with a unique claim reference id
- Wait for a few minutes and check the claim output using the cli.
Keep a note of the
claim-reference-id
in the output
./claims-cli.sh view-claim-output --claim-reference-id <<claim_reference_id_from_step1_output>>
An example output (screenshot below) of the command lists the summary of the automate review performed by the Bedrock Agent
Note
Results will vary based on the foundational model chosen
- We can also look at available claim reference ids using the cli
./claims-cli.sh list-claims
Error: Claim output not found for claim reference ID: <<claim_reference_id>>. Please try again later when trying to view claim output in Step 2
This means an error in the claims review process. We can look at CloudWatch Logs to identify the root cause of the error
- View and analyse log stream for the BDA invoke automation lambda function for any errors
- View and analyse log stream logs for the BDA invoke claim verification lambda function for any errors
- View and analyse log stream logs for the Bedrock Agent Actions lambda function for any errors