Merged in feature/fix-crosswalk-mapping (pull request #491)
Feature/fix crosswalk mapping * Update mapping for claim_type * Fix reverse mapping issue * Remove test file Approved-by: Alex Galarce
This commit is contained in:
@@ -4,11 +4,11 @@
|
||||
"to_col": "AARETE_DERIVED_CLAIM_TYPE_CD"
|
||||
},
|
||||
"mapping": {
|
||||
"PROFESSIONAL": "M",
|
||||
"ANCILLARY":"M",
|
||||
"MEDICAL": "M",
|
||||
"FACILITY":"H",
|
||||
"HOSPITAL":"H",
|
||||
"INSTITUTIONAL":"H"
|
||||
"Professional": "M",
|
||||
"Ancillary":"M",
|
||||
"Medical": "M",
|
||||
"Facility":"H",
|
||||
"Hospital":"H",
|
||||
"Institutional":"H"
|
||||
}
|
||||
}
|
||||
@@ -50,13 +50,10 @@ def fill_na_mapping(answer_dicts):
|
||||
|
||||
return answer_dicts
|
||||
|
||||
|
||||
def get_crosswalk_fields(answer_dicts):
|
||||
crosswalk_fields = FieldSet(file_path=config.FIELD_JSON_PATH, crosswalk=True)
|
||||
|
||||
for answer_dict in answer_dicts:
|
||||
for to_field in crosswalk_fields.fields:
|
||||
|
||||
if string_utils.is_empty(answer_dict.get(to_field.field_name, None)): # If the to_field is not present, or is empty
|
||||
from_field = to_field.base_field
|
||||
if from_field in answer_dict.keys():
|
||||
@@ -69,11 +66,9 @@ def get_crosswalk_fields(answer_dicts):
|
||||
|
||||
# Apply mapping
|
||||
crosswalked_answer = apply_crosswalk(from_field_value, crosswalk_mapping)
|
||||
|
||||
# If mapping fails, apply the reverse mapping
|
||||
if str(crosswalked_answer) == from_field_value:
|
||||
if not crosswalked_answer:
|
||||
crosswalked_answer = apply_crosswalk(from_field_value, crosswalk_mapping_reverse)
|
||||
|
||||
answer_dict[to_field.field_name] = crosswalked_answer
|
||||
return answer_dicts
|
||||
|
||||
|
||||
Reference in New Issue
Block a user