Files
doczyai-pipelines/fieldExtraction/src/keywords.py
T
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

116 lines
4.5 KiB
Python

# Methodology
# regex = make 'keyword' arg a pattern (NPI, TIN, Dates, etc)
# hierarchical and/or = Run and condition first, if nothing, then run or
# hierarchy = run each keyword independently in order of listing - case sensitive
# and = run each keyword if all are present, case insensitive
# or = run each keyword if any are present, case insensitive
# Example: {'blue_group' : {'fields' : ['TermClause', ContractAuto', ...], 'methodology' : 'or', 'keywords' : ['renew', 'term']}
# "irs_group / "Gray Group":"
# 'Tax ID,TIN,IRS,Provider Name,National Provider Identifier,NPI,Other NPIs,To Provider At:,To Provider at:'
from src import config
GROUPED_KEYWORD_MAPPINGS = {
"term_group": {
"fields": [
"TERM_CLAUSE",
"CONTRACT_AUTO_RENEWAL_IND",
"CONTRACT_TERMINATION_DT",
"TERMINATION_UPON_NOTICE",
"TERMINATION_UPON_CAUSE",
],
"methodology": "or",
"keywords": ["TERM AND TERMINATION", "Term and Termination", "Term and termination", "term and termination", "Term"
, "Renew", "renew", "Auto renew", "auto renew", "automatically renew", "evergreen", "Evergreen"
, "upon notice", "Notice", "NOTICE", "with notice", "without cause", "With Cause", "with cause"
, "Termination", "Terminate"],
"case_sensitive": True,
},
"AGREEMENT_NAME": {
"fields": [
"CONTRACT_TITLE"
],
"methodology": "hierarchy",
"keywords": ["AGREEMENT", "AMENDMENT", "ADDENDUM", "PROVIDER", "CONTRACT", "MEMORANDUM", "LETTER", "REQUEST", "EFFECTIVE"],
"case_sensitive": False,
},
"notice_provider_group": {
"fields": ["NOTICE_PROVIDER_NAME", "NOTICE_PROVIDER_ADDRESS"],
"methodology": "or",
"keywords": ["Attn", "Inc.", "Suite", "Ste", "P.O Box", "To Provider at:"],
"case_sensitive": False,
},
"LATE_PAID_CLAIMS_LANGUAGE": {
"fields": ["LATE_PAID_CLAIMS_LANGUAGE"],
"methodology": "hierarchy",
"keywords": [
"late paid",
"late payment",
"interest",
"late fee",
"interest shall be paid",
"interest payment",
],
"case_sensitive": False,
},
"NON_RENEWAL_LANGUAGE": {
"fields": ["NON_RENEWAL_LANGUAGE"],
"methodology": "or",
"keywords": ["not to renew", "non-renewal", "non renewal", "nonrenewal"],
"case_sensitive": False,
},
"HCBS_SERVICES": {
"fields": ["HCBS_SERVICES"],
"methodology": "hierarchy",
"keywords": ["%", "Plan shall pay", "hcbs"],
"case_sensitive": False,
},
"POLICIES_AND_PROCEDURES": {
"fields": ["POLICIES_AND_PROCEDURES"],
"methodology": "or",
"keywords": ["2.4", "policies", "procedures"],
"case_sensitive": False,
},
"REGULATORY_REQUIREMENTS": {
"fields": ["REGULATORY_REQUIREMENTS"],
"methodology": "or",
"keywords": ["8.3", "6.4", "regulatory requirements", "regulatory"],
"case_sensitive": False,
},
"RECOVERY_RIGHTS": {
"fields": ["RECOVERY_RIGHTS"],
"methodology": "or",
"keywords": ["3.5", "recovery rights"],
"case_sensitive": False,
},
"RELATIONSHIP_OF_PARTIES_LANGUAGE": {
"fields": ["RELATIONSHIP_OF_PARTIES_LANGUAGE"],
"methodology": "or",
"keywords": ["8.1", "relationship of parties"],
"case_sensitive": False,
},
"EXCLUSIVITY_REQUIREMENT_LANGUAGE": {
"fields": ["EXCLUSIVITY_REQUIREMENT_LANGUAGE"],
"methodology": "or",
"keywords": ["27", "exclusiv"],
"case_sensitive": False,
},
"CONTRACT_EFFECTIVE_DT": {
"fields": ["CONTRACT_EFFECTIVE_DT"],
"methodology": "include_exclude",
"included_keywords" : ["Effective Date", "entered into", "shall be effective", "will become effective", "dated this", "made and entered into", "made this", "dated and effective"] \
if any([cand in config.BATCH_ID.lower() for cand in ["cnc-4","cnc-4a","cnc-4b"]]) \
else ["Effective Date", "entered into", "shall be effective", "will become effective"],
"excluded_keywords" : ["Permit","Registration","Department of Public Health"],
"case_sensitive": False,
},
"TERMINATION_UPON_NOTICE": {
"fields": ["TERMINATION_UPON_NOTICE"],
"methodology": "or",
"keywords": ["notice", "upon notice", "termination"],
"case_sensitive": False,
}
}