Merged in bugfix/prov_info_json_fixes (pull request #899)

Bugfix/prov info json fixes

* fix: robust PROV_INFO_JSON sanitization and TIN backfill logic

json_utils:
- Add sanitize_prov_info_json with layered parsing (JSON, literal_eval,
  empty-value-after-colon fix, best-effort dict extraction).
- Add _normalize_prov_entries and _prov_value_to_str for uniform
  str-valued output; flatten list values, strip TIN hyphens.
- format_prov_info_json now delegates to sanitize_prov_info_json.

postprocessing_funcs:
- Add fill_prov_info_tin_from_filename_tin for TIN backfill.
- Add validate_and_reformat_date (pipe-wrapped, datetime strings).
- Add format_as_json_list (pipe-delimited, comma-separated, quote
  stripping).

postprocess:
- Integrate new postprocessing helpers into pipeline flow.

postprocess_existing_output:
- Support CSV and Excel input, configurable paths, fillna for CSV.

tests:
- Add test_json_parsers.py for PROV_INFO_JSON parsing coverage.
- Add test_postprocess.py for date/list formatting and default_ind.

* Merge branch 'DAIP2-1947-tin-and-prov-info-json-issues' into bugfix/prov_info_json_fixes

* Merged DEV into bugfix/prov_info_json_fixes

* Strip out unused functionality

* Update filename_tin functionality

* Add docstring

* Update filename_tin cleaning in PROV_INFO_JSON

* test prep

* black format

* missing function added

* Merge branch 'DEV' into bugfix/prov_info_json_fixes

* Black format

* Strip unused functions

* Strip unused code

* update unit tests

* Merge branch 'DEV' into bugfix/prov_info_json_fixes

* Update test

* Simplify process

* handle list of group names

* Resolve run_provider_info_field call

* Merge branch 'DEV' into bugfix/prov_info_json_fixes

* Correct type hints

* Fix unit tests

* Fix unit test

* Remove redundant postprocessing_funcs


Approved-by: Katon Minhas
This commit is contained in:
Mayank Aamseek
2026-03-06 20:40:20 +00:00
committed by Katon Minhas
parent 6744c57f95
commit 3331da2a8c
18 changed files with 549 additions and 548 deletions
+18
View File
@@ -1094,6 +1094,24 @@ def token_signature(text: str) -> tuple:
return tuple(sorted(tokens))
def remove_hyphens(value):
"""
Remove hyphens from the input value.
Args:
value : The input might be list or string
Returns:
str: The cleaned value with hyphens removed.
"""
if value is None:
return ""
if isinstance(value, str):
return value.replace("-", "")
elif isinstance(value, list):
return [v.replace("-", "") if isinstance(v, str) else v for v in value]
return value
def keyword_match(text: str, keywords: list) -> bool:
"""
Check if text contains any of the keywords (case-insensitive).