diff --git a/fieldExtraction/crosswalk/mappings/crosswalk_claim_type.json b/fieldExtraction/crosswalk/mappings/crosswalk_claim_type.json index d78bf24..c49a16f 100644 --- a/fieldExtraction/crosswalk/mappings/crosswalk_claim_type.json +++ b/fieldExtraction/crosswalk/mappings/crosswalk_claim_type.json @@ -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" } } \ No newline at end of file diff --git a/fieldExtraction/src/investment/aarete_derived.py b/fieldExtraction/src/investment/aarete_derived.py index d3687ea..158fb12 100644 --- a/fieldExtraction/src/investment/aarete_derived.py +++ b/fieldExtraction/src/investment/aarete_derived.py @@ -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