Skip to content

Commit

Permalink
Revert "Add API Field to Track Testing Classifications (#3813)"
Browse files Browse the repository at this point in the history
This reverts commit 7151d26.
  • Loading branch information
tyler-spangler6 authored Dec 9, 2024
1 parent 040ee76 commit 6f35e04
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 86 deletions.
4 changes: 2 additions & 2 deletions domain-cc/cc-app/src/python_src/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,15 @@ def log_contention_stats(
"is_lookup_table_match": classification_code is not None,
"is_multi_contention": is_multi_contention,
"endpoint": request.url.path,
"is_ab_test_claim": claim.is_ab_test_claim,
}

if request.url.path == "/expanded-contention-classification":
logging_dict = log_expanded_contention_text(
logging_dict, contention.contention_text, log_contention_text
)

# log_as_json(logging_dict)
# else:
log_as_json(logging_dict)


Expand All @@ -173,7 +174,6 @@ def log_claim_stats_v2(
"num_processed_contentions": response.num_processed_contentions,
"num_classified_contentions": response.num_classified_contentions,
"endpoint": request.url.path,
"is_ab_test_claim": claim.is_ab_test_claim,
}
)

Expand Down
1 change: 0 additions & 1 deletion domain-cc/cc-app/src/python_src/pydantic_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class VaGovClaim(BaseModel):
claim_id: int
form526_submission_id: int
contentions: conlist(Contention, min_length=1)
is_ab_test_claim: Optional[bool] = False


class ClassifiedContention(BaseModel):
Expand Down
83 changes: 0 additions & 83 deletions domain-cc/cc-app/tests/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def test_log_contention_stats_expanded(mocked_func):
"is_lookup_table_match": True,
"is_multi_contention": False,
"endpoint": "/expanded-contention-classification",
"is_ab_test_claim": False,
"processed_contention_text": "acl tear",
}

Expand Down Expand Up @@ -108,7 +107,6 @@ def test_non_classified_contentions(mocked_func):
"is_lookup_table_match": False,
"is_multi_contention": False,
"endpoint": "/expanded-contention-classification",
"is_ab_test_claim": False,
"processed_contention_text": None,
}
mocked_func.assert_called_once_with(expected_log)
Expand Down Expand Up @@ -159,7 +157,6 @@ def test_multiple_contentions(mocked_func):
"is_lookup_table_match": True,
"is_multi_contention": True,
"endpoint": "/expanded-contention-classification",
"is_ab_test_claim": False,
"processed_contention_text": "tinnitus ringing hissing ears",
},
{
Expand All @@ -173,7 +170,6 @@ def test_multiple_contentions(mocked_func):
"is_lookup_table_match": True,
"is_multi_contention": True,
"endpoint": "/expanded-contention-classification",
"is_ab_test_claim": False,
"processed_contention_text": "anxiety",
},
]
Expand Down Expand Up @@ -234,7 +230,6 @@ def test_contentions_with_pii(mocked_func):
"is_lookup_table_match": False,
"is_multi_contention": True,
"endpoint": "/expanded-contention-classification",
"is_ab_test_claim": False,
"processed_contention_text": None,
},
{
Expand All @@ -248,7 +243,6 @@ def test_contentions_with_pii(mocked_func):
"is_lookup_table_match": False,
"is_multi_contention": True,
"endpoint": "/expanded-contention-classification",
"is_ab_test_claim": False,
"processed_contention_text": None,
},
]
Expand Down Expand Up @@ -311,7 +305,6 @@ def test_log_claim_stats(mocked_func):
"num_processed_contentions": 2,
"num_classified_contentions": 1,
"endpoint": "/expanded-contention-classification",
"is_ab_test_claim": False,
}
log_claim_stats_v2(test_claim, classifier_response, test_expanded_request)
mocked_func.assert_called_once_with(expected_log)
Expand Down Expand Up @@ -353,7 +346,6 @@ def test_current_classifier_contention(mocked_func):
"is_lookup_table_match": False,
"is_multi_contention": False,
"endpoint": "/va-gov-claim-classifier",
"is_ab_test_claim": False,
}

mocked_func.assert_called_once_with(expected_logging_dict)
Expand Down Expand Up @@ -404,7 +396,6 @@ def test_full_logging_expanded_endpoint(mocked_func):
"is_lookup_table_match": False,
"is_multi_contention": True,
"endpoint": "/expanded-contention-classification",
"is_ab_test_claim": False,
"processed_contention_text": None,
},
{
Expand All @@ -418,7 +409,6 @@ def test_full_logging_expanded_endpoint(mocked_func):
"is_lookup_table_match": True,
"is_multi_contention": True,
"endpoint": "/expanded-contention-classification",
"is_ab_test_claim": False,
"processed_contention_text": "anxiety",
},
]
Expand All @@ -439,7 +429,6 @@ def test_full_logging_expanded_endpoint(mocked_func):
"num_processed_contentions": 2,
"num_classified_contentions": 1,
"endpoint": "/expanded-contention-classification",
"is_ab_test_claim": False,
}

for i in range(len(test_contentions)):
Expand All @@ -454,75 +443,3 @@ def test_full_logging_expanded_endpoint(mocked_func):
log_claim_stats_v2(test_claim, classifier_response, test_expanded_request)
mocked_func.assert_called_with(expected_claim_log)
assert mocked_func.call_count == 3


@patch("src.python_src.api.log_as_json")
def test_claim_testing_log(mocked_func):
"""
Tests that the testing claim flag is logged correctly
"""
test_contention = Contention(
contention_text="acl tear right",
contention_type="NEW",
)
test_claim = VaGovClaim(
claim_id=100,
form526_submission_id=500,
contentions=[test_contention],
is_ab_test_claim=True,
)
classified_contention = ClassifiedContention(
classification_code=8997,
classification_name="Musculoskeletal - Knee",
diagnostic_code=None,
contention_type="NEW",
)
log_contention_stats(
test_contention, classified_contention, test_claim, test_expanded_request
)

test_response = ClassifierResponse(
contentions=[classified_contention],
claim_id=test_claim.claim_id,
form526_submission_id=test_claim.form526_submission_id,
is_fully_classified=False,
num_processed_contentions=1,
num_classified_contentions=1,
)

expected_logging_dict = {
"vagov_claim_id": test_claim.claim_id,
"claim_type": "new",
"classification_code": classified_contention.classification_code,
"classification_name": classified_contention.classification_name,
"contention_text": "unmapped contention text ['acl tear']",
"diagnostic_code": "None",
"is_in_dropdown": False,
"is_lookup_table_match": True,
"is_multi_contention": False,
"endpoint": "/expanded-contention-classification",
"is_ab_test_claim": True,
"processed_contention_text": "acl tear",
}

mocked_func.assert_called_with(expected_logging_dict)

log_claim_stats_v2(test_claim, test_response, test_expanded_request)

expected_claim_logging_dict = {
"claim_id": test_claim.claim_id,
"form526_submission_id": test_claim.form526_submission_id,
"is_fully_classified": test_response.is_fully_classified,
"percent_clasified": (
test_response.num_classified_contentions
/ test_response.num_processed_contentions
)
* 100,
"num_processed_contentions": test_response.num_processed_contentions,
"num_classified_contentions": test_response.num_classified_contentions,
"endpoint": "/expanded-contention-classification",
"is_ab_test_claim": True,
}

mocked_func.assert_called_with(expected_claim_logging_dict)
assert mocked_func.call_count == 2

0 comments on commit 6f35e04

Please sign in to comment.