Commit Graph

1719 Commits

Author SHA1 Message Date
Katon Minhas 6fba0e7574 Merged main into DEV 2026-02-10 17:28:11 +00:00
Katon Minhas deef52193c Merged in DEV (pull request #873)
DEV

* file_processing

* Merge branch 'bugfix/code_implicit' into DEV

* Update split reimb dates condition

* Pipe line general fixes, fixed tests, ran black, and fixed mypy type check issues, still have a list of lists issue with prov other name full

* Merged in feature/update-claim-type (pull request #869)

Feature/update claim type

* Update CLAIM_TYPE_CD extraction to prioritize title/header

- Modified retrieval_question to search for title, header, and agreement name
- Updated prompt to check title/header first before analyzing body text
- Enhanced FULL_CONTEXT_CLAIM_TYPES_ADDITIONAL_INSTRUCTION to emphasize title/header as primary source

* Fix CLAIM_TYPE_CD extraction with 3-step fallback

1. Exhibit Level: Updated retrieval_question and prompt to prioritize title/header
2. Contract Title fallback: Added infer_claim_type_from_title() function that extracts
   claim type from CONTRACT_TITLE when exhibit-level extraction returns empty
3. Postprocessing: fill_claim_type() now uses CONTRACT_TITLE inference when all
   AARETE_DERIVED_CLAIM_TYPE_CD values are empty

Keywords mapped:
- Professional/Ancillary -> M (Physician, Professional, Ancillary, Home Health, DME, etc.)
- Institutional -> H (Hospital, Facility, Surgery Center, SNF, etc.)

* Add more prof…
* Merged in bugfix/code-funcs (pull request #872)

Bugfix/code funcs

* Try-except code extraction

* Additional try-except for protection

* Black format


Approved-by: Praneel Panchigar

* Merged in feature/update-testbed-metrics (pull request #871)

Feature/update testbed metrics

* Combine fee schedule with methodology breakout; remove Reimbursement primary; do not run trigger cap or additions

* Deprecate reimb primary functions

* combine multiple sheets to one

* Clean 1:N metrics

* Improve dynamic primary evaluation

* Resolve dynamic primary

* Update row counts

* black format

* Merged DEV into feature/update-testbed-metrics


Approved-by: Praneel Panchigar

* Merged in feature/adding_contract_admenment_num_pc (pull request #870)

Feature/adding contract admenment num pc

* Updated contract amendment

* Format code with Black

* updated to have letters

* format fixes

* Adjusted unit testing

* Merge remote-tracking branch 'origin/DEV' into feature/adding_contract_admenment_num_pc

* apply formatting

* format fixes

* Merge remote-tracking branch 'origin/DEV' into feature/adding_contract_admenment_num_pc

* test conflicts solved

* Format code with Black

* format fixes

* reverted the changes for prompt templates

* test_case reverted
* Sorted effective date for ranking

* format fix for lint

* Merged DEV into feature/adding_contract_admenment_num_pc

* format

* Merged DEV into feature/adding_contract_admenment_num_pc

* Merged DEV into feature/adding_contract_admenment_num_pc


Approved-by: Siddhant Medar

* Consolidate docs and documentation

* Remove PRD

* Add Essential Plan as a NY Program

* Resolve Comments

* Resolve comments

* Black format

* Resolve remaining comments

* Black format

* Merged in bugfix/fill_claim_type (pull request #874)

Bugfix/fill claim type

* Handle if AARETE_DERIVED_CLAIM_TYPE_CD comes in as list

* add unit tests

* Black format


Approved-by: Siddhant Medar

* Remove print

* Merged in bugfix/parser-downstream-improvements (pull request #875)

Bugfix/parser downstream improvements

* Refactor: Implement field-aware JSON parsers with centralized normalization

This refactor introduces a robust system for normalizing LLM output based on
field format mappings, ensuring consistent data types throughout the pipeline.

Key Changes:
- Add FIELD_FORMAT_MAPPING constant defining expected formats for all fields
- Create format_normalization.py utility for type-aware normalization
- Update json_utils.py parsers to accept field_names/field_name parameters
- Refactor prompt_templates.py to use parser factories (_create_json_dict_parser,
  _create_json_list_parser) that bind field metadata for automatic normalization
- Update prompt_calls.py to pass field names to parsers, eliminating redundant
  normalization logic
- Remove parse_json_dict_or_list (unused, ambiguous function)
- Simplify METHODOLOGY_BREAKOUT and REIMBURSEMENT_PRIMARY to use helper functions
- Add comprehensive integration tests…
* Update other lists

* Black format

* Remove prints

* Update qa_qc to account for lists in is_empty check

* Resolve issues

* Black format


Approved-by: Siddhant Medar
2026-02-10 17:09:54 +00:00
Katon Minhas a5f8e14dc4 Black format 2026-02-10 11:48:20 -05:00
Katon Minhas 2a613b7efd Resolve issues 2026-02-09 18:48:50 -05:00
Katon Minhas 96d6c26ef3 Update qa_qc to account for lists in is_empty check 2026-02-09 18:11:05 -05:00
Katon Minhas fb4d7db29c Remove prints 2026-02-09 18:07:16 -05:00
Katon Minhas dcd4ad9636 Black format 2026-02-09 18:06:43 -05:00
Katon Minhas ca773bf4b9 Update other lists 2026-02-09 18:05:58 -05:00
Praneel Panchigar 9b0a344b13 Merged in bugfix/parser-downstream-improvements (pull request #875)
Bugfix/parser downstream improvements

* Refactor: Implement field-aware JSON parsers with centralized normalization

This refactor introduces a robust system for normalizing LLM output based on
field format mappings, ensuring consistent data types throughout the pipeline.

Key Changes:
- Add FIELD_FORMAT_MAPPING constant defining expected formats for all fields
- Create format_normalization.py utility for type-aware normalization
- Update json_utils.py parsers to accept field_names/field_name parameters
- Refactor prompt_templates.py to use parser factories (_create_json_dict_parser,
  _create_json_list_parser) that bind field metadata for automatic normalization
- Update prompt_calls.py to pass field names to parsers, eliminating redundant
  normalization logic
- Remove parse_json_dict_or_list (unused, ambiguous function)
- Simplify METHODOLOGY_BREAKOUT and REIMBURSEMENT_PRIMARY to use helper functions
- Add comprehensive integration tests verifying normalization works end-to-end

Benefits:
- Single source of truth for field formats (FIELD_FORMAT_…
* refactor: normalize helper prompt outputs at prompt_calls level

- Update CARVEOUT_CHECK to use field-aware parser for CARVEOUT_CD normalization
- Update LOB_RELATIONSHIP to normalize to string format in prompt_calls.py
- Update SPLIT_REIMB_DATES to normalize date values in prompt_calls.py
- Remove defensive normalization from one_to_n_funcs.py for LOB relationships
- Remove manual normalization from split_reimb_dates() - values now normalized upstream
- All helper prompts that populate fields now normalize at prompt_calls.py level
- Downstream functions receive correctly formatted values without additional processing

* refactor: remove band-aid normalization functions and migrate HSC to field-aware parsers

- Update ONE_TO_ONE_SINGLE_FIELD_TEMPLATE to use field-aware parser with field_name parameter
- Remove list wrapping logic in hybrid_smart_chunking_funcs (field-aware parser handles normalization)
- Remove normalize_one_to_one_field_value and normalize_one_to_one_answers_dict from string_utils.py
- Remove all debug print statements from HSC processing
- Remove commented-out normalization calls from client-specific files (clover, bcbs_promise)
- All normalization now handled exclusively through FIELD_FORMAT_MAPPING via field-aware parsers

* Ran Black for formatting

* Print Statements removed, more cleaning

* Merge branch 'DEV' into bugfix/parser-downstream-improvements

* refactor: combine FIELD_FORMAT_MAPPING into investment_columns.py

- Merged field_format_mapping.py into investment_columns.py to create single source of truth
- FIELD_FORMAT_MAPPING now ordered by COLUMN_ORDER (161 fields)
- Added 5 missing fields from COLUMN_ORDER with default format types
- Updated all imports across codebase to use investment_columns
- Python dict preserves insertion order (3.7+), maintaining COLUMN_ORDER sequence
- All tests passing (38 field-aware tests verified)

* Deprecate COLUMN_ORDER, rely on Mapping only

* Merged DEV into bugfix/parser-downstream-improvements


Approved-by: Katon Minhas
2026-02-09 22:06:21 +00:00
Katon Minhas 4587042c43 Remove print 2026-02-09 15:04:19 -05:00
Katon Minhas 47472c0f32 Merged in bugfix/fill_claim_type (pull request #874)
Bugfix/fill claim type

* Handle if AARETE_DERIVED_CLAIM_TYPE_CD comes in as list

* add unit tests

* Black format


Approved-by: Siddhant Medar
2026-02-09 19:12:15 +00:00
Katon Minhas fc178587c8 Black format 2026-02-09 13:08:21 -05:00
Katon Minhas 16a67df7ec Resolve remaining comments 2026-02-09 12:57:41 -05:00
Katon Minhas 704090c1f2 Black format 2026-02-06 16:14:27 -05:00
Katon Minhas 9aabaf680d Resolve comments 2026-02-06 15:38:15 -05:00
Katon Minhas dc1931d0bd Resolve Comments 2026-02-06 15:28:42 -05:00
Katon Minhas 5d4433703c Add Essential Plan as a NY Program 2026-02-06 14:49:48 -05:00
Katon Minhas 2f1c4b2fe8 Remove PRD 2026-02-06 14:25:04 -05:00
Katon Minhas 7a91862664 Consolidate docs and documentation 2026-02-06 14:23:22 -05:00
Rahul Ailaboina dd314f2263 Merged in feature/adding_contract_admenment_num_pc (pull request #870)
Feature/adding contract admenment num pc

* Updated contract amendment

* Format code with Black

* updated to have letters

* format fixes

* Adjusted unit testing

* Merge remote-tracking branch 'origin/DEV' into feature/adding_contract_admenment_num_pc

* apply formatting

* format fixes

* Merge remote-tracking branch 'origin/DEV' into feature/adding_contract_admenment_num_pc

* test conflicts solved

* Format code with Black

* format fixes

* reverted the changes for prompt templates

* test_case reverted
* Sorted effective date for ranking

* format fix for lint

* Merged DEV into feature/adding_contract_admenment_num_pc

* format

* Merged DEV into feature/adding_contract_admenment_num_pc

* Merged DEV into feature/adding_contract_admenment_num_pc


Approved-by: Siddhant Medar
2026-02-06 17:51:21 +00:00
Katon Minhas 0c3546cea9 Merged in feature/update-testbed-metrics (pull request #871)
Feature/update testbed metrics

* Combine fee schedule with methodology breakout; remove Reimbursement primary; do not run trigger cap or additions

* Deprecate reimb primary functions

* combine multiple sheets to one

* Clean 1:N metrics

* Improve dynamic primary evaluation

* Resolve dynamic primary

* Update row counts

* black format

* Merged DEV into feature/update-testbed-metrics


Approved-by: Praneel Panchigar
2026-02-05 22:11:21 +00:00
Katon Minhas c62bd1cd6a Merged in bugfix/code-funcs (pull request #872)
Bugfix/code funcs

* Try-except code extraction

* Additional try-except for protection

* Black format


Approved-by: Praneel Panchigar
2026-02-05 22:10:50 +00:00
Faizan Mohiuddin 49407bfb93 Merged in feature/update-claim-type (pull request #869)
Feature/update claim type

* Update CLAIM_TYPE_CD extraction to prioritize title/header

- Modified retrieval_question to search for title, header, and agreement name
- Updated prompt to check title/header first before analyzing body text
- Enhanced FULL_CONTEXT_CLAIM_TYPES_ADDITIONAL_INSTRUCTION to emphasize title/header as primary source

* Fix CLAIM_TYPE_CD extraction with 3-step fallback

1. Exhibit Level: Updated retrieval_question and prompt to prioritize title/header
2. Contract Title fallback: Added infer_claim_type_from_title() function that extracts
   claim type from CONTRACT_TITLE when exhibit-level extraction returns empty
3. Postprocessing: fill_claim_type() now uses CONTRACT_TITLE inference when all
   AARETE_DERIVED_CLAIM_TYPE_CD values are empty

Keywords mapped:
- Professional/Ancillary -> M (Physician, Professional, Ancillary, Home Health, DME, etc.)
- Institutional -> H (Hospital, Facility, Surgery Center, SNF, etc.)

* Add more professional keywords for claim type inference

Added PROVIDER SERVICE, PROVIDER AGREEMENT, PARTICIPATING PROVIDER to handle
titles like 'PROVIDER SERVICES AGREEMENT'

* Add postprocessing safety net for claim type inference

- Added fill_claim_type_from_title() in postprocessing_funcs.py that infers
  AARETE_DERIVED_CLAIM_TYPE_CD from CONTRACT_TITLE if still empty after code_breakout
- Added call in postprocess.py before attach_sid_column
- This ensures claim type is populated even if earlier extraction steps miss it

* Improve CLAIM_TYPE_CD extraction context and postprocessing

1. Added keywords to CLAIM_TYPE_CD field (same as CONTRACT_TITLE) so it retrieves
   from the same document header/title context
2. Updated fill_claim_type_from_title() to first fill from other exhibits in the
   same file (mode within file) before falling back to CONTRACT_TITLE keyword matching

* Merge DEV into feature/update-claim-type

Resolved conflicts:
- code_funcs.py: Kept DEV's code_breakout (claim type now handled in postprocessing)
- postprocess.py: Added fill_claim_type_from_title call
- prompt_templates.py: Kept DEV's VALIDATE_REIMBURSEMENTS_PROMPT signature

* Merge DEV into feature/update-claim-type

* move keywords to ancillary


Approved-by: Katon Minhas
2026-02-05 17:25:49 +00:00
ppanchigar 9e4b88395b Pipe line general fixes, fixed tests, ran black, and fixed mypy type check issues, still have a list of lists issue with prov other name full 2026-02-04 15:09:44 -06:00
Katon Minhas b41ad28ecc Update split reimb dates condition 2026-02-04 14:01:02 -05:00
Katon Minhas 90f2dcbb33 Merge branch 'bugfix/code_implicit' into DEV 2026-02-04 13:32:54 -05:00
Katon Minhas a1e28f94ee file_processing 2026-02-04 13:30:39 -05:00
Katon Minhas 7ddd9dc192 Fix prompt to ensure list-of-dicts-of-str 2026-02-04 13:30:39 -05:00
ppanchigar 16ead7d5f3 Fix date range processing: extract first range only, add JSON format instructions, increase max_tokens 2026-02-04 12:17:50 -06:00
Katon Minhas b7e00ed26a Merge branch 'DEV' into bugfix/flag-prov-info-issue 2026-02-04 13:06:24 -05:00
Katon Minhas 6237f5722d file_processing 2026-02-04 12:05:25 -05:00
Katon Minhas 86a9347cb0 Fix prompt to ensure list-of-dicts-of-str 2026-02-04 12:04:48 -05:00
ppanchigar 5b619b2f5f fixed code implicit special and ran black for CI 2026-02-04 10:57:40 -06:00
Katon Minhas 6751a5ab7a Merge branch 'feature/standardize-list-format' into DEV 2026-02-04 03:40:23 -05:00
Katon Minhas f8783ae968 Update prov_info 2026-02-04 03:37:23 -05:00
Katon Minhas f0da944ade update tin_npi_funcs dedups 2026-02-04 02:42:21 -05:00
Katon Minhas ee85884dce Refactor llm call to prompt_calls 2026-02-04 02:23:55 -05:00
Katon Minhas 2c76b8a92b Resolve PROV_INFO issue 2026-02-04 01:41:09 -05:00
Katon Minhas bafb92c684 Refactor - sub functions 2026-02-04 00:34:53 -05:00
Katon Minhas 32c667ad49 Revert 2026-02-04 00:15:50 -05:00
ppanchigar 7e3d8ea2fe Remove debug print statements for CLAIM_TYPE_CD and provider info 2026-02-03 22:49:12 -06:00
ppanchigar deffb639cf Fix CLAIM_TYPE_CD being converted to list in get_crosswalk_fields and add debug prints for troubleshooting 2026-02-03 22:44:32 -06:00
Katon Minhas 0882a79b5a Merged in bugfix/list-of-lists (pull request #866)
Bugfix/list of lists

* Revert tin_npi_funcs.py to DEV

* update bill type mapping

* Remove test.py

* Prep for merge
2026-02-04 04:27:03 +00:00
ppanchigar cff0472717 Latest updates 2026-02-03 21:12:50 -06:00
ppanchigar 90b1ea283f refactor: complete JSON format standardization updates
- Updated all prompt_calls.py files (saas, bcbs_promise, clover) to use new parser pattern
- Updated prompt_templates.py with JSON format instructions
- Updated crosswalk_utils.py to handle JSON lists
- Updated json_utils.py with improved parsing
- Updated aarete_derived.py for JSON compatibility
- Updated tin_npi_funcs.py and qa_qc_utils.py for JSON parsing
- All changes align with Phase 4 completion of JSON standardization
2026-02-03 17:29:52 -06:00
ppanchigar 3c89aecfaf chore: remove debug statements and update PRD
- Removed all debug print statements from prompt_calls.py and one_to_n_funcs.py
- Updated PRD to reflect Phase 4 completion and recent bug fixes
- Documented REIMB_TERM normalization fixes and cleanup work
- Updated Phase 6 status to 25% complete (debug removal done)
2026-02-03 17:27:45 -06:00
ppanchigar a633f67c62 Fix REIMB_TERM being converted to list in lesser_of_distribution
- Fixed prompt_lesser_of_distribution to extract string from list when parser returns list
- Added debug print statements to trace REIMB_TERM format through processing pipeline
- Removed defensive normalization checks that are no longer needed upstream
- Added debug output in reimbursement_level and methodology_breakout_single_row to track data flow
2026-02-03 17:15:14 -06:00
Sha Brown 05b00ab6a1 Merged in bugfix/max_workers_and_batch_id (pull request #864)
Trigger error when batch_id is not specified or when max_workers is negative

* Trigger error when batch_id is not specified or when max_workers is negative


Approved-by: Katon Minhas
2026-02-03 21:12:27 +00:00
Rahul Ailaboina 1865e75c47 few enhancement in the output needed 2026-02-03 13:50:06 -06:00
Siddhant Medar 8fbe64e42e Merged in feature/adding_contract_admenment_num_pc (pull request #863)
Feature/adding contract admenment num pc

* Updated contract amendment

* Format code with Black

* updated to have letters

* format fixes

* Adjusted unit testing

* Merge remote-tracking branch 'origin/DEV' into feature/adding_contract_admenment_num_pc

* apply formatting
2026-02-03 17:59:01 +00:00