Skip to content

An end-to-end automated workflow for pharmaceutical test result validation, powered by ABBYY Vantage

License

Notifications You must be signed in to change notification settings

abbyy/demo-pharma-test-validation

Repository files navigation

Pharmaceutical Test Validation with ABBYY Vantage + GenAI

This proof of concept demonstrates an end‑to‑end workflow that ingests pharmaceutical testing documents, extracts and validates test data, checks compliance with test methods and specifications using GenAI, and enables human review.

What this includes

  • Document Skill – Report: Extracts numeric and textual test result data from a Test Report. One skill per test type (e.g., Water Content, Residue on Ignition).
  • Document Skill – Method: Extracts the full OCR text describing the test procedure. A generic skill works across test types; for complex methods, segmentation can be added.
  • Document Skill – Specification: Extracts the full OCR text containing acceptable ranges and criteria. A generic skill works across specifications; for complex layouts, add segmentation.
  • Classification Skill: Classifies each page/document as one of: Test Report (by test type), Method Description, or Test Specification.
  • Process Skill: Orchestrates the end‑to‑end flow: classification, data extraction, GenAI validation against Method/Specification, and human review for exceptions.

How it works (pipeline)

Workflow

  1. Ingest documents

    • Upload the three document types into ABBYY Vantage: Test Report, Method Description, and Test Specification.
    • For this demo, the Try‑Any‑Skill app is used to upload and run skills.
  2. Classify

    • The Classification Skill assigns each document to a class: specific Test Report type, Method Description, or Test Specification.
  3. Extract data

    • Test Report skills extract fields used by validation rules, such as measurements, sample IDs, test conditions, instruments, and operator information.
    • Method and Specification skills capture the full OCR text for downstream GenAI checks.
  4. Validate business rules

    • Arithmetic and logical checks run on extracted fields for internal consistency (e.g., summations, averages, range checks, and threshold comparisons).
    • Any failures mark the document for human review.
  5. Method compliance check (GenAI)

    • A ChatGPT prompt compares extracted Test Report data against the Method Description to confirm the procedure/sequence was followed.
    • Deviations (e.g., instrument settings, flow rates, temperatures, steps performed) are highlighted.
  6. Specification compliance check (GenAI)

    • Extracted test results are compared against acceptance criteria and ranges from the Test Specification.
    • Examples of flagged mismatches:
      • Flow rate reported as 45 mL/min when the method/spec says 40 mL/min.
      • Oven temperature reported as 110 °C when the method/spec says 120 °C.
      • Calculations based on provided net weights appear inconsistent.
  7. Human‑in‑the‑loop review

    • A manual review step allows validation of business rule and GenAI‑flagged exceptions before release.

Supported test types (example)

  • Water Content
  • Residue on Ignition (ROI)

The design supports adding more test types by creating additional Report skills and mapping them to the same Method/Specification validation steps.

Key outputs

  • Extracted fields: measurements, sample identifiers, test conditions, instrument parameters, operator/date, and other report metadata.
  • Validation results: pass/fail indicators with reasons for business rules, method compliance, and specification compliance.

Prerequisites

  • ABBYY Vantage environment with permissions to deploy and run Skills and Process Skills.
  • GenAI/OpenAI API key configured for prompt‑based validations.

Setup (How to Use)

Configure the GenAI provider

  1. Obtain an OpenAI API key.
  2. In Vantage, navigate to Configuration -> Environment Variables and click "Create Variable."
  • Name: "POC-Pharma-Validation-OpenAI-Key"
  • Value: [OPENAI API KEY]
  1. Save the new variable.

Import Demo into Vantage

Import the pre-configured Pharmaceutical Validation workflow into Vantage. From the skill catalog screen, click the Import button, then choose Demo TR - Process Skill.zip. The following skills are added:

  • Demo TR - Classification
  • Demo TR - Method
  • Demo TR - Purity Test Report
  • Demo TR - Specifications

Execute the Pharmaceutical Validation

Note: Running the Process Skill below will incur charges from OpenAI.

The easiest way to try this workflow is to use the Try Any Skill application. From the included Samples folder, choose Purity_Analysis_Method.pdf, Specification_Report.pdf, and either the ok or error version of the Analysis Report, such as Purity_Analysis_Report_1_ok.pdf.

Next, search for and choose the process skill Demo TR - Process Skill. The test validation will run and process the files. Upon completion, click the "REVIEW" button. The first document, "Purity Test Report" displays the analysis from OpenAI in the GenAI Analysis field:

results

Additional Details

  • gen-ai-analysis.js is the JavaScript code for the Gen AI Analysis custom activity.
  • If you'd like to change the values in the pharmaceutical files to see different GenAI analysis results, edit the Word documents in the Word Docs folder, save them as PDFs, then use them with the Demo TR - Process Skill.

About

An end-to-end automated workflow for pharmaceutical test result validation, powered by ABBYY Vantage

Topics

Resources

License

Stars

Watchers

Forks