From 6f35e04c5569916a08141e1965c902dc97537fe2 Mon Sep 17 00:00:00 2001 From: tyler-spangler6 <142833783+tyler-spangler6@users.noreply.github.com> Date: Mon, 9 Dec 2024 11:51:42 -0700 Subject: [PATCH] Revert "Add API Field to Track Testing Classifications (#3813)" This reverts commit 7151d26075b2960aae87525d36cb5857907248be. --- domain-cc/cc-app/src/python_src/api.py | 4 +- .../cc-app/src/python_src/pydantic_models.py | 1 - domain-cc/cc-app/tests/test_logging.py | 83 ------------------- 3 files changed, 2 insertions(+), 86 deletions(-) diff --git a/domain-cc/cc-app/src/python_src/api.py b/domain-cc/cc-app/src/python_src/api.py index 6b455b1d1..5eed7c1e3 100644 --- a/domain-cc/cc-app/src/python_src/api.py +++ b/domain-cc/cc-app/src/python_src/api.py @@ -143,7 +143,6 @@ 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": @@ -151,6 +150,8 @@ def log_contention_stats( logging_dict, contention.contention_text, log_contention_text ) + # log_as_json(logging_dict) + # else: log_as_json(logging_dict) @@ -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, } ) diff --git a/domain-cc/cc-app/src/python_src/pydantic_models.py b/domain-cc/cc-app/src/python_src/pydantic_models.py index 2a6f6edab..30048fd41 100644 --- a/domain-cc/cc-app/src/python_src/pydantic_models.py +++ b/domain-cc/cc-app/src/python_src/pydantic_models.py @@ -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): diff --git a/domain-cc/cc-app/tests/test_logging.py b/domain-cc/cc-app/tests/test_logging.py index d733fba44..cfd724729 100644 --- a/domain-cc/cc-app/tests/test_logging.py +++ b/domain-cc/cc-app/tests/test_logging.py @@ -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", } @@ -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) @@ -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", }, { @@ -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", }, ] @@ -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, }, { @@ -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, }, ] @@ -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) @@ -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) @@ -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, }, { @@ -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", }, ] @@ -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)): @@ -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