Skip to content

Commit

Permalink
Attempt to fix thread issue and checkstyle warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
jawalonoski authored and hadleynet committed Sep 20, 2021
1 parent bb060d1 commit a225518
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions src/main/java/org/mitre/synthea/export/BB2RIFExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,18 @@ public class BB2RIFExporter {
private SynchronizedBBLineWriter npi;
private Writer manifest;

private AtomicLong beneId; // per patient identifier
private AtomicLong claimId; // per claim per encounter
private AtomicInteger claimGroupId; // per encounter
private AtomicLong pdeId; // per medication claim
private AtomicReference<MBI> mbi;
private AtomicReference<HICN> hicn;
private static AtomicLong beneId =
new AtomicLong(Config.getAsLong("exporter.bfd.bene_id_start", -1));
private static AtomicLong claimId =
new AtomicLong(Config.getAsLong("exporter.bfd.clm_id_start", -1));
private static AtomicInteger claimGroupId =
new AtomicInteger(Config.getAsInteger("exporter.bfd.clm_grp_id_start", -1));
private static AtomicLong pdeId =
new AtomicLong(Config.getAsLong("exporter.bfd.pde_id_start", -1));
private static AtomicReference<MBI> mbi =
new AtomicReference<>(MBI.parse(Config.get("exporter.bfd.mbi_start", "1S00-A00-AA00")));
private static AtomicReference<HICN> hicn =
new AtomicReference<>(HICN.parse(Config.get("exporter.bfd.hicn_start", "T00000000A")));
private final PartDContractID[] partDContractIDs;

private List<LinkedHashMap<String, String>> carrierLookup;
Expand Down Expand Up @@ -138,14 +144,6 @@ private static String bb2DateFromTimestamp(long time) {
* Create the output folder and files. Write headers to each file.
*/
private BB2RIFExporter() {
beneId = new AtomicLong(Config.getAsLong("exporter.bfd.bene_id_start", -1));
claimId = new AtomicLong(Config.getAsLong("exporter.bfd.clm_id_start", -1));
claimGroupId = new AtomicInteger(Config.getAsInteger("exporter.bfd.clm_grp_id_start", -1));
pdeId = new AtomicLong(Config.getAsLong("exporter.bfd.pde_id_start", -1));
String mbiStartStr = Config.get("exporter.bfd.mbi_start", "1S00-A00-AA00");
mbi = new AtomicReference<>(MBI.parse(mbiStartStr));
String hicnStartStr = Config.get("exporter.bfd.hicn_start", "T00000000A");
hicn = new AtomicReference<>(HICN.parse(hicnStartStr));
partDContractIDs = initPartDContractIDs();
conditionCodeMapper = new CodeMapper("condition_code_map.json");
medicationCodeMapper = new CodeMapper("medication_code_map.json");
Expand Down Expand Up @@ -716,7 +714,7 @@ private void exportOutpatient(Person person, long stopTime)
continue; // skip this encounter
}

synchronized(outpatient) {
synchronized (outpatient) {
int claimLine = 1;
for (ClaimEntry lineItem : encounter.claim.items) {
String hcpcsCode = null;
Expand Down Expand Up @@ -932,7 +930,7 @@ private void exportInpatient(Person person, long stopTime)
}
previousEmergency = isEmergency;

synchronized(inpatient) {
synchronized (inpatient) {
int claimLine = 1;
for (ClaimEntry lineItem : encounter.claim.items) {
String hcpcsCode = null;
Expand Down Expand Up @@ -1096,7 +1094,7 @@ private void exportCarrier(Person person, long stopTime) throws IOException {
fieldValues.put(CarrierFields.PRNCPAL_DGNS_CD, mappedDiagnosisCodes.get(0));
}

synchronized(carrier) {
synchronized (carrier) {
int lineNum = 1;
for (ClaimEntry lineItem : encounter.claim.items) {
fieldValues.put(CarrierFields.LINE_BENE_PTB_DDCTBL_AMT,
Expand Down Expand Up @@ -1322,7 +1320,7 @@ private void exportDME(Person person, long stopTime)
fieldValues.put(DMEFields.LINE_ICD_DGNS_CD, mappedDiagnosisCodes.get(0));
}

synchronized(dme) {
synchronized (dme) {
int lineNum = 1;
for (ClaimEntry lineItem : encounter.claim.items) {
if (!(lineItem.entry instanceof Device)) {
Expand Down Expand Up @@ -1451,7 +1449,7 @@ private void exportHome(Person person, long stopTime) throws IOException {
fieldValues.put(HHAFields.PRNCPAL_DGNS_CD, mappedDiagnosisCodes.get(0));
}

synchronized(home) {
synchronized (home) {
int claimLine = 1;
for (ClaimEntry lineItem : encounter.claim.items) {
String hcpcsCode = null;
Expand Down Expand Up @@ -1625,7 +1623,7 @@ private void exportHospice(Person person, long stopTime) throws IOException {
fieldValues.put(HospiceFields.REV_CNTR_RATE_AMT,
String.format("%.2f", (encounter.claim.getTotalClaimCost() / days)));

synchronized(hospice) {
synchronized (hospice) {
int claimLine = 1;
for (ClaimEntry lineItem : encounter.claim.items) {
String hcpcsCode = null;
Expand Down Expand Up @@ -1830,7 +1828,7 @@ private void exportSNF(Person person, long stopTime) throws IOException {
continue; // skip this encounter
}

synchronized(snf) {
synchronized (snf) {
int claimLine = 1;
for (ClaimEntry lineItem : encounter.claim.items) {
String hcpcsCode = null;
Expand Down Expand Up @@ -1883,8 +1881,8 @@ private void exportSNF(Person person, long stopTime) throws IOException {
// If claimLine still equals 1, then no line items were successfully added.
// Add a single top-level entry.
fieldValues.put(SNFFields.CLM_LINE_NUM, Integer.toString(claimLine));
// G0299: “direct skilled nursing services of a registered nurse (RN) in the home health or
// hospice setting”
// G0299: “direct skilled nursing services of a registered nurse (RN) in the home health
// or hospice setting”
fieldValues.put(SNFFields.HCPCS_CD, "G0299");
snf.writeValues(SNFFields.class, fieldValues);
}
Expand Down

0 comments on commit a225518

Please sign in to comment.