From 1045dccbbe8363254b8b5d299ecc6f15ddc01b92 Mon Sep 17 00:00:00 2001 From: VenkataKrishna Reddy Avula Date: Wed, 12 Nov 2025 15:11:16 +0000 Subject: [PATCH] Merged in bugfix/outlier_terms (pull request #771) Bugfix/outlier terms to main * added split sepcial term * additional instrcution added * Merged main into bugfix/outlier_terms * modified special case primary * removed split special case primary * remove additional instruction * remove print statements * removed print statements * updated special case primary prompt * Merged main into bugfix/outlier_terms Approved-by: Katon Minhas --- .../src/prompts/prompt_templates.py | 62 ++++++++++++++++--- 1 file changed, 53 insertions(+), 9 deletions(-) diff --git a/fieldExtraction/src/prompts/prompt_templates.py b/fieldExtraction/src/prompts/prompt_templates.py index 679d803..fda9b21 100644 --- a/fieldExtraction/src/prompts/prompt_templates.py +++ b/fieldExtraction/src/prompts/prompt_templates.py @@ -422,19 +422,25 @@ Extract relevant excerpts from this payer-provider contract section. The output [OUTPUT FORMAT] Return a JSON dictionary with attributes specified in the prompt. -[GUIDELINES] +[GUIDELINES FOR EXTRACTION] - For each attribute, extract all paragraphs or table entries that meet the specified criteria and return them as a list of strings. - If no items meet the criteria, return an empty list []. -- When tables are present (marked with "Table Start" and "Table End"): - - Treat each row as a complete term; if any cell in a row meets the criteria, return the entire row (all columns) exactly as shown. - - Match column headers with their corresponding row values and combine them into readable phrases while preserving exact wording. - - Include any table-level headers, footers, notes, or references (including text appearing before, within, or after the table but not part of a row) with each relevant extracted row, and append such contextual text at the end of the row entry. - - Maintain the original order, spacing, punctuation, and wording — do not rephrase or summarize. -- When multiple terms relate to the same service type, COMBINE them into one entry by concatenating exact terms (use semicolons or line breaks). -- Do NOT modify, summarize, or rephrase the original terms — preserve exact text. - Some contract sections may not contain any relevant terms — this is acceptable. -[EXAMPLE] +[GUIDELINES FOR GROUPING TERMS OR SPLITTING TERMS] +- When tables are present (marked with "Table Start" and "Table End"): + - Treat each row as a complete term + - Match column headers with their corresponding row values and combine them into readable phrases while preserving exact wording. + - Include any table-level headers, footers, notes, or references (including text appearing before, within, or after the table but not part of a row) with each relevant extracted row, and append such contextual text at the end of the row entry. + - Maintain the original order, spacing, punctuation, and wording — do not rephrase or summarize. +- If multiple related terms are found that logically belong together (e.g., "Outlier Day Threshold" and "Days in Excess of Threshold" for the same service), combine them into a single entry separated by a semicolon (;). +- Ensure that combined entries maintain the exact wording of each individual term. +- If a single term contains multiple distinct concepts that should be separated (e.g., different thresholds for different services), split them into separate entries. +- Ensure that split entries maintain the exact wording of each individual concept. +- Identify text at the end of the term or within in the term that applies to all components and append them to each item as needed for clarity. + + +[GROUPING EXAMPLE] Given these separate terms: - "Specialized Neurological Services Outlier Day Threshold - # of Days: 15" - "Specialized Neurological Services Days in Excess of Threshold - Per Diem: $6,369" @@ -445,6 +451,44 @@ Should be combined into single entries preserving exact wording: - "Specialized Neurological Services Outlier Day Threshold - # of Days: 15; Specialized Neurological Services Days in Excess of Threshold - Per Diem: $6,369" - "Cardiac Services Outlier Day Threshold - # of Days: 12; Cardiac Services Days in Excess of Threshold - Per Diem: $6,368" +[SPLITTING EXAMPLES] + +Example1: + +Given this combined term and common term at the end: +"Type of Transplant | Bone Marrow Transplant Per Case Rate | Outlier Threshold +Standard - Bone Marrow Transplant Autologous | $80,000 | $105,000 +Related: Allogeneic Myeloablative (Standard) Related Blood and Marrow Transplant | $134,000 | $176,000 +Unrelated: Allogeneic Myeloablative (Standard) Unrelated Blood and Marrow Transplant | $157,000 | $206,000 +If Billed Charges exceed the Outlier Threshold, payment is the Bone Marrow Transplant Per Case Rate plus 79% of the Billed Charges that exceed the Outlier Threshold." + +Should be split into separate entries preserving exact wording and appending the common term at the end: +[ + "The per-case rate for a standard autologous bone marrow transplant is $80,000, and the outlier threshold is $105,000. If Billed Charges exceed the Outlier Threshold, payment is the Bone Marrow Transplant Per Case Rate plus 79% of the Billed Charges that exceed the Outlier Threshold.", + "The per-case rate for a standard related allogeneic myeloablative blood and marrow transplant is $134,000, and the outlier threshold is $176,000. If Billed Charges exceed the Outlier Threshold, payment is the Bone Marrow Transplant Per Case Rate plus 79% of the Billed Charges that exceed the Outlier Threshold.", + "The per-case rate for a standard unrelated allogeneic myeloablative blood and marrow transplant is $157,000, and the outlier threshold is $206,000. If Billed Charges exceed the Outlier Threshold, payment is the Bone Marrow Transplant Per Case Rate plus 79% of the Billed Charges that exceed the Outlier Threshold." +] + +Example 2: +Given this combined term: +"Specialized Neurological Services Outlier Day Threshold - # of Days: 15; Specialized Neurological Services Days in Excess of Threshold - Per Diem: $6,369; Cardiac Services Outlier Day Threshold - # of Days: 12; Cardiac Services Days in Excess of Threshold - Per Diem: $6,368" + +Should be split into separate entries preserving exact wording: +[ + "Specialized Neurological Services Outlier Day Threshold - # of Days: 15; Specialized Neurological Services Days in Excess of Threshold - Per Diem: $6,369", + "Cardiac Services Outlier Day Threshold - # of Days: 12; Cardiac Services Days in Excess of Threshold - Per Diem: $6,368" +] + +Example 3: +Given this combined term: +"DRG 1 CRANIOTOMY EX TRAUMA >17 Outlyer Threshold $37,247.14; DRG 2 CRANIOTOMY FOR TRAUMA >17 Outlyer Threshold $75,228.66; DRG 3 CRANIOTOMY <18 Outlyer Threshold $28,628.44;" +Should be split into separate entries preserving exact wording: +[ + "DRG 1 CRANIOTOMY EX TRAUMA >17 Outlyer Threshold $37,247.14", + "DRG 2 CRANIOTOMY FOR TRAUMA >17 Outlyer Threshold $75,228.66", + "DRG 3 CRANIOTOMY <18 Outlyer Threshold $28,628.44" +] + Keep all original terms exactly as they appear - do not modify the language. [ANALYSIS CONTEXT]"""