Inspection and Process Record Audit for Active Pharmaceutical Ingredient and Pharmaceutical Intermediate Production: Knowledge Base Retrieval and Recall

Data for this category comes from registered process documents, raw material batch ledgers, DCS systems, weighing systems, LIMS, chromatography data

What this category of data looks like

Data for this category comes from registered process documents, raw material batch ledgers, DCS systems, weighing systems, LIMS, chromatography data systems, and QMS. Daily generated documents include batch production records, material balance sheets, reaction and purification step records, cleaning validation records, impurity profile reports, and deviation and change approval documents. Data is updated for each production batch and process step. Fields include batch identifier, reaction temperature, feeding quantity, impurity test values, and change association number. Units include physical units such as degrees Celsius, kilograms, mg/kg, and others.

Constraints Imposed on Knowledge Base Retrieval and Recall

High-frequency data updated per batch and step requires retrieval to associate with the batch identifier field to avoid mixing cross-batch data. Semi-structured features of multiple types of process and quality documents require retrieval to accurately match professional fields and terms to avoid generalized full-text retrieval. Data from multiple industrial systems may have inconsistent encoding or format during import. Data integrity must be verified before retrieval. Frequently updated batch data requires retrieval to default to limiting the most recently updated dataset to avoid calling expired process records. Highly professional impurity profile and change documents require retrieval to adapt to the recall logic of professional chemical terms.

Configuration Settings

The following configurations are formulated based on FastGPT v4.17.0.

Choose a retrieval mode through representative-query testing; configure category, batch, or entity filters separately because the mode itself does not enforce those boundaries.

Configuration ItemRecommended Value RangeRationale
similarity0.75–0.85Documents in this category have high professionality. This range filters low-match irrelevant process records and avoids mixing unrelated impurity reports or change documents
limitTop 8–12 resultsThe number of documents associated with a single batch process is limited. Excessive results will exceed the context window and reduce audit accuracy
usingReRankEnabled, re-rank top 10 resultsRe-rank initially recalled results by professional relevance, and prioritize displaying reaction or purification records associated with the current inspection task
datasetSearchUsingExtensionQueryDisabledData in this category requires strict matching of batch and process steps. Disabling this avoids introducing unrelated historical deviation records via extended queries
collectionIdsSpecify the 2 dataset IDs associated with the current inspection batchLimit the retrieval scope to the departmental dataset corresponding to the current batch to narrow the recall range

Three Common Misconfigurations

  • Phenomenon: Retrieval results mix process records or impurity reports outside the current inspection batch. Cause: The retrieval scope is not limited to the dataset associated with the current batch via collectionIds, leading to recall of expired or unrelated historical batch data.
  • Phenomenon: Imported documents display garbled text in the online environment, but import works normally in local deployments. Cause: The default encoding of the online server and local environment is inconsistent, and UTF-8 encoding format is not uniformly configured during the import process.
  • Phenomenon: Retrieval results include a large number of deviation and change documents unrelated to the current inspection task. Cause: datasetSearchUsingExtensionQuery is enabled, and extended queries introduce documents not associated with the current process step.

How to Verify Proper Configuration

  • Import documents for a test batch, run the inspection task, and confirm that the batch identifier of the retrieval results matches the current task, and no data from other batches is recalled.
  • Adjust the value of similarity, compare retrieval results across different thresholds, and confirm that low-match irrelevant documents are filtered out.
  • Check the number of retrieval results, confirm that it matches the limit setting and does not exceed the context window.
  • Check the status of datasetSearchUsingExtensionQuery, confirm that extended queries are disabled to avoid introducing unrelated data.

The values provided are common starting points and should be measured against the reader's own samples.