Skip to content

Commit

Permalink
Add new mapping file for outpatient HCPCS code to revenue center
Browse files Browse the repository at this point in the history
  • Loading branch information
hadleynet committed Jun 26, 2023
1 parent 4dac197 commit e2ac8c1
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ src/main/resources/export/snf_rev_cntr_code_map.json
src/main/resources/export/hha_rev_cntr_code_map.json
src/main/resources/export/hospice_rev_cntr_code_map.json
src/main/resources/export/inpatient_rev_cntr_code_map.json
src/main/resources/export/outpatient_rev_cntr_code_map.json

# H2 database files
**/*.mv.db
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public class BB2RIFExporter {
final CodeMapper hhaRevCntrMapper;
final CodeMapper hospiceRevCntrMapper;
final CodeMapper inpatientRevCntrMapper;
final CodeMapper outpatientRevCntrMapper;
final Map<String, RandomCollection<String>> externalCodes;
final CMSStateCodeMapper locationMapper;
final BeneficiaryExporter beneExp;
Expand Down Expand Up @@ -111,6 +112,7 @@ private BB2RIFExporter() {
hhaRevCntrMapper = new CodeMapper("export/hha_rev_cntr_code_map.json");
hospiceRevCntrMapper = new CodeMapper("export/hospice_rev_cntr_code_map.json");
inpatientRevCntrMapper = new CodeMapper("export/inpatient_rev_cntr_code_map.json");
outpatientRevCntrMapper = new CodeMapper("export/outpatient_rev_cntr_code_map.json");
locationMapper = new CMSStateCodeMapper();
externalCodes = loadExternalCodes();
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ long export(Person person, long startTime, long stopTime) throws IOException {
}

// Add a total charge entry.
fieldValues.remove(BB2RIFStructure.INPATIENT.REV_CNTR_NDC_QTY);
fieldValues.remove(BB2RIFStructure.INPATIENT.REV_CNTR_NDC_QTY_QLFR_CD);

Check warning on line 200 in src/main/java/org/mitre/synthea/export/rif/InpatientExporter.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/mitre/synthea/export/rif/InpatientExporter.java#L199-L200

Added lines #L199 - L200 were not covered by tests
fieldValues.put(BB2RIFStructure.INPATIENT.CLM_LINE_NUM, Integer.toString(claimLine));
// HCPCS 99221: "Inpatient hospital visits: Initial and subsequent"
fieldValues.put(BB2RIFStructure.INPATIENT.REV_CNTR, "0001");
Expand Down
15 changes: 10 additions & 5 deletions src/main/java/org/mitre/synthea/export/rif/OutpatientExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,20 @@ long export(Person person, long startTime, long stopTime) throws IOException {
}

String originalRandomRevCenter = fieldValues.get(BB2RIFStructure.OUTPATIENT.REV_CNTR);

Check warning on line 123 in src/main/java/org/mitre/synthea/export/rif/OutpatientExporter.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/mitre/synthea/export/rif/OutpatientExporter.java#L123

Added line #L123 was not covered by tests
if (encounter.type.equals(HealthRecord.EncounterType.VIRTUAL.toString())) {
String revCenter = person.randBoolean() ? "0780" : "0789";
fieldValues.put(BB2RIFStructure.OUTPATIENT.REV_CNTR, revCenter);
}

synchronized (exporter.rifWriters.getOrCreateWriter(BB2RIFStructure.OUTPATIENT.class)) {
int claimLine = 1;
for (Claim.ClaimEntry lineItem : billableItems) {
String hcpcsCode = null;
if (lineItem.entry instanceof HealthRecord.Procedure) {
hcpcsCode = getFirstMappedHCPCSCode(lineItem.entry.codes, person);
fieldValues.put(BB2RIFStructure.OUTPATIENT.REV_CNTR, originalRandomRevCenter);
String revCenter = originalRandomRevCenter;

Check warning on line 131 in src/main/java/org/mitre/synthea/export/rif/OutpatientExporter.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/mitre/synthea/export/rif/OutpatientExporter.java#L131

Added line #L131 was not covered by tests
if (encounter.type.equals(HealthRecord.EncounterType.VIRTUAL.toString())) {
revCenter = person.randBoolean() ? "0780" : "0789";
} else if (exporter.outpatientRevCntrMapper.canMap(hcpcsCode)) {
revCenter = exporter.outpatientRevCntrMapper.map(hcpcsCode, person);

Check warning on line 135 in src/main/java/org/mitre/synthea/export/rif/OutpatientExporter.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/mitre/synthea/export/rif/OutpatientExporter.java#L135

Added line #L135 was not covered by tests
}
fieldValues.put(BB2RIFStructure.OUTPATIENT.REV_CNTR, revCenter);
fieldValues.remove(BB2RIFStructure.OUTPATIENT.REV_CNTR_IDE_NDC_UPC_NUM);
fieldValues.remove(BB2RIFStructure.OUTPATIENT.REV_CNTR_NDC_QTY);
fieldValues.remove(BB2RIFStructure.OUTPATIENT.REV_CNTR_NDC_QTY_QLFR_CD);
Expand All @@ -158,6 +160,9 @@ long export(Person person, long startTime, long stopTime) throws IOException {
}

// Add a total charge entry.
fieldValues.remove(BB2RIFStructure.OUTPATIENT.REV_CNTR_IDE_NDC_UPC_NUM);
fieldValues.remove(BB2RIFStructure.OUTPATIENT.REV_CNTR_NDC_QTY);
fieldValues.remove(BB2RIFStructure.OUTPATIENT.REV_CNTR_NDC_QTY_QLFR_CD);
fieldValues.put(BB2RIFStructure.OUTPATIENT.CLM_LINE_NUM, Integer.toString(claimLine));
fieldValues.put(BB2RIFStructure.OUTPATIENT.REV_CNTR_DT,
RIFExporter.bb2DateFromTimestamp(encounter.start));
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/export/bfd_field_values.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ Line Field BENEFICIARY BENEFICIARY_HISTORY INPATIENT OUTPATIENT CARRIER PDE DME
563 RDS_NOV_IND Coded N/A N/A N/A N/A N/A N/A N/A N/A N/A TRUE
564 RDS_OCT_IND Coded N/A N/A N/A N/A N/A N/A N/A N/A N/A TRUE
565 RDS_SEPT_IND Coded N/A N/A N/A N/A N/A N/A N/A N/A N/A TRUE
566 REV_CNTR N/A N/A "0300,0301,0305,0450,0730,0306,0324,0424,0420,0272 (most frequent)" "XXXX (lots of alternatives)" N/A N/A N/A "0551,0551,0551,0421,0421,0023,0001 (hha codes)" "0571,0571,0551,0551,0651,0001 (hospice codes)" Coded FALSE
566 REV_CNTR N/A N/A "0300,0301,0305,0450,0730,0306,0324,0424,0420,0272 (most frequent)" "0250,0272,0270,0258,0710,0370,0637,0259,0271,0521,0251 (most frequent)" N/A N/A N/A "0551,0551,0551,0421,0421,0023,0001 (hha codes)" "0571,0571,0551,0551,0651,0001 (hospice codes)" Coded FALSE
567 REV_CNTR_1ST_ANSI_CD N/A N/A N/A N/A N/A N/A N/A N/A TRUE
568 REV_CNTR_1ST_MSP_PD_AMT N/A N/A N/A 0 N/A N/A N/A N/A N/A N/A FALSE
569 REV_CNTR_2ND_ANSI_CD N/A N/A N/A N/A N/A N/A N/A N/A N/A TRUE
Expand Down

0 comments on commit e2ac8c1

Please sign in to comment.