Skip to content

Commit 180d01e

Browse files
Merge branch master into clewellyn-nava/BFD-4695/profile-query-optimization
# Conflicts: # apps/bfd-server-ng/scripts/README.md # apps/bfd-server-ng/scripts/jpa_graph.py # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/ClaimAsyncService.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/ClaimRepository.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/ClaimIDRLoadDate.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/ClaimLineProfessionalNch.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/ClaimLineProfessionalSharedSystems.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/ClaimRx.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/OtherProfessionalCareTeam.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/common/ClaimIDRLoadDate.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/common/ClaimIdrLoadDate.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/common/ClaimLineBase.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/common/ClaimLineRxNumber.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/common/ClaimPaymentAmount.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/common/ClaimPaymentDate.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/common/entities/ClaimBase.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/institutional/entities/ClaimInstitutionalBase.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/institutional/entities/ClaimInstitutionalBasisBase.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/institutional/entities/ClaimInstitutionalCmsBase.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/institutional/entities/ClaimInstitutionalCmsNch.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/institutional/entities/ClaimInstitutionalCmsSharedSystems.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/institutional/entities/ClaimInstitutionalRegularBase.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/institutional/entities/ClaimInstitutionalRegularNch.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/institutional/entities/ClaimInstitutionalRegularSharedSystems.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/priorauth/entities/PriorAuthorization.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/professional/ClaimLineProfessionalBase.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/professional/ClaimLineProfessionalCmsNch.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/professional/ClaimLineProfessionalCmsSharedSystems.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/professional/ClaimLineProfessionalExtensions.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/professional/ClaimLineProfessionalNch.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/professional/ClaimLineProfessionalSharedSystems.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/professional/entities/ClaimItemProfessionalBasisNch.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/professional/entities/ClaimItemProfessionalBasisSharedSystems.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/professional/entities/ClaimItemProfessionalCmsNch.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/professional/entities/ClaimItemProfessionalCmsSharedSystems.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/professional/entities/ClaimItemProfessionalRegularNch.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/professional/entities/ClaimItemProfessionalRegularSharedSystems.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/professional/entities/ClaimProfessionalBase.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/professional/entities/ClaimProfessionalBasisBase.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/professional/entities/ClaimProfessionalCmsBase.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/professional/entities/ClaimProfessionalCmsNch.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/professional/entities/ClaimProfessionalCmsSharedSystems.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/professional/entities/ClaimProfessionalRegularBase.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/rx/ClaimItemRx.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/rx/ClaimLineRxSupportingInfo.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/rx/entities/ClaimCmsRx.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/claim/model/rx/entities/ClaimRxBase.java # apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/eob/EobHandler.java
2 parents 941119d + 9771285 commit 180d01e

59 files changed

Lines changed: 449 additions & 99 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ jobs:
444444
bfd-platform-server-regression,
445445
bfd-platform-mount-certstores,
446446
bfd-platform-server-fluent-bit,
447+
bfd-platform-server-datadog-agent,
447448
bfd-platform-idr-pipeline,
448449
bfd-platform-migrator-ng,
449450
bfd-platform-run-locust,

.github/workflows/build_container_images_matrix.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,11 @@
9191
"idr-pipeline": "apps/bfd-pipeline-idr"
9292
},
9393
"platform": "linux/arm64"
94+
},
95+
{
96+
"name": "bfd-platform-server-datadog-agent",
97+
"dockerfile": "ops/images/bfd-platform-server-datadog-agent/Dockerfile",
98+
"contextDir": "ops/images/bfd-platform-server-datadog-agent",
99+
"platform": "linux/arm64"
94100
}
95101
]

.github/workflows/v3-release-deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ jobs:
355355
# See .github/workflows/build_container_images_matrix.json for list of buildable images
356356
imagesCsv: >-
357357
bfd-platform-server-fluent-bit,
358+
bfd-platform-server-datadog-agent,
358359
bfd-platform-idr-pipeline,
359360
bfd-platform-migrator-ng,
360361
bfd-platform-consume-idr-events,

apps/bfd-db-migrator-ng/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>gov.cms.bfd</groupId>
77
<artifactId>bfd-parent</artifactId>
8-
<version>2.261.0-SNAPSHOT</version>
8+
<version>2.262.0-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>bfd-db-migrator-ng</artifactId>

apps/bfd-db-migrator-synthetic/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>gov.cms.bfd</groupId>
77
<artifactId>bfd-parent</artifactId>
8-
<version>2.261.0-SNAPSHOT</version>
8+
<version>2.262.0-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>bfd-db-migrator-synthetic</artifactId>

apps/bfd-db-migrator/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>gov.cms.bfd</groupId>
77
<artifactId>bfd-parent</artifactId>
8-
<version>2.261.0-SNAPSHOT</version>
8+
<version>2.262.0-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>bfd-db-migrator</artifactId>

apps/bfd-model-idr/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,17 @@ python generate_prior_auth_sample.py --utn=<utn-here>
9292

9393
This will search for the specified UTN in `out/SYNTHETIC_PRAUC.csv`, collect the segments, and get it into the format that we map using FML.
9494

95+
#### EOB Sample Generator
96+
97+
To generate a EOB sample that is not prior authorization.
98+
99+
```sh
100+
uv run generate_eob_sample.py --clm-uniq-id <clm_uniq_id_here>
101+
```
102+
This will search for the clm_uniq_id in out/SYNTHETIC_CLM.csv, collect the appropriate data fields and format it to be able to be mapped to fml.
103+
104+
This will currently only work for Pharmacy types but will be continued to work on other types.
105+
95106
### Create FHIR files with synthetic data
96107

97108
Requires Matchbox to be active.

apps/bfd-model-idr/claims_adj.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,7 @@ def gen_clm(
102102
)
103103
clm[f.PRVDR_SRVC_PRVDR_NPI_NUM] = clm[f.CLM_SRVC_PRVDR_GNRC_ID_NUM]
104104
clm[f.CLM_PD_DT] = random_date(clm[f.CLM_FROM_DT], clm[f.CLM_THRU_DT])
105-
clm[f.PRVDR_PRSBNG_ID_QLFYR_CD] = random.choice(
106-
gen_utils.code_systems[f.PRVDR_ID_QLFYR_CD]
107-
)
105+
clm[f.PRVDR_PRSBNG_ID_QLFYR_CD] = "01"
108106
clm[f.CLM_PRSBNG_PRVDR_GNRC_ID_NUM] = random.choice(type_1_npis)
109107
clm[f.PRVDR_PRSCRBNG_PRVDR_NPI_NUM] = clm[f.CLM_PRSBNG_PRVDR_GNRC_ID_NUM]
110108
clm[f.CLM_SBMT_CHRG_AMT] = round(random.uniform(1, 1000000), 2)
Lines changed: 257 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,257 @@
1+
import json
2+
import sys
3+
from pathlib import Path
4+
from typing import Any
5+
6+
import click
7+
import pandas as pd
8+
9+
10+
@click.command
11+
@click.option(
12+
'--clm-uniq-id',
13+
type=str,
14+
required=True,
15+
help='Pass the claim unique ID.'
16+
)
17+
def main(clm_uniq_id:str):
18+
"""Generate EOB sample JSON from SYNTHETIC_EOB.csv based on claim unique ID."""
19+
claim_row = read_clm(clm_uniq_id)
20+
claim_type = int(claim_row.get("CLM_TYPE_CD"))
21+
22+
match claim_type:
23+
case 1 | 2 | 3 | 4:
24+
result = create_pharmacy(clm_uniq_id,claim_row)
25+
case _:
26+
print("Unknown Type")
27+
sys.exit(1)
28+
29+
with Path(result.output_file).open(mode="w", encoding="utf-8") as f:
30+
json.dump(result.result_json, f, indent=2)
31+
32+
print(f"Successfully generated sample JSON: {result.output_file}")
33+
34+
class Result:
35+
result_json: dict[str, Any]
36+
output_file: str
37+
38+
39+
def create_pharmacy(clm_uniq_id: Any,claim_row: Any) -> Result:
40+
41+
provider_npi = str(claim_row.get("PRVDR_PRSCRBNG_PRVDR_NPI_NUM", "")).strip()
42+
43+
prov_row = read_provider(provider_npi)
44+
45+
clm_sig_row = read_sig_line(str(claim_row.get("CLM_DT_SGNTR_SK", "")).strip())
46+
47+
clm_sbmtr_cntrct_num = str(claim_row.get("CLM_SBMTR_CNTRCT_NUM", "")).strip()
48+
clm_sbmtr_cntrct_pbp_num = str(claim_row.get("CLM_SBMTR_CNTRCT_PBP_NUM", "")).strip()
49+
50+
ctr_pmp_row = read_pmp(clm_sbmtr_cntrct_num,clm_sbmtr_cntrct_pbp_num)
51+
52+
clm_lines = read_line(claim_row)
53+
54+
clm_line = {} if clm_lines.empty else clm_lines.iloc[0]
55+
56+
rx_line = read_rx_line(claim_row)
57+
58+
output_json = {
59+
"resourceType": "ExplanationOfBenefit-Pharmacy",
60+
"id": str(clm_uniq_id.replace('-', '')).strip(),
61+
"lastUpdated": extract_col_str(claim_row,"IDR_UPDT_TS"),
62+
"CLM_FINL_ACTN_IND": extract_col_str(claim_row,"CLM_FINL_ACTN_IND"),
63+
"CLM_SRC_ID": extract_col_str(claim_row,"CLM_SRC_ID"),
64+
"BENE_SK": extract_col_str(claim_row,"BENE_SK"),
65+
"CLM_TYPE_CD": int(extract_col_str(claim_row,"CLM_TYPE_CD")),
66+
"CLM_UNIQ_ID": extract_col_str(claim_row,"CLM_UNIQ_ID"),
67+
"CLM_CNTL_NUM": extract_col_str(claim_row,"CLM_CNTL_NUM"),
68+
"CLM_ORIG_CNTL_NUM": extract_col_str(claim_row,"CLM_ORIG_CNTL_NUM"),
69+
"CLM_FROM_DT": extract_col_str(claim_row,"CLM_FROM_DT"),
70+
"CLM_THRU_DT": extract_col_str(claim_row,"CLM_THRU_DT"),
71+
"CLM_EFCTV_DT": extract_col_str(claim_row,"CLM_EFCTV_DT"),
72+
"CLM_SRVC_PRVDR_GNRC_ID_NUM": extract_col_str(claim_row,"CLM_SRVC_PRVDR_GNRC_ID_NUM"),
73+
"CLM_PD_DT": extract_col_str(claim_row,"CLM_PD_DT"),
74+
"PRVDR_PRSCRBNG_PRVDR_NPI_NUM": provider_npi,
75+
"CLM_PRSBNG_PRVDR_GNRC_ID_NUM": extract_col_str(claim_row,"CLM_PRSBNG_PRVDR_GNRC_ID_NUM"),
76+
"PRVDR_PRSBNG_ID_QLFYR_CD": extract_col_str(claim_row,"PRVDR_PRSBNG_ID_QLFYR_CD"),
77+
"PRVDR_LAST_NAME": extract_col_str(prov_row,"PRVDR_LAST_NAME"),
78+
"CNTRCT_PBP_NAME": extract_col_str(ctr_pmp_row,"CNTRCT_PBP_NAME"),
79+
"CLM_BENE_PMT_AMT": extract_col_str(claim_row,"CLM_BENE_PMT_AMT"),
80+
"CLM_OTHR_TP_PD_AMT": extract_col_str(claim_row,"CLM_OTHR_TP_PD_AMT"),
81+
"META_SRC_SK": extract_col_str(claim_row,"META_SRC_SK"),
82+
"PRVDR_SRVC_ID_QLFYR_CD": extract_col_str(claim_row,"PRVDR_SRVC_ID_QLFYR_CD"),
83+
"supportingInfoComponents": [],
84+
"lineItemComponents": [
85+
{
86+
"CLM_LINE_NUM": extract_col_str(clm_line,"CLM_LINE_NUM"),
87+
"CLM_LINE_FROM_DT": extract_col_str(clm_line,"CLM_LINE_FROM_DT"),
88+
"CLM_LINE_NDC_CD": extract_col_str(clm_line,"CLM_LINE_NDC_CD"),
89+
"CLM_LINE_NDC_QTY": extract_col_str(clm_line,"CLM_LINE_NDC_QTY"),
90+
"CLM_LINE_NDC_QTY_QLFYR_CD": extract_col_str(
91+
clm_line,"CLM_LINE_NDC_QTY_QLFYR_CD"),
92+
"CLM_LINE_CVRD_PD_AMT": extract_col_str(clm_line,"CLM_LINE_CVRD_PD_AMT"),
93+
"CLM_LINE_GRS_ABOVE_THRSHLD_AMT": extract_col_str(rx_line,
94+
"CLM_LINE_GRS_ABOVE_THRSHLD_AMT"),
95+
"CLM_LINE_GRS_BLW_THRSHLD_AMT": extract_col_str(
96+
rx_line,"CLM_LINE_GRS_BLW_THRSHLD_AMT"),
97+
"CLM_LINE_LIS_AMT": extract_col_str(rx_line,"CLM_LINE_LIS_AMT"),
98+
"CLM_LINE_TROOP_TOT_AMT": extract_col_str(rx_line,"CLM_LINE_TROOP_TOT_AMT"),
99+
"CLM_LINE_PLRO_AMT": extract_col_str(rx_line,"CLM_LINE_PLRO_AMT"),
100+
"CLM_RPTD_MFTR_DSCNT_AMT": extract_col_str(rx_line,"CLM_RPTD_MFTR_DSCNT_AMT"),
101+
"CLM_LINE_INGRDNT_CST_AMT": extract_col_str(rx_line,"CLM_LINE_INGRDNT_CST_AMT"),
102+
"CLM_LINE_SRVC_CST_AMT": extract_col_str(rx_line,"CLM_LINE_SRVC_CST_AMT"),
103+
"CLM_LINE_SLS_TAX_AMT": extract_col_str(rx_line,"CLM_LINE_SLS_TAX_AMT"),
104+
"CLM_LINE_VCCN_ADMIN_FEE_AMT": extract_col_str(rx_line,"CLM_LINE_VCCN_ADMIN_FEE_AMT"),
105+
"CLM_PRCNG_EXCPTN_CD": extract_col_str(rx_line,"CLM_PRCNG_EXCPTN_CD"),
106+
"CLM_LINE_BENE_PMT_AMT": extract_col_str(clm_line,"CLM_LINE_BENE_PMT_AMT"),
107+
"CLM_CMS_CALCD_MFTR_DSCNT_AMT": extract_col_str(rx_line,
108+
"CLM_CMS_CALCD_MFTR_DSCNT_AMT"),
109+
"CLM_LINE_GRS_CVRD_CST_TOT_AMT": extract_col_str(rx_line,
110+
"CLM_LINE_GRS_CVRD_CST_TOT_AMT"),
111+
"CLM_LINE_REBT_PASSTHRU_POS_AMT": extract_col_str(rx_line,
112+
"CLM_LINE_REBT_PASSTHRU_POS_AMT"),
113+
"CLM_PHRMCY_PRICE_DSCNT_AT_POS_AMT": extract_col_str(rx_line,
114+
"CLM_PHRMCY_PRICE_DSCNT_AT_POS_AMT"),
115+
"CLM_LINE_OTHR_TP_PD_AMT": extract_col_str(clm_line,
116+
"CLM_LINE_OTHR_TP_PD_AMT"),
117+
"CLM_LINE_NCVRD_PD_AMT": extract_col_str(clm_line,
118+
"CLM_LINE_NCVRD_PD_AMT"),
119+
"isCompound": str(extract_col_str(rx_line,"CLM_CMPND_CD") == "2").lower(),
120+
"CLM_LINE_RPTD_GAP_DSCNT_AMT": extract_col_str(rx_line,
121+
"CLM_LINE_RPTD_GAP_DSCNT_AMT"),
122+
"CLM_LINE_AUTHRZD_FILL_NUM": extract_col_str(rx_line,
123+
"CLM_LINE_AUTHRZD_FILL_NUM"),
124+
"CLM_PHRMCY_SRVC_TYPE_CD": extract_col_str(rx_line,
125+
"CLM_PHRMCY_SRVC_TYPE_CD"),
126+
"CLM_LINE_RX_ORGN_CD": extract_col_str(rx_line,
127+
"CLM_LINE_RX_ORGN_CD"),
128+
"CLM_BRND_GNRC_CD": extract_col_str(rx_line,
129+
"CLM_BRND_GNRC_CD"),
130+
"CLM_PTNT_RSDNC_CD": extract_col_str(rx_line,
131+
"CLM_PTNT_RSDNC_CD"),
132+
"CLM_LTC_DSPNSNG_MTHD_CD": extract_col_str(rx_line,
133+
"CLM_LTC_DSPNSNG_MTHD_CD"),
134+
"CLM_CMPND_CD": extract_col_str(rx_line,"CLM_CMPND_CD"),
135+
"CLM_LINE_DAYS_SUPLY_QTY": extract_col_str(rx_line,"CLM_LINE_DAYS_SUPLY_QTY"),
136+
"CLM_LINE_RX_FILL_NUM": extract_col_str(rx_line,"CLM_LINE_RX_FILL_NUM"),
137+
"CLM_DAW_PROD_SLCTN_CD": extract_col_str(rx_line,"CLM_DAW_PROD_SLCTN_CD"),
138+
"CLM_DRUG_CVRG_STUS_CD": extract_col_str(rx_line,"CLM_DRUG_CVRG_STUS_CD"),
139+
"CLM_CTSTRPHC_CVRG_IND_CD": extract_col_str(rx_line,"CLM_CTSTRPHC_CVRG_IND_CD"),
140+
"CLM_LINE_RX_NUM": extract_col_str(clm_line,"CLM_LINE_RX_NUM"),
141+
"CLM_DSPNSNG_STUS_CD": extract_col_str(rx_line,"CLM_DSPNSNG_STUS_CD"),
142+
}
143+
],
144+
"CLM_CMS_PROC_DT": extract_col_str(clm_sig_row,"CLM_CMS_PROC_DT"),
145+
"CLM_IDR_LD_DT ": extract_col_str(claim_row,"CLM_IDR_LD_DT"),
146+
"CLM_ADJSTMT_TYPE_CD": extract_col_str(claim_row,"CLM_ADJSTMT_TYPE_CD"),
147+
"CLM_SBMT_FRMT_CD": extract_col_str(claim_row,"CLM_SBMT_FRMT_CD"),
148+
"CLM_SBMTR_CNTRCT_NUM": extract_col_str(claim_row,"CLM_SBMTR_CNTRCT_NUM"),
149+
"CLM_SBMTR_CNTRCT_PBP_NUM": extract_col_str(claim_row,"CLM_SBMTR_CNTRCT_PBP_NUM"),
150+
"CLM_DT_SGNTR_SK": extract_col_str(clm_sig_row,"CLM_DT_SGNTR_SK"),
151+
}
152+
153+
result = Result()
154+
result.result_json = output_json
155+
result.output_file = "sample-data/EOB-Pharmacy-Sample.json"
156+
return result
157+
158+
159+
def read_clm(clm_uniq_id: Any) -> Any:
160+
eob_path = "out/SYNTHETIC_CLM.csv"
161+
if not Path(eob_path).exists():
162+
print("EOB file not found. Run the generator or this will not go well.")
163+
sys.exit(1)
164+
165+
claims_found = pd.read_csv(eob_path, dtype=str, keep_default_na=False)
166+
167+
clm_matches = claims_found[claims_found["CLM_UNIQ_ID"] == clm_uniq_id]
168+
169+
if clm_matches.empty:
170+
print(f"No claims found for claim unique ID: {clm_uniq_id}")
171+
sys.exit(1)
172+
173+
return clm_matches.iloc[0]
174+
175+
def read_provider(provider_npi: Any) -> Any:
176+
provider_path = "out/SYNTHETIC_PRVDR_HSTRY.csv"
177+
178+
if not Path(provider_path).exists():
179+
print("Provider file not found. Run the generator or this will not go well.")
180+
sys.exit(1)
181+
182+
provs_found = pd.read_csv(provider_path, dtype=str, keep_default_na=False)
183+
184+
prov_matches = provs_found[provs_found["PRVDR_NPI_NUM"] == provider_npi]
185+
186+
return {} if prov_matches.empty else prov_matches.iloc[0]
187+
188+
def read_sig_line(clm_dt_sgntr_sk: Any) -> Any:
189+
clm_sig_path = "out/SYNTHETIC_CLM_DT_SGNTR.csv"
190+
191+
if not Path(clm_sig_path).exists():
192+
print("Claim signature file not found. Run the generator or this will not go well.")
193+
sys.exit(1)
194+
195+
clm_sig_found = pd.read_csv(clm_sig_path, dtype=str, keep_default_na=False)
196+
197+
clm_sig_matches = clm_sig_found[clm_sig_found["CLM_DT_SGNTR_SK"] == clm_dt_sgntr_sk]
198+
199+
return {} if clm_sig_matches.empty else clm_sig_matches.iloc[0]
200+
201+
def read_pmp(clm_sbmtr_cntrct_num:Any,clm_sbmtr_cntrct_pbp_num:Any) -> Any:
202+
ctr_pmp_path = "out/SYNTHETIC_CNTRCT_PBP_NUM.csv"
203+
204+
if not Path(ctr_pmp_path).exists():
205+
print("Provider file not found. Run the generator or this will not go well.")
206+
sys.exit(1)
207+
208+
ctr_pmp_found = pd.read_csv(ctr_pmp_path, dtype=str, keep_default_na=False)
209+
210+
ctr_pmp_matches = ctr_pmp_found[
211+
(ctr_pmp_found["CNTRCT_NUM"] == clm_sbmtr_cntrct_num)
212+
& (ctr_pmp_found["CNTRCT_PBP_NUM"] == clm_sbmtr_cntrct_pbp_num)
213+
]
214+
215+
return {} if ctr_pmp_matches.empty else ctr_pmp_matches.iloc[0]
216+
217+
def read_line(clm_line:Any) -> Any:
218+
line_path = "out/SYNTHETIC_CLM_LINE.csv"
219+
220+
if not Path(line_path).exists():
221+
print("Claim Line file not found. Run the generator or this will not go well.")
222+
sys.exit(1)
223+
224+
line_found = pd.read_csv(line_path, dtype=str, keep_default_na=False)
225+
226+
return line_found[
227+
(line_found["GEO_BENE_SK"] == clm_line["GEO_BENE_SK"])
228+
& (line_found["CLM_DT_SGNTR_SK"] == clm_line["CLM_DT_SGNTR_SK"])
229+
& (line_found["CLM_TYPE_CD"] == clm_line["CLM_TYPE_CD"])
230+
& (line_found["CLM_NUM_SK"] == clm_line["CLM_NUM_SK"])
231+
]
232+
233+
def read_rx_line(clm_line:Any) -> Any:
234+
line_rx_path = "out/SYNTHETIC_CLM_LINE_RX.csv"
235+
236+
if not Path(line_rx_path).exists():
237+
print("Claim RX Line file not found. Run the generator or this will not go well.")
238+
sys.exit(1)
239+
240+
line_rx_found = pd.read_csv(line_rx_path, dtype=str, keep_default_na=False)
241+
242+
line_rx_matches = line_rx_found[
243+
(line_rx_found["GEO_BENE_SK"] == clm_line["GEO_BENE_SK"])
244+
& (line_rx_found["CLM_DT_SGNTR_SK"] == clm_line["CLM_DT_SGNTR_SK"])
245+
& (line_rx_found["CLM_TYPE_CD"] == clm_line["CLM_TYPE_CD"])
246+
& (line_rx_found["CLM_NUM_SK"] == clm_line["CLM_NUM_SK"])
247+
]
248+
249+
return {} if line_rx_matches.empty else line_rx_matches.iloc[0]
250+
251+
252+
def extract_col_str(row: Any,name: str) -> str:
253+
return str(row.get(name, "")).strip()
254+
255+
256+
if __name__ == "__main__":
257+
main()

apps/bfd-model/bfd-model-codebook-data/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>gov.cms.bfd</groupId>
66
<artifactId>bfd-model-parent</artifactId>
7-
<version>2.261.0-SNAPSHOT</version>
7+
<version>2.262.0-SNAPSHOT</version>
88
</parent>
99

1010
<artifactId>bfd-model-codebook-data</artifactId>

0 commit comments

Comments
 (0)