diff --git a/domain-cc/cc-app/src/python_src/api.py b/domain-cc/cc-app/src/python_src/api.py index 55ebe52e03..d68bd578b1 100644 --- a/domain-cc/cc-app/src/python_src/api.py +++ b/domain-cc/cc-app/src/python_src/api.py @@ -6,7 +6,7 @@ from fastapi import FastAPI, HTTPException -from .pydantic_models import Claim, PredictedClassification +from .pydantic_models import Claim, ClaimLinkInfo, PredictedClassification from .util.brd_classification_codes import get_classification_name from .util.logging_dropdown_selections import build_logging_table from .util.lookup_table import ConditionDropdownLookupTable, DiagnosticCodeLookupTable @@ -111,3 +111,17 @@ def get_classification(claim: Claim) -> Optional[PredictedClassification]: log_as_json({"classification": classification}) return classification + + +@app.post("/claim-linker") +def link_vbms_claim_id(claim_link_info: ClaimLinkInfo): + log_as_json( + { + "message": "linking claims", + "va_gov_claim_id": sanitize_log(claim_link_info.va_gov_claim_id), + "vbms_claim_id": sanitize_log(claim_link_info.vbms_claim_id), + } + ) + return { + "success": True, + } 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 2daebaaaa1..a69ddcc353 100644 --- a/domain-cc/cc-app/src/python_src/pydantic_models.py +++ b/domain-cc/cc-app/src/python_src/pydantic_models.py @@ -27,3 +27,10 @@ class PredictedClassification(BaseModel): classification_code: int classification_name: str + + +class ClaimLinkInfo(BaseModel): + """used for connecting VA.gov and VBMS claims to each other in order to track contention changes downstream""" + + va_gov_claim_id: int + vbms_claim_id: int diff --git a/domain-cc/cc-app/tests/test_claim_linker.py b/domain-cc/cc-app/tests/test_claim_linker.py new file mode 100644 index 0000000000..2ec7e1fca4 --- /dev/null +++ b/domain-cc/cc-app/tests/test_claim_linker.py @@ -0,0 +1,18 @@ +from fastapi.testclient import TestClient + + +def test_claim_ids_logged(client: TestClient, caplog): + json_post_dict = { + "va_gov_claim_id": 100, + "vbms_claim_id": 200, + } + client.post("/claim-linker", json=json_post_dict) + expected_claim_link_json = { + 'level': 'info', + "message": "linking claims", + "va_gov_claim_id": 100, + "vbms_claim_id": 200, + } + log_as_dict = eval(caplog.records[0].message) + del log_as_dict["date"] + assert log_as_dict == expected_claim_link_json