Skip to content

Commit

Permalink
BFD-1744: migrate dme claims new schema (#1105)
Browse files Browse the repository at this point in the history
* merge changes from bfd1536; add new sql script to create SNF claims int new schema format

* SNF claims data migration script

* cleanup comments (spelling, punctuation, etc.)

* revert numeric(10,2) back to numeric(12,2); minor reformatting

* fix branch due to bad merges; this branch is built on branches not yet in master

* changes for SNF so trotter can build branch

* remove commented out snf_claims from 'future' bigint

* remove support for table views

* remove support for table views

* minor formatting of if block

* fix some deprecated code items

* minor tweak of numeric value to match other test values

* add Javadoc info in a couple of places

* rename flyway migration script due to master changes

* add JavaDoc comments; minor addition of if-then-else brackets

* fix merge issues

* revert changes that included brackets

* fix merge from bfd1595 by removing view creation

* annother try to ensure V63 migration script matches bfd1595 script

* Revert SNF claims to use original table structure

* Revert tests to use original SNF layout

* minor mod to selectJavaDataType to simplify handling NUM entries

* make sure REV_CNTR_NDC_QTY supports decimal values

* flyway script to fix new SNF claims tables and migrate data

* revert most integer columns back to numeric

* revert some of the SNF table columns to NUMERIC

* chg a couple of SNF rows to use NUM

* changes for REV_CNTR_NDC_QTY test data to include decimal value

* added a comment to NDC qty

* minor excel formatting

* reconcile V66 sql with sql in bfd1596

* merge bfd1596 into this branch

* fix spelling errors in comments

* flyway scripts to migrate DME claims to new schema

* fix dmerc_line_mtus_cnt to include precision and scale
  • Loading branch information
mackec1 authored May 10, 2022
1 parent 8739262 commit b27b2c4
Show file tree
Hide file tree
Showing 17 changed files with 498 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,10 @@ private void process(PackageElement annotatedPackage) throws IOException {
new MappingSpec(annotatedPackage.getQualifiedName().toString())
.setRifLayout(RifLayout.parse(spreadsheetWorkbook, annotation.snfSheet()))
.setHeaderEntity("SNFClaim")
.setHeaderTable("snf_claims")
.setHeaderTable("snf_claims_new")
.setHeaderEntityIdField("CLM_ID")
.setHasLines(true)
.setLineTable("snf_claim_lines")
.setLineTable("snf_claim_lines_new")
.setLineEntityLineNumberField("CLM_LINE_NUM")
.setHeaderEntityAdditionalDatabaseFields(
createDetailsForAdditionalDatabaseFields(Arrays.asList("LAST_UPDATED"))));
Expand Down Expand Up @@ -1322,7 +1322,6 @@ private boolean isFutureBigint(String tableName, RifField rifField) {
"hospice_claims",
"inpatient_claims",
"outpatient_claims",
"snf_claims",
"partd_events");

return futureBigIntColumns.contains(rifField.getRifColumnName().toLowerCase())
Expand Down Expand Up @@ -2292,20 +2291,12 @@ private static TypeName selectJavaFieldType(
return ClassName.get(LocalDate.class);
} else if (type == RifColumnType.TIMESTAMP) {
return ClassName.get(Instant.class);
}
// handle an inherited hack from the Excel spreadsheet in which a row entry
// was defined as a NUM and had an associated scale; for example (12,2) denotes
// a numeric data types of up to 12 digits, with two digits of scale (i.e., 55.45).
else if (type == RifColumnType.NUM && columnScale.orElse(Integer.MAX_VALUE) > 0) {
return ClassName.get(BigDecimal.class);
}
// some entries in Excel spreadsheet defined as NUM with a zero scale that are
// not optional should be defined as a primitive integer.
//
else if (type == RifColumnType.NUM
&& columnScale.orElse(Integer.MAX_VALUE) == 0
&& !isColumnOptional) {
return TypeName.INT;
} else if (type == RifColumnType.NUM) {
if (columnScale.orElse(Integer.MAX_VALUE) > 0) {
return ClassName.get(BigDecimal.class);
} else if (columnScale.orElse(Integer.MAX_VALUE) == 0) {
return isColumnOptional ? ClassName.get(BigDecimal.class) : TypeName.INT;
}
} else if (type == RifColumnType.SMALLINT) {
return isColumnOptional ? ClassName.get(Short.class) : TypeName.SHORT;
} else if (type == RifColumnType.BIGINT) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
DML_IND|BENE_ID|CLM_ID|CLM_GRP_ID|FINAL_ACTION|NCH_NEAR_LINE_REC_IDENT_CD|NCH_CLM_TYPE_CD|CLM_FROM_DT|CLM_THRU_DT|NCH_WKLY_PROC_DT|FI_CLM_PROC_DT|CLAIM_QUERY_CODE|PRVDR_NUM|CLM_FAC_TYPE_CD|CLM_SRVC_CLSFCTN_TYPE_CD|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|ICD_PRCDR_VRSN_CD21|PRCDR_DT21|ICD_PRCDR_CD22|ICD_PRCDR_VRSN_CD22|PRCDR_DT22|ICD_PRCDR_CD23|ICD_PRCDR_VRSN_CD23|PRCDR_DT23|ICD_PRCDR_CD24|ICD_PRCDR_VRSN_CD24|PRCDR_DT24|ICD_PRCDR_CD25|ICD_PRCDR_VRSN_CD25|PRCDR_DT25|FI_DOC_CLM_CNTL_NUM|FI_ORIG_CLM_CNTL_NUM|CLM_LINE_NUM|REV_CNTR|HCPCS_CD|REV_CNTR_UNIT_CNT|REV_CNTR_RATE_AMT|REV_CNTR_TOT_CHRG_AMT|REV_CNTR_NCVRD_CHRG_AMT|REV_CNTR_DDCTBL_COINSRNC_CD|REV_CNTR_NDC_QTY|REV_CNTR_NDC_QTY_QLFR_CD|RNDRNG_PHYSN_UPIN|RNDRNG_PHYSN_NPI
INSERT|567834|777777777|900|F|V|20|01-DEC-2013|18-DEC-2013|14-FEB-2014|07-FEB-2014|3|299999|2|1|1|11111|B|3333.33|11.00|A|1|FL|1111111111||2222222222||3333333333||4444444444|0|1|2|5555.03|05-NOV-2013|3|4|A|112.00|5.00|6.00|33.00|14.00|9.00|8.00|7.00|6.00|5.00|4.00|17|17|0|19|23-SEP-2013|05-NOV-2013|11-JAN-2002|21-JAN-2002||31-JAN-2002|18-DEC-2013|645|R4444|9|R5555|9|R5555|9|R6666|9|||||||||||||||||||||||||||||||||||||||||||||||R2222|9|R2222|9|R3333|9|||||||||||||||||||||0TCCCCC|9|16-JAN-2016|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||23443453453|34534535535|1|22|MMM|477|5.00|95.00|88.00|A|0|||345345345|
INSERT|567834|777777777|900|F|V|20|01-DEC-2013|18-DEC-2013|14-FEB-2014|07-FEB-2014|3|299999|2|1|1|11111|B|3333.33|11.00|A|1|FL|1111111111||2222222222||3333333333||4444444444|0|1|2|5555.03|05-NOV-2013|3|4|A|112.00|5.00|6.00|33.00|14.00|9.00|8.00|7.00|6.00|5.00|4.00|17|17|0|19|23-SEP-2013|05-NOV-2013|11-JAN-2002|21-JAN-2002||31-JAN-2002|18-DEC-2013|645|R4444|9|R5555|9|R5555|9|R6666|9|||||||||||||||||||||||||||||||||||||||||||||||R2222|9|R2222|9|R3333|9|||||||||||||||||||||0TCCCCC|9|16-JAN-2016|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||23443453453|34534535535|1|22|MMM|477|5.00|95.00|88.00|A|234.567|ML||345345345|
Binary file not shown.
Loading

0 comments on commit b27b2c4

Please sign in to comment.