Commit Graph

60 Commits

Author SHA1 Message Date
Katon Minhas ca01d49452 Merged in bugfix/dropped-pages (pull request #554)
Bugfix/dropped pages

* Rearrange

* Update table preprocessing

* Remove print

* Remove page start

* test for table issue

* Merged main into bugfix/dropped-pages

* prints and documentation

* Pipeline fix

* remove get_pages_to_process


Approved-by: Alex Galarce
2025-06-03 20:47:42 +00:00
Alex Galarce 9db0fb328e Merged in bugfix/identify-tables (pull request #544)
Don't consider table-subpages each individually for reimbursement exhibit identification

* Refine EXHIBIT_CHECK prompt

* test: rework `get_exhibit_pages` for table subpages

* Fix indentation

* Experimental table de-chunking

* Increase max_tokens for Claude model in exhibit page processing

* fix get_pages_to_process docstring

* refactor: improved docstring for get_exhibit_pages

* move `get_pages_to_process` to `preprocess.py`

* test: add unit tests for get_pages_to_process function

* Comment out debugging lines

* Changed prompt that was breading universal_json_load parsing

* fix: handle "no results" case in get_reimbursement_primary function

* fixed docstring


Approved-by: Katon Minhas
2025-05-28 16:57:23 +00:00
Mayank Aamseek f9b88959c3 Merged in feature/daip2-193 (pull request #532)
payemnt carveout added

* payemnt carveout added

* Merge branch 'main' into feature/daip2-193

* refined PAYMENT_CARVEOUT related prompts

* Merge branch 'main' into feature/daip2-193

* notebook updated

* notebook updated

* Merge branch 'main' into feature/daip2-193

* carveout blank values and default ind corrected

* print statement removed

* field_type changed for default_ind

* payment_carveout description updated to add code

* duplicate run of get_methodology_breakout fixed

* pipeline error fixed

* pipeline error fixed

* Merge branch 'main' into feature/daip2-193

* updated AARETE_DERIVED_REIMB_METHOD prompt

* default_term prompt changed

* refined copilot checked AARETE_DERIVED_REIMB_METHOD prompt

* Merge branch 'main' into feature/daip2-193

* Merge remote-tracking branch 'origin/main' into feature/daip2-193

* spelling error fixed

* Merged main into feature/daip2-193


Approved-by: Alex Galarce
2025-05-22 19:19:19 +00:00
Alex Galarce 97dad37ba0 Merged in feature/no-longer-concat-names (pull request #535)
Feature/no longer concat names

* Simplify deduplication logic for no AKAs

* Add unit tests

* Merge remote-tracking branch 'origin/main' into feature/no-longer-concat-names


Approved-by: Katon Minhas
2025-05-16 21:17:38 +00:00
Mayank Aamseek a89c346ca3 Merged in bugfix/smart-chunking (pull request #527)
find_overlap function added to handle inconsistent chunk size

* find_overlap function added to handle inconsistent chunk size

* set min chunk overlap needed to remove overlap to 3

* Merge branch 'main' into bugfix/smart-chunking

* pipeline error fixed

* Merge branch 'main' into bugfix/smart-chunking

* spelling fix


Approved-by: Katon Minhas
2025-05-15 19:51:19 +00:00
Alex Galarce 384b3c5d31 Merged in feature/apply-postprocessing-to-test-bed (pull request #526)
Refactor CPT postprocessing, create notebook to postprocess test bed for MCS team

* Move comment

* Implement testbed postprocessing functions

* Refactor normalize CPT postprocessing

* remove old notebook, add new postprocess notebook

* Enhance normalize_cpt_fields to handle comma-separated values in lists

* Update normalize_cpt_fields to return an empty string for None values

* Add testbed postprocessing script, removed notebook


Approved-by: Katon Minhas
2025-05-13 16:58:27 +00:00
VenkataKrishna Reddy Avula 0d6bdf9539 Merged in bugfix/effective_date_fix (pull request #504)
DRAFT: Bugfix/effective date fix

* Merged in bugfix/extra-fields (pull request #500)

Do not run Exhibit level prompt if there are no exhibit level fields

* Do not run Exhibit level prompt if there are no exhibit level fields

* Update dynamic test

* Remove test from one-to-n test module

* Update test

* Fix unit test


Approved-by: Alex Galarce

* Merged in bugfix/tin-npi-prompt-fixes (pull request #499)

Bugfix/tin npi prompt fixes

* Change delimiter for other provider information from comma to pipe

* filter out invalid providers

* Update extraction and formatting instructions for provider entities in TIN_NPI_TEMPLATE

* Merged main into bugfix/tin-npi-small-bugfixes

* Refactor deduplication logic to use string_utils for checking empty provider fields

* Merge branch 'bugfix/tin-npi-small-bugfixes' of https://bitbucket.org/aarete/doczy.ai into bugfix/tin-npi-small-bugfixes

* Update deduplication logic to exclude providers with 'UNKNOWN' TIN, NPI, or NAME

* Merge remote-tracking branch 'origin/main' into bugfix/tin-npi-small-bugfixes

* Fix deduplication logic to not drop subsequent names

* Fix formatting of provider names in deduplication logic

* add payer name filtering

* reorder execution order to allow to find payer_name first

* Add handling for previously unfound group providers in identify_group_provider function

* Merge remote-trackin…
* Merged in feature/update-testbed-script (pull request #501)

Feature/update testbed script

* Update preprocessing

* Update preprocessing

* remove quit

* Update date for filename

* Merged main into feature/update-testbed-script


Approved-by: Alex Galarce

* Merged in bugfix/smart-chunks (pull request #503)

missing of text in chunks fixed

* missing of text in chunks fixed


Approved-by: Katon Minhas

* Merged in feature/rework-reimb-tin-npi (pull request #502)

Feature/rework reimb tin npi

* use LLM for reimb_[tin/npi/name]

* Merge remote-tracking branch 'origin/main' into feature/rework-reimb-tin-npi

* Merge remote-tracking branch 'origin/main' into feature/rework-reimb-tin-npi

* deduplicate tin/name/npi before adding to prompt

* Pull out prompt and llm_response in methodology_breakout_single_row for easier debugging

* Refactor reimbursement_tin_npi to handle multiple providers and update valid TIN, NPI, and NAME fields accordingly

* Reorder REIMB_PROV_NAME field in investment_prompts.json

* Update REIMB_PROV_NAME prompt to specify valid values for provider names

* Remove valid_values constraint from prov_name to raise accuracy

* Remove debugging print statements from reimbursement_tin_npi and related functions

* Remove debugging print statements from run_provider_info_fields function

* Merge remote-tracking branch 'origin/main' into feature/rework-reimb-tin-npi

* Remove debugging print statem…
* Merged in feature/preformat-single-quotes-input (pull request #506)

Replace double quotes with single quotes in context strings for parsability

* Replace double quotes with single quotes in context strings for parsability

* Merged main into feature/preformat-single-quotes-input


Approved-by: Katon Minhas

* updated sig pages fnxn

* Merge branch 'main' into bugfix/effective_date_fix

* poetry add pymupdf

* created vision funcs

* Merged main into bugfix/effective_date_fix

* fixed pipeline issue

* updated string_utils_test

* updated test values

* updated extract signature page fxn

* updated test values

* updated test values

* Merged main into bugfix/effective_date_fix

* Prompt template in all-caps

* remove debugging prints

* Merged main into bugfix/effective_date_fix

* Change vision to False by default

* Change vision to False by default

* fix tests

* fix tests


Approved-by: Katon Minhas
2025-05-07 18:21:09 +00:00
Katon Minhas 46a05df02e Merged in bugfix/extra-fields (pull request #500)
Do not run Exhibit level prompt if there are no exhibit level fields

* Do not run Exhibit level prompt if there are no exhibit level fields

* Update dynamic test

* Remove test from one-to-n test module

* Update test

* Fix unit test


Approved-by: Alex Galarce
2025-04-30 20:35:53 +00:00
Alex Galarce 4844dcfd50 Merged in feature/tin-npi-prompt-formatting (pull request #490)
Collect TIN/NPI/Name page-by-page and run a second pass for IS_GROUP

* configure first pass: no providers marked IS_GROUP.  Allows simplification of prompt

* Add group provider identification logic in second pass

* group identification: don't take 20% of pages.  Take first 3 and last 3

* Refine group provider identification logic to use pipes for JSON formatting and improve error handling

* fix mypy error for `identify_group_provider`

* Merge remote-tracking branch 'origin/main' into feature/tin-npi-prompt-formatting

* Add "PROV_INFO_JSON" to investment column order

* Refactor group provider identification to use signature page extraction and fix JSON format

* move signature page extraction to `string_utils.py` and add unit tests for it

* Update identify_group_provider to return provider name along with TIN and NPI in JSON format

* Update identify_group_provider to always use group-provided name when available

* move out GROUP_TIN_NPI_TEMPLATE to `investment_prompts.py`

* Remove deprecated PROV_GROUP_TIN_CHECK and PROV_GROUP_NPI_CHECK prompts

* Move out provider info fields from `one_to_one_funcs` to `tin_npi_funcs`

* isort

* remove debug print statements

* Remove debug print statements from provider info functions

* add note to regex_utils.py about where functions are used

* Add page_key_sort function and corresponding tests for sorting page keys

* Refactor identify_group_provider to sort pages and avoid duplicates in extracted sections

* Remove debug print statements from identify_group_provider function

* Merge remote-tracking branch 'origin/main' into feature/tin-npi-prompt-formatting

* extract_signature_page function: prioritize Textract marker for signatures and fallback to keyword search

* fix mypy error

* Update test cases to reflect changes in signature extraction logic


Approved-by: Katon Minhas
2025-04-25 20:28:52 +00:00
Katon Minhas bc59c06c37 Merged in field/initialize-patient-age (pull request #492)
Field/initialize patient age

* Update split_text so that it works on single-page contracts (discovered when testing)

* Add PATIENT_AGE_RANGE intermediate column

* Remove PATIENT_AGE_RANGE in postprocessing

* Dont convert columns to int type

* Add unit tests

* Remove test

* Update unit test

* Update unit test

* Update unit test

* Update unit test


Approved-by: Alex Galarce
2025-04-25 19:35:10 +00:00
Katon Minhas af1a16cc0c Merged in field/dynamic-codes (pull request #475)
Field/dynamic codes

* remove test

* Merge branch 'main' into field/dynamic-codes

* Merged main into field/dynamic-codes

* Update test

* Fix unit test

* Merged main into field/dynamic-codes

* Merged main into field/dynamic-codes

* Merged main into field/dynamic-codes

* Update fields with crosswalks

* Update mapping to return empty string if no mapping

* Update dynamic_funcs

* Restructure

* Update file_processing

* Update dynamic primary

* Fix dynamic primary

* Update base fields

* Update one-to-n process

* Merged main into field/dynamic-codes

* genericized get_dynamic_answers

* Update tests

* Remove test file

* dynamic_funcs cleanup

* remove prints

* add exhibit_header

* Fix imports


Approved-by: Alex Galarce
2025-04-23 22:00:02 +00:00
Alex Galarce 297926839a Merged in bugfix/flatten_singleton_list_ints_problem (pull request #488)
Bugfix/flatten singleton list ints problem

* Fix flatten_singleton_string_list to handle non-list int strings and improve test coverage

* Fix test_flatten_singleton_string_list to handle integer input correctly


Approved-by: Katon Minhas
2025-04-21 17:42:33 +00:00
Alex Galarce c8e64bcd4b Merged in feature/align-tin-npi (pull request #485)
Feature/align tin npi

* Add merge_provider_info function to consolidate provider data into one-to-one results

* Merge remote-tracking branch 'origin/main' into feature/align-tin-npi

* Remove debug print statement from run_one_to_one_prompts function

* turn run_regex_fields into an orchestrator function by breaking parts of it into separate functions

* Remove unused import of get_matches function and add docstring to chunk_on_matches for clarity

* Add docstring to run_regex_fields for improved clarity and documentation

* fix provider name keys in merge_provider_info

* Remove unused functions get_matches, tin_npi_prompt, and clean_tin_npi from tin_npi_funcs.py

* Set provider name to "UNKNOWN" if cleaned name is empty in clean_provider_info

* Add unit tests for clean_provider_info function to validate data processing

* Enhance docstring for get_all_matches function

* Add tests for get_all_matches and chunk_on_matches functions

* Merge remote-tracking branch 'origin/main' into feature/align-tin-npi

* Implement merge_provider_info function to consolidate provider data into one-to-one results

* Refactor merge_provider_info to simplify list conversion for group and other provider information

* Remove unnecessary TIN and NPI postprocessing step from postprocess function

* Remove clean_tin_npi_other function and its invocation from postprocess function

* Use json prompts for TIN/NPI/Name and inject them into TIN_NPI_TEMPLATE

* Rename run_regex_fields to run_provider_info_fields

* Enhance TIN_NPI_TEMPLATE to include detailed instructions for extracting provider entities and their identifying information, including IS_GROUP logic for main contracting parties.

* moved TIN/NPI regexes to regex_patterns.py

* Remove unnecessary blank line in investment_values.py

* Remove debug print statements from run_provider_info_fields and get_provider_info functions

* Enhance clean_provider_info to handle various representations of IS_GROUP as boolean

* Enhance get_provider_info to include error handling for JSON parsing and ensure consistent return format


Approved-by: Katon Minhas
2025-04-18 20:50:25 +00:00
Alex Galarce 54910a7459 Merged in hotfix/flatten-list-to-string (pull request #478)
Hotfix/flatten list to string

* updated
* rate fields fix
* updated the singleton_list
* updated
* added
* Checked_files

* added

* Merged main into hotfix/flatten-list-to-string

* format_rate_fields_with_commas

* Update test

* flatten_singleton_string_list - new cases

* Update

* Removed unneccessary case

* Remove case

* Updated the test cases
* Merge remote-tracking branch 'origin/main' into hotfix/flatten-list-to-string

* Refactor flatten_singleton_string_list to handle empty input and return a comma-separated string for multiple elements


Approved-by: Katon Minhas
2025-04-16 17:42:51 +00:00
VenkataKrishna Reddy Avula df5f6088c7 Merged in hotfix/reimb_issue_fixes (pull request #477)
Hotfix/reimb issue fixes

* updated DYNAMIC_CHECK prompt

* updated date_fix_prompt to YYYYMMDD format

* filled N/A values for REIMB_PROV_TIN

* changed YYYYMMDD to YYYY/MM/DD

* extracting TIN, NPI,NAME as a tuple

* updated TIN, NPI,NAME as a tuple prompt

* Merge remote-tracking branch 'origin/main' into hotfix/reimb_issue_fixes

* fix: correct spelling of 'memorize' to 'memoize' in cache decorator comment

* combined postprocess date format check functions

* Merged main into hotfix/reimb_issue_fixes

* updated postprocessing

* rename and slight refactor

* remove unused imports, re-sort

* remove unused imports from postprocess.py

* Fix unit tests

* re-add imports which are needed for tests to pass (?)

* Fix column name in auto-renewal termination date handling

* Fix formatting in postprocess function


Approved-by: Katon Minhas
2025-04-14 21:51:34 +00:00
Rahul Ailaboina d6abe44a69 Merged in feature/postprocess-Cleanup (pull request #464)
Feature/postprocess Cleanup

* Added aarete derived

* removed the dev file
* reverted
* Merge branch 'main' into feature/postprocess-Cleanup

* Update poetry lock

* Update poetry and pyproject

* Update poetry

* Update field path

* Update test_date_postprocess

* Update tests

* Merged main into feature/postprocess-Cleanup

* Update test

* Update test

* addedfield_json_path

* minor changes

* removed

* Updated

* minor change

* added llm invoke

* removed unnecessary imports

* add

* self added

* removed comments

* Merged main into feature/postprocess-Cleanup

* Merged main into feature/postprocess-Cleanup


Approved-by: Katon Minhas
2025-04-08 20:14:49 +00:00
Katon Minhas 839f13d934 Merged in hotfix/dynamic-error (pull request #470)
Hotfix/dynamic error

* Bugfix

* update tests


Approved-by: Alex Galarce
2025-04-08 20:13:22 +00:00
Katon Minhas a9da72871e Merged in feature/dynamic-one-to-one (pull request #461)
Feature/dynamic one to one

* Pass N/A to one-to-one

* E2E test passed

* Merged main into feature/dynamic-one-to-one

* Pass ANY non N/A answer to reimbursement-level

* Update test

* Remove test

* Merge branch 'main' into feature/dynamic-one-to-one

* Wrap clean_dates

* Revert postprocess

* Merged main into feature/dynamic-one-to-one

* Merged main into feature/dynamic-one-to-one

* Remove prints


Approved-by: Alex Galarce
2025-04-08 18:29:39 +00:00
Katon Minhas 73b106b041 Merged in field_group/optimize_dynamic (pull request #459)
field group/optimize dynamic

* refactor tin/npi

* Refactor dynamic

* Refactor dynamic

* testing

* Save

* Merge branch 'main' into field_group/optimize_dynamic

* Merge branch 'main' into field_group/optimize_dynamic

* Prompt improvements

* save

* Move fill na mapping to AArete-Derived section

* MR prep

* Fix pipeline

* Merged main into field_group/optimize_dynamic

* Save

* Split crosswalk and aarete-derived

* Merge prep

* Pipeline fixes

* update test


Approved-by: Alex Galarce
2025-03-31 20:07:19 +00:00
Katon Minhas f8b8a580ff Merged in fields/additional-initializations (pull request #447)
fields/additional initializations

* Set up test file

* New fields + new field names

* Add initial prompts to json

* Column renaming - remove CONTRACT_ prefix

* update tests

* testing

* Fix regex pattern in json.loads

* Merge branch 'hotfix/file-errors' into refactor/new-field-names

* add UNIT_OF_MEASURE

* initialize new values

* Add rate change interval

* Merge branch 'main' into fields/additional-initializations

* remove test

* replace field names

* update REIMB_ID

* update date columns

* update reimbursement effective dt

* Revert adhoc scripts

* Revert client files

* Update postprocessing_funcs

* revert regex_utils

* Fix valid issue

* UNIT_OF_MEASURE

* REIMB_TERM

* Revert postprocessing funcs tests


Approved-by: Alex Galarce
2025-03-21 18:11:55 +00:00
Katon Minhas 86db2ea0b7 Merged in bugfix/table-error-fix (pull request #444)
Bugfix/table error fix

* handle multipage table data correctly

* same metadata for all tables on the page

* Multiple tables on page, non-continuous, split

* Add back align_and_format_tables

* update unit tests

* Merged main into bugfix/table-error-fix

* improved align and format table prompt

* Successful E2E test on San Joaquin - without running align and format table prompt

* San Joaquin e2e test passed

* Merged main into bugfix/table-error-fix

* Merge branch 'main' into bugfix/table-error-fix

* Add same number of columns condition

* Merged main into bugfix/table-error-fix

* Clean investment_values

* Remove import

* docstrings

* Remove test doc

* Add back original ALIGN_AND_FORMAT_TABLES prompt for client work

* Remove import

* Add config reference

* Merged main into bugfix/table-error-fix

* Move table_utils to investment.table_funcs

* restore table_utils.py

* Update tests

* update preprocess


Approved-by: Alex Galarce
2025-03-18 18:41:31 +00:00
VenkataKrishna Reddy Avula 576ea95b6d Merged in code-breakout-mismaps (pull request #419)
DAIP2-112 - fixed get code descriptions

* indirect proc codes added

* bug fix

* bug fix

* Merge branch 'main' into proc-code-indirect

* description mapping handling X's and 0's

* bug fix

* Merge remote-tracking branch 'origin/proc-code-indirect' into code-breakout-mismaps

* testing mismaps

* revenue codes mapping for int values

* added function to find ranges

* removed test files

* Merged main into code-breakout-mismaps

* Merge branch 'main' into code-breakout-mismaps
pulled latest changes from main

* added unit test for find containing ranges

* modified find_containing_ranges_test file

* Merged main into code-breakout-mismaps

* added embeddings to git ignore

* updated find_containing_ranges_test.py


Approved-by: Alex Galarce
Approved-by: Katon Minhas
2025-03-03 16:07:29 +00:00
Alex Galarce ac6f28bc44 Merged in hotfix/format-dates-yyyy-mm-dd (pull request #413)
Update date formatting in prompts to YYYY/MM/DD

* Update date formatting in prompts to YYYY/MM/DD

* fix tests for new date formatting


Approved-by: Katon Minhas
2025-02-25 00:30:06 +00:00
Katon Minhas b296cd187b Merged in bugfix/dynamic-assignment-issue (pull request #408)
Bugfix/dynamic assignment issue

* Merged main into feature/proc-desc

* Uncomment test code

* Bugfix

* script optimisation for codes

* modified is empty function in string utils

* Remove test.py

* bug fix to handle list of proc_codes

* Merged main into bugfix/proc-code-lists

* changed any method to all method in list handling

* code mapping moved outside to run once

* Merge branch 'feature/daip2-97' into bugfix/proc-code-lists

* merge conflict fixed

* merge conflicts fixed

* incorporated latest changes from main

* Merged main into bugfix/proc-code-lists

* Move load all dataset to io_utils

* Fix list is_empty

* Updated poetry.lock

* Bugfix

* Docstring

* Docstrings

* Merge branch 'main' into bugfix/proc-code-lists

* Merge branch 'bugfix/proc-code-lists' into bugfix/dynamic-assignment-issue

* Update test for no default exhibit_level_answer_dict

* Merged main into bugfix/dynamic-assignment-issue


Approved-by: Alex Galarce
2025-02-21 18:03:08 +00:00
Mayank Aamseek 9eb66c2c68 Merged in document_dates_optimization (pull request #397)
Document dates optimization

* simplified file processing for testing

* modified derived_term_date_prompt

* fixed day values with spaces or leading zeros

* modified contract termination date prompt

* updated termination date prompt

* reranking of chunks for better context

* exclude last date while calculating term date

* clean up

* clean up 2

* Merge branch 'main' into document_dates_optimization
pulled latest changes from main

* Merged main into document_dates_optimization

* fix unit tests

* Merged main into document_dates_optimization

* refactor: update termination date prompt for clarity and accuracy

* Merged main into document_dates_optimization

* fix pipeline

* Merge remote-tracking branch 'origin/main' into document_dates_optimization

* Merge branch 'document_dates_optimization' of https://bitbucket.org/aarete/doczy.ai into document_dates_optimization


Approved-by: Katon Minhas
2025-02-18 20:10:46 +00:00
Katon Minhas 7724a7ddc4 Merged in hotfix/pipeline-fix (pull request #393)
Draft: update unit tests

* update unit tests

* Update unit tests

* Update unit tests


Approved-by: Alex Galarce
2025-02-12 18:59:59 +00:00
Alex Galarce 524968f09f Merged in bugfix/exhibit-page-fix-pipeline (pull request #390)
Bugfix/exhibit page fix pipeline

* Fix broken get_exhibit_pages tests

* Add __repr__ method to FieldSet for better string representation


Approved-by: Katon Minhas
2025-02-10 22:59:10 +00:00
Alex Galarce e34262fc86 Merged in test/check-doc-dates-against-test-bed (pull request #380)
Test/check doc dates against test bed

* first commit

* Enhance prompts and processing for contract termination dates

- Updated prompt to include 'year to year' as a valid example output.
- Implemented case-insensitive processing for contract text and field keywords for smart chunking.
- Clarified prompt for derived termination date to specify it is exclusive of renewals

* Merge remote-tracking branch 'origin/main' into test/check-doc-dates-against-test-bed

* Update termination date prompt tests

* Refine keywords for contract termination date prompt in investment prompts


Approved-by: Katon Minhas
2025-02-03 22:49:16 +00:00
Katon Minhas 71e0eb5c45 Merged in feature/reimbursement-level-tins (pull request #379)
Initialize Reimbursement-Level TINs

* Initialized Reimbursement-Level TIN and NPI

* Update unit tests

* Docstrings and cleanup

* Update test


Approved-by: Alex Galarce
2025-02-03 21:50:50 +00:00
Alex Galarce 55f96e77fc Merged in feature/contract_to_aarete_derived_fields (pull request #376)
Feature/contract to aarete derived fields

* aarete derived prompt template added

* get_aarete_derived function added

* fixed valid values issue

* fixed valid values

* modified aarete derived for dataframe

* Merge remote-tracking branch 'origin/main' into feature/contract_to_aarete_derived_fields

* add commented-out test shell

* Fixed one_to_n file running

* updated PIPE_FORMAT_INSTRUCTIONS

* Fix conflict

* Update FieldSet class filters

* Updated crosswalk mapping integration

* Merged main into feature/contract_to_aarete_derived_fields

* Merge branch 'main' into feature/contract_to_aarete_derived_fields

* Merged main into feature/contract_to_aarete_derived_fields

* Removed test functionality

* aareted derived llm values for unique column values

* investment_prompts.py edited online with Bitbucket
* Removed print statements

* Changed load_from_file - field_set = FieldSet(file_path=fields.json, relationship=one-to-one, field_type=True, base_field=True)

* Throw type error

* Remove ellipsis


Approved-by: Katon Minhas
2025-02-03 17:29:59 +00:00
Alex Galarce 95fe703137 Merged in fields/document-dates-further-iteration (pull request #377)
Fields/document dates further iteration

* add concise date fix prompt

* Refactor and prepare for postprocessing formatting

* Merged main into fields/document-dates-further-iteration

* Merged main into fields/document-dates-further-iteration

* Implement memoization for date postprocessing and add derived termination date calculation

* Merge branch 'fields/document-dates-further-iteration' of https://bitbucket.org/aarete/doczy.ai into fields/document-dates-further-iteration

* fix mypy error

* tweaks to derived termination date

* Add docstring to derived_term_date_prompt and create unit tests for prompt generation

* fix memoization in postprocess.py

* Merged main into fields/document-dates-further-iteration


Approved-by: Katon Minhas
2025-01-31 22:36:11 +00:00
Alex Galarce baba7b6552 Merged in feature/doc-date-iterations (pull request #373)
Feature/doc date iterations

* add parse_chunk()

* add stitch_chunks() and tests

* create new constant

* put in new stitch_chunks() function

* resolve output validation TODO

* Merged main into feature/clean-up-smart-chunking

* fix Mayank's callout of noncontiguous chunks, fix typos, add tests

* add comment on test

* Merge remote-tracking branch 'origin/main' into feature/doc-date-iterations

* add 'signature page' to effective date keywords.  loosen instructions on termination date.

* enhance prompts with examples and clarify instructions for termination date

* fix for group_fields()

* clean up test imports


Approved-by: Katon Minhas
2025-01-30 21:37:02 +00:00
Alex Galarce 178036e7f3 Merged in feature/clean-up-smart-chunking (pull request #370)
Feature/clean up smart chunking

* add parse_chunk()

* add stitch_chunks() and tests

* create new constant

* put in new stitch_chunks() function

* resolve output validation TODO

* Merged main into feature/clean-up-smart-chunking

* fix Mayank's callout of noncontiguous chunks, fix typos, add tests

* add comment on test

* Merged main into feature/clean-up-smart-chunking


Approved-by: Katon Minhas
2025-01-30 16:35:17 +00:00
Katon Minhas 063c95d6ac Merged in feature/dynamic_and_generalized_branch (pull request #361)
feature/dynamic and generalized branch

* included txt files for nltk_data

* move nltk_data to src

* Fix last upload count

* Last upload count bugfix

* Fixed B processing

* Remove client-specific postprocessing

* split consolidate_output

* Run by file

* Fix output

* Reconfigure smart_chunk fields

* Add Full Context

* Fix merge conflicts

* Regex, Smart-Chunked, and Full working - not adding smart-chunked-->full when necessary

* Modernized run_full_context_fields()

* Switched set to list in field_context

* Move fields from smart_chunked to full_context as part of 'field_context' function

* Working version with placeholders

* Update poetry and pyproject

* Update s3 output

* Remove deprecated unit test

* Updated error messages

* Updated smart chunk ac name to one to one

* Update dependencies - end-to-end test for write s3 functional

* Add basic multithreading

* Send individual output to s3/local


Approved-by: Alex Galarce
2025-01-27 19:39:23 +00:00
Alex Galarce d345dd0ed3 Merged in feature/integrate-standard-and-complex (pull request #356)
Feature/integrate standard and complex

* last edits to merge_tables_draft_v2 before moving to table_funcs

* migrate to table_utils.py

* fix typehint that caused mypy error

* fix mypy errors

* black and isort

* fix error with multi-table pages

* update poetry.lock

* add tests, fix bug when table start marker or table end marker is missing

* added more tests

* tests for get_str_dictionaries_from_text()

* fix edge case in get_str_dictionaries_from_text

* fix mypy error

* more tests

* add tests, add handling for invalid dictionaries

* add tests

* add tests for insert_column_headers()

* update requirements

* add new simple/complex logic to preprocess.py

* remove files used solely for testing

* split pages into sub-pages by tables

* add table split on end marker.  Also add tests

* add docstrings, change control flow

* remove unused tests, add TODO for new tests

* get in prompt changes and intermediate decisions

* TODO for future enhancement for get_exhibit_pages


Approved-by: Katon Minhas
2025-01-24 22:46:59 +00:00
Alex Galarce 87208a401a Merged in hotfix/fix-page-splitting (pull request #359)
fix broken newline regex by removing it

* fix broken newline regex by removing it


Approved-by: Katon Minhas
2025-01-17 20:25:55 +00:00
Siddhant Medar 04d268a2f8 Merged in task/unit-tests-investment-and-client (pull request #354)
Task/unit tests investment and client

* move io_utils.py

* add __init__.py

* refactor: move string_funcs and update import paths to use utils namespace

* rename string_funcs to string_utils

* move and rename table_utils.py

* refactor: rename claude_funcs to llm_utils in multiple files

* update unit tests

* added unit tests for src/string_utils.py

* added unit tests for src/table_utils.py

* added unit tests for src/llm_utils.py

* added unit tests for src/io_utils.py

* Merge branch 'main' into task/unit-tests-investment-and-client; TODO: fix unit tests

* Unit tests to fix

* fix unit tests

* fix invalid references

* add unit tests for preprocessing_funcs.py

* move pytest-mock to test dependencies

* Merge remote-tracking branch 'origin/main' into task/unit-tests-investment-and-client

* add tests/string_utils_test.py

* removed filename parameters for a few functions

* save postprocessing_funcs_test midway

* save postprocessing_funcs_test

* postprocessing_funcs unit tests complete

* Merge branch 'main' into task/unit-tests-investment-and-client


Approved-by: Katon Minhas
2025-01-17 17:15:32 +00:00
Katon Minhas dfbe47ef28 Merged in refactor/prompt_refactor (pull request #353)
READY: Refactor/prompt refactor

* Prompt refactor

* refactor imports

* Prompt refactor

* Import refactor

* Remove excess prompts from investment_prompts.py


Approved-by: Alex Galarce
2025-01-13 21:11:36 +00:00
Siddhant Medar a9e48333de Merged in bugfix/yn_fixes (pull request #352)
bugfix for yn_fixes function and unit tests for it

* bugfix for yn_fixes function and unit tests for it


Approved-by: Alex Galarce
2025-01-10 21:20:33 +00:00
Katon Minhas 3bb6abbcef Merged in feature/simplify-b-field-chunking (pull request #348)
feature/simplify b field chunking

* Add chunk_by_exhibit function and unit tests

* Refactor preprocess

* Updated to run BU primary on entire Exhibit

* Makes BU secondary compatible with exhibit chunk mapping

* Added unit tests for get_exhibit_chunk

* Trimmed TD funcs

* Downstream changes to run_top_down

* Removed conditional funcs

* Merged main into feature/simplify-b-field-chunking

* removed conditional funcs import

* Merged main into feature/simplify-b-field-chunking

* Fixed run_bottom_up_primary arguments

* Fixed TD primary input

* Fixed grouped keyword mappings

* Remove filename tracking until postprocessing

* Removed postprocessing for client columns

* Removed col-based postprocessing

* Merged main into feature/simplify-b-field-chunking

* Fixed NoneType

* Add docstrings

* Updated unit tests for removal of 'Filename'

* Updated comments


Approved-by: Alex Galarce
2025-01-10 17:24:44 +00:00
Siddhant Medar ab71bd8dae Merged in task/unit-tests-investment-and-client (pull request #346)
Task/unit tests investment and client

* move io_utils.py

* add __init__.py

* refactor: move string_funcs and update import paths to use utils namespace

* rename string_funcs to string_utils

* move and rename table_utils.py

* refactor: rename claude_funcs to llm_utils in multiple files

* update unit tests

* added unit tests for src/string_utils.py

* added unit tests for src/table_utils.py

* added unit tests for src/llm_utils.py

* added unit tests for src/io_utils.py

* Merge branch 'main' into task/unit-tests-investment-and-client; TODO: fix unit tests

* Unit tests to fix

* fix unit tests

* fix invalid references


Approved-by: Alex Galarce
2025-01-09 17:59:28 +00:00
Alex Galarce 53b38ea15c Merged in refactor/split-investment-and-client (pull request #347)
Refactor/split investment and client

* refactor: clean up tests

* Renamed tests/qcqa to tests/qa_qc for consistency

* comment out faulty test - see docstring note at top

* split to client/investment

* add __init__.py to investment and client to avoid mypy confusion

* fix imports

* update imports for consistency across investment module

* move back to one config

* try changing import to relative

* add init.py to src

* try relative import

* try one more sys.path.append

* fix path for client main

* fix imports in file_processing

* make prompts common

* move keywords out to `src`

* move smart_chunking_funcs to `src`

* fix mypy error

* start moving to explicit imports

* remove old keywords and fix imports for keywords and prompts

* change all imports to full paths

* fix unit tests

* add readme for new way of running things

* isort after all that import work

* remove unused sys.path.append from some tests


Approved-by: Katon Minhas
2025-01-08 21:59:47 +00:00
Katon Minhas 64e754d40f Merged in refactor/hotfix_refactor (pull request #344)
Refactor/hotfix refactor

* Initial hotfix refactor

* Fix references

* Remove test


Approved-by: Alex Galarce
2025-01-06 22:39:55 +00:00
Alex Galarce 3740588efa Merged in refactor/daip-2-9-code-refactor (pull request #339)
Refactor/daip2-9 code refactor

* add missing import

* refactor ac_smart_chunking.py

* update tests

* removed old and unused imports

* removed outdated import

* forgot to import re

* refactor bottom up funcs

* remove unused imports from file_processing.py

* refactor dict_operations.py

* remove unused import from conditional_funcs.py

* replace top_down_funcs with one_to_n_funcs and remove top_down_funcs.py

* remove duplicate import from one_to_n_funcs.py

* refactor all utils.py imports

* refactor error handling by removing last code in utils and integrating InvalidDateException into postprocessing_funcs

* refactor import in claude_funcs.py to use string_funcs directly and (hopefully) resolve circular import

* refactor regex_funcs.py to use postprocessing_funcs for add_hyphen_if_needed calls

* refactor hotfix_helper_funcs.py to use postprocessing_funcs for add_hyphen_if_needed calls

* refactor postprocess.py to remove unused imports

* add numpy import to string_funcs

* fix tests after utils refactor

* move adhoc from tests to scripts

* remove unused imports

* remove scripts from mypy checking

* isort

* Merged main into refactor/daip-2-9-code-refactor


Approved-by: Katon Minhas
2025-01-06 15:39:29 +00:00
Faizan Mohiuddin 9a736fa80d Merged in feature/self-repair-main (pull request #313)
Feature/self repair main

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* new testing

* new testing

* added unit tests under fieldExtraction/tests/main-unit-tests

* unit test fixes

* unit test fixes

* merge into main

* modified consolidate_output and slight changes to qa_qc_helpers to accomodate qaqc functionality w faizan and michael's changes

* merging self repair into main

* synced with main now

* fixes

* provider billing removed

* provider billing removed

* provider billing fixed

* commented out load dotenv in config

* Merged main into feature/self-repair-main

* modified check_s3_bucket_exists function by returning False if credentials not found for pipeline

* Merge branch 'feature/self-repair-main' of https://bitbucket.org/aarete/doczy.ai into feature/self-repair-main


Approved-by: Michael McGuinness
2024-12-17 16:34:59 +00:00
Chris Bull 26c12469bc Merged in QCQA_Additions (pull request #331)
QCQA Additions

* tested on batch 10, small fixes + change to s3 output

* Merged main into QCQA_Additions

* unit tests for qc qa helpers

* static error fix

* another static fix

* static fix again

* fixed None check

* static fix none

* Merged main into QCQA_Additions

* Small changes based on Katon's review


Approved-by: Katon Minhas
2024-12-13 19:23:04 +00:00
Alex Galarce c6a854b2b9 Merged in hotfix/cleaned-new-date-regex (pull request #325)
Hotfix/cleaned new date regex

* new date pattern

* add tests


Approved-by: Katon Minhas
2024-12-10 17:14:51 +00:00
Chris Bull 54a62944aa Merged in QCQA_Integration (pull request #311)
QCQA Integration

* Merged in bugfix/npi_hotfix (pull request #305)

double filter for duplicates

* double filter for duplicates


Approved-by: Katon Minhas

* Merged in chore/npi (pull request #309)

npi hotfix into main

* npi hotfix into main

* npi hotfix into main


Approved-by: Alex Galarce

* Merged in chore/irs (pull request #310)

irs hotfix into main

* irs hotfix into main

* pass top sheet to irs hotfix func

* docstring updates


Approved-by: Alex Galarce

* slight fix to methodology short fix

* Merged in bugfix/all_cnc_hotfixes (pull request #302)

DRAFT: Bugfix/all cnc hotfixes

* Pipeline fix - health plan state

* Update for prompt vs non-prompt fixes

* Revert utils.find_regex_matches()

* Remove prints

* Non-prompt run

* Health Plan State, IRS, NPI, LOB, Lesser, Prov 2, Default, Rate Standard, Contract Effective Date, Term Group

* Merged in bugfix/agreement_name (pull request #294)

contract title fixed

* contract title fixed

* Merged bugfix/all_cnc_hotfixes into bugfix/agreement_name

Approved-by: Katon Minhas

* All hotfixes added

* Fixed utils

* fix for clean_contract_effective_date
* Merged in default-fix (pull request #296)

moved default funcs to the top, dropped intermediate columns

* moved default funcs to the top, dropped intermediate columns

Approved-by: Katon Minhas

* quick fix to dropping extra columns

* Merged in bugfix/effective_date_meridian (pull request #297)

fixed effective date for meridian contracts

* fixed effective date for meridian contracts

Approved-by: Kat…
* Merged in hotfix/irs_tweak (pull request #303)

returning None instead on str(N/A)

* returning None instead on str(N/A)


Approved-by: Katon Minhas

* Merged in bugfix/npi_hotfix (pull request #305)

double filter for duplicates

* double filter for duplicates


Approved-by: Katon Minhas

* Merged in bugfix/all_cnc_hotfixes (pull request #302)

DRAFT: Bugfix/all cnc hotfixes

* Pipeline fix - health plan state

* Update for prompt vs non-prompt fixes

* Revert utils.find_regex_matches()

* Remove prints

* Non-prompt run

* Health Plan State, IRS, NPI, LOB, Lesser, Prov 2, Default, Rate Standard, Contract Effective Date, Term Group

* Merged in bugfix/agreement_name (pull request #294)

contract title fixed

* contract title fixed

* Merged bugfix/all_cnc_hotfixes into bugfix/agreement_name

Approved-by: Katon Minhas

* All hotfixes added

* Fixed utils

* fix for clean_contract_effective_date
* Merged in default-fix (pull request #296)

moved default funcs to the top, dropped intermediate columns

* moved default funcs to the top, dropped intermediate columns

Approved-by: Katon Minhas

* quick fix to dropping extra columns

* Merged in bugfix/effective_date_meridian (pull request #297)

fixed effective date for meridian contracts

* fixed effective date for meridian contracts

Approved-by: Kat…
* Merged in hotfix/irs_tweak (pull request #303)

returning None instead on str(N/A)

* returning None instead on str(N/A)


Approved-by: Katon Minhas

* Merged in bugfix/npi_hotfix (pull request #305)

double filter for duplicates

* double filter for duplicates


Approved-by: Katon Minhas

* Merged in chore/npi (pull request #309)

npi hotfix into main

* npi hotfix into main

* npi hotfix into main

Approved-by: Alex Galarce

* Merged in chore/irs (pull request #310)

irs hotfix into main

* irs hotfix into main

* pass top sheet to irs hotfix func

* docstring updates


Approved-by: Alex Galarce

* Merged in bugfix/clean_short_methodology (pull request #312)

changed regex pattern in get_short_methodology

* changed regex pattern in


Approved-by: Katon Minhas

* Merged in hotfix/filename_fix (pull request #314)

filename corrected

* filename corrected

* Merged main into hotfix/filename_fix


Approved-by: Katon Minhas

* Merge remote-tracking branch 'remotes/origin/main' into HEAD

* rearranged qcqa scripts/funcs and prep for merge w main, moved lots of stuff to postprocess

* slight change to icm_number_fix

* transitioned some qcqa funcs to postprocessing, added fields to qcqa report

* Merged main into QCQA_Integration

* reorganization of qa qc helpers, consolidate_output, qa_qc from Katon's feedback

* adhoc and at scale qcqa ran successfully

* fix to consolidate_output

* Merge remote-tracking branch 'remotes/origin/main' into QCQA_Integration

* Merged main into QCQA_Integration

* small changes to npi_check, changed name of config.CONTRACT_FILE_NAME to config.FILE_NAME_COLUMN


Approved-by: Katon Minhas
2024-12-06 17:27:42 +00:00
Alex Galarce 47a01e13f0 Merged in chore/contract_effective_date (pull request #307)
New Prompt Method (starting with contract effective date)

* add todos for Siddhant

* moved effective date prompts to prompts.py and added docstring and type hints

* moved effective date prompts to prompts.py and added docstring and type hints

* fixed conflict

Co-authored-by: Alex Galarce <agalarce@aarete.com>

* modified contract effective date logic in existing smart chunking

* Merged main into chore/contract_effective_date

* updated extract_text_from_delimiters function and unit tests for it

* Merge remote-tracking branch 'origin/main' into chore/contract_effective_date

* added comments to preprocessing_funcs

* preprocessing_funcs.py edited online with Bitbucket
* utils.py edited online with Bitbucket
* add debug line

* add NA handling into fix_date_formatting()

* add debug print statements

* worked on review comments

* fixed date checking

* fixed date checking and added unit tests

* Merged main into chore/contract_effective_date

* added logic to handle case when smart chunking returns empty context for effective date

* added comments to file_processing.py

* optimized imports and removed a TODO

* Merged main into chore/contract_effective_date

* made prompt changes for effective date

* keywords.py edited online with Bitbucket
* Removed excess print statements


Approved-by: Katon Minhas
2024-12-05 22:46:41 +00:00
Alex Galarce 6264da6d7e Merged in feature/cost_log_aggregations (pull request #299)
Feature/cost log aggregations

* add costlog aggregation options

* rename output variables

* more descriptive error message if aggregation fails

* Merged main into feature/cost_log_aggregations


Approved-by: Katon Minhas
2024-11-27 20:37:27 +00:00