From 472a5f4f0cc0577dd109385752a95c9cd772a596 Mon Sep 17 00:00:00 2001 From: Eric West Date: Tue, 19 May 2020 10:40:14 -0400 Subject: [PATCH 1/2] Linting run over once, pushing up for review. --- .../transform/util/impl/BundleRequest.java | 24 +++++++++---------- .../generator/IVL_PQRangeGenerator.java | 1 - .../IVL_PQSimpleQuantityGenerator.java | 1 - .../testutil/generator/IVXB_PQGenerator.java | 1 - .../MedicationActivityGenerator.java | 1 - .../MedicationDispenseGenerator.java | 1 - .../MedicationSupplyOrderGenerator.java | 1 - 7 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/main/java/tr/com/srdc/cda2fhir/transform/util/impl/BundleRequest.java b/src/main/java/tr/com/srdc/cda2fhir/transform/util/impl/BundleRequest.java index 8269df33e..db31d8152 100644 --- a/src/main/java/tr/com/srdc/cda2fhir/transform/util/impl/BundleRequest.java +++ b/src/main/java/tr/com/srdc/cda2fhir/transform/util/impl/BundleRequest.java @@ -19,7 +19,7 @@ public class BundleRequest { - private final static Logger logger = LoggerFactory.getLogger(BundleRequest.class); + private static final Logger logger = LoggerFactory.getLogger(BundleRequest.class); /** * Reads the configuration file, and parses out any overriding OIDs. @@ -56,8 +56,8 @@ public static String generateIfNoneExist(BundleEntryComponent bundleEntry) { // find any overriding OIDs. String[] subsetOIDArray = getDefinedOIDs(bundleEntry.getResource().getResourceType().name()); - if (bundleEntry.getResource().getResourceType().name() != "Medication" - && bundleEntry.getResource().getResourceType().name() != "PractitionerRole") { + if (bundleEntry.getResource().getResourceType().name().equals("Medication") == false + && bundleEntry.getResource().getResourceType().name().equals("PractitionerRole") == false) { if (identifierObject != null) { List identifiers = identifierObject.getValues(); if (identifiers != null) { @@ -70,7 +70,7 @@ public static String generateIfNoneExist(BundleEntryComponent bundleEntry) { // override OID selection(s). for (String OID : subsetOIDArray) { if (currentId.getSystem().equals(OID)) { - if (ifNotExistString != "") { + if (ifNotExistString.equals("") == false) { ifNotExistString = ifNotExistString + ","; } else { ifNotExistString = "identifier="; @@ -80,7 +80,7 @@ public static String generateIfNoneExist(BundleEntryComponent bundleEntry) { } } } else { - if (ifNotExistString != "") { + if (ifNotExistString.equals("") == false) { ifNotExistString = ifNotExistString + ","; } else { ifNotExistString = "identifier="; @@ -99,9 +99,9 @@ public static String generateIfNoneExist(BundleEntryComponent bundleEntry) { } // if we can't pull an identifier, try other logic. - if (ifNotExistString == "") { + if (ifNotExistString.equals("")) { // if it's a medication, check by aggregate encodings. - if (bundleEntry.getResource().getResourceType().name() == "Medication") { + if (bundleEntry.getResource().getResourceType().name().equals("Medication")) { Property medicationCode = bundleEntry.getResource().getChildByName("code"); if (medicationCode != null) { List conceptList = medicationCode.getValues(); @@ -112,9 +112,9 @@ public static String generateIfNoneExist(BundleEntryComponent bundleEntry) { if (Config.MEDICATION_CODE_SYSTEM != null) { if (coding.getCode() != null) { - if (coding.getSystem() == Config.MEDICATION_CODE_SYSTEM) { + if (coding.getSystem().equals(Config.MEDICATION_CODE_SYSTEM)) { // add or for multiple parameters - if (ifNotExistString != "") { + if (ifNotExistString.equals("") == false) { ifNotExistString = ifNotExistString + "&"; } else { ifNotExistString = "code="; @@ -126,7 +126,7 @@ public static String generateIfNoneExist(BundleEntryComponent bundleEntry) { } else { if (coding.getCode() != null) { // add or for multiple parameters - if (ifNotExistString != "") { + if (ifNotExistString.equals("") == false) { ifNotExistString = ifNotExistString + "&"; } else { ifNotExistString = "code="; @@ -140,11 +140,11 @@ public static String generateIfNoneExist(BundleEntryComponent bundleEntry) { } // if it's a practitioner role, de-duplicate by reference ids. - if (bundleEntry.getResource().getResourceType().name() == "PractitionerRole") { + if (bundleEntry.getResource().getResourceType().name().equals("PractitionerRole")) { PractitionerRole practitionerRole = (PractitionerRole) bundleEntry.getResource(); Identifier practitionerIdentifier = practitionerRole.getPractitionerTarget().getIdentifierFirstRep(); Identifier organizationIdentifier = practitionerRole.getOrganizationTarget().getIdentifierFirstRep(); - if (organizationIdentifier != null & practitionerIdentifier != null) { + if (organizationIdentifier != null && practitionerIdentifier != null) { ifNotExistString = "practitioner.identifier=" + practitionerIdentifier.getSystem() + "|" + practitionerIdentifier.getValue(); ifNotExistString = ifNotExistString + "&" + "organization.identifier=" diff --git a/src/test/java/tr/com/srdc/cda2fhir/testutil/generator/IVL_PQRangeGenerator.java b/src/test/java/tr/com/srdc/cda2fhir/testutil/generator/IVL_PQRangeGenerator.java index c4f8b847d..2f02b7da0 100644 --- a/src/test/java/tr/com/srdc/cda2fhir/testutil/generator/IVL_PQRangeGenerator.java +++ b/src/test/java/tr/com/srdc/cda2fhir/testutil/generator/IVL_PQRangeGenerator.java @@ -4,7 +4,6 @@ import org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent; import org.hl7.fhir.r4.model.Range; -import org.hl7.fhir.r4.model.SimpleQuantity; import org.junit.Assert; import org.openhealthtools.mdht.uml.hl7.datatypes.IVL_PQ; import org.openhealthtools.mdht.uml.hl7.datatypes.IVXB_PQ; diff --git a/src/test/java/tr/com/srdc/cda2fhir/testutil/generator/IVL_PQSimpleQuantityGenerator.java b/src/test/java/tr/com/srdc/cda2fhir/testutil/generator/IVL_PQSimpleQuantityGenerator.java index 920af3f17..47c50878c 100644 --- a/src/test/java/tr/com/srdc/cda2fhir/testutil/generator/IVL_PQSimpleQuantityGenerator.java +++ b/src/test/java/tr/com/srdc/cda2fhir/testutil/generator/IVL_PQSimpleQuantityGenerator.java @@ -3,7 +3,6 @@ import java.math.BigDecimal; import org.hl7.fhir.r4.model.Quantity; -import org.hl7.fhir.r4.model.SimpleQuantity; import org.junit.Assert; import org.openhealthtools.mdht.uml.hl7.datatypes.IVL_PQ; diff --git a/src/test/java/tr/com/srdc/cda2fhir/testutil/generator/IVXB_PQGenerator.java b/src/test/java/tr/com/srdc/cda2fhir/testutil/generator/IVXB_PQGenerator.java index 71a6ccb61..9daae9d95 100644 --- a/src/test/java/tr/com/srdc/cda2fhir/testutil/generator/IVXB_PQGenerator.java +++ b/src/test/java/tr/com/srdc/cda2fhir/testutil/generator/IVXB_PQGenerator.java @@ -3,7 +3,6 @@ import java.math.BigDecimal; import org.hl7.fhir.r4.model.Quantity; -import org.hl7.fhir.r4.model.SimpleQuantity; import org.junit.Assert; import org.openhealthtools.mdht.uml.hl7.datatypes.IVXB_PQ; diff --git a/src/test/java/tr/com/srdc/cda2fhir/testutil/generator/MedicationActivityGenerator.java b/src/test/java/tr/com/srdc/cda2fhir/testutil/generator/MedicationActivityGenerator.java index 30051027e..33207d431 100644 --- a/src/test/java/tr/com/srdc/cda2fhir/testutil/generator/MedicationActivityGenerator.java +++ b/src/test/java/tr/com/srdc/cda2fhir/testutil/generator/MedicationActivityGenerator.java @@ -14,7 +14,6 @@ import org.hl7.fhir.r4.model.Practitioner; import org.hl7.fhir.r4.model.PractitionerRole; import org.hl7.fhir.r4.model.Quantity; -import org.hl7.fhir.r4.model.SimpleQuantity; import org.hl7.fhir.r4.model.Timing; import org.junit.Assert; import org.openhealthtools.mdht.uml.cda.Author; diff --git a/src/test/java/tr/com/srdc/cda2fhir/testutil/generator/MedicationDispenseGenerator.java b/src/test/java/tr/com/srdc/cda2fhir/testutil/generator/MedicationDispenseGenerator.java index 71f06e2d4..45975945d 100644 --- a/src/test/java/tr/com/srdc/cda2fhir/testutil/generator/MedicationDispenseGenerator.java +++ b/src/test/java/tr/com/srdc/cda2fhir/testutil/generator/MedicationDispenseGenerator.java @@ -9,7 +9,6 @@ import org.hl7.fhir.r4.model.Bundle; import org.hl7.fhir.r4.model.Medication; import org.hl7.fhir.r4.model.MedicationDispense; -import org.hl7.fhir.r4.model.SimpleQuantity; import org.junit.Assert; import org.openhealthtools.mdht.uml.cda.ManufacturedProduct; import org.openhealthtools.mdht.uml.cda.Performer2; diff --git a/src/test/java/tr/com/srdc/cda2fhir/testutil/generator/MedicationSupplyOrderGenerator.java b/src/test/java/tr/com/srdc/cda2fhir/testutil/generator/MedicationSupplyOrderGenerator.java index 7d0d1e7c6..1c3da8a11 100644 --- a/src/test/java/tr/com/srdc/cda2fhir/testutil/generator/MedicationSupplyOrderGenerator.java +++ b/src/test/java/tr/com/srdc/cda2fhir/testutil/generator/MedicationSupplyOrderGenerator.java @@ -12,7 +12,6 @@ import org.hl7.fhir.r4.model.Period; import org.hl7.fhir.r4.model.Practitioner; import org.hl7.fhir.r4.model.PractitionerRole; -import org.hl7.fhir.r4.model.SimpleQuantity; import org.junit.Assert; import org.openhealthtools.mdht.uml.cda.Act; import org.openhealthtools.mdht.uml.cda.Author; From 7ab8037cc5b85e8f4f632ee988ef5c67251ddfaa Mon Sep 17 00:00:00 2001 From: Eric West Date: Wed, 20 May 2020 10:09:05 -0400 Subject: [PATCH 2/2] another linting pass --- .../tr/com/srdc/cda2fhir/ConditionTest.java | 20 +++++------ .../tr/com/srdc/cda2fhir/ValidatorTest.java | 34 ------------------- 2 files changed, 10 insertions(+), 44 deletions(-) diff --git a/src/test/java/tr/com/srdc/cda2fhir/ConditionTest.java b/src/test/java/tr/com/srdc/cda2fhir/ConditionTest.java index 9913d15a6..c4e23e58e 100644 --- a/src/test/java/tr/com/srdc/cda2fhir/ConditionTest.java +++ b/src/test/java/tr/com/srdc/cda2fhir/ConditionTest.java @@ -57,19 +57,19 @@ public void tIndication2ConditionCategoryTest() { String categoryCode = encounterCondition.getCategoryFirstRep().getCodingFirstRep().getCode(); String categorySystem = encounterCondition.getCategoryFirstRep().getCodingFirstRep().getSystem(); - Assert.assertEquals("category system is http://hl7.org/fhir/condition-category", categorySystem, - "http://hl7.org/fhir/condition-category"); - Assert.assertEquals("category code is encounter-diagnosis", categoryCode, "encounter-diagnosis"); - Assert.assertEquals("category displauy is Encounter Diagnosis", categoryDisplay, "Encounter Diagnosis"); + Assert.assertEquals("category system is http://hl7.org/fhir/condition-category", + "http://hl7.org/fhir/condition-category", categorySystem); + Assert.assertEquals("category code is encounter-diagnosis", "encounter-diagnosis", categoryCode); + Assert.assertEquals("category displauy is Encounter Diagnosis", "Encounter Diagnosis", categoryDisplay); categoryDisplay = problemListItemCondition.getCategoryFirstRep().getCodingFirstRep().getDisplay(); categoryCode = problemListItemCondition.getCategoryFirstRep().getCodingFirstRep().getCode(); categorySystem = problemListItemCondition.getCategoryFirstRep().getCodingFirstRep().getSystem(); - Assert.assertEquals("category system is http://hl7.org/fhir/condition-category", categorySystem, - "http://hl7.org/fhir/condition-category"); - Assert.assertEquals("category code is problem-list-item", categoryCode, "problem-list-item"); - Assert.assertEquals("category displauy is Problem List Item", categoryDisplay, "Problem List Item"); + Assert.assertEquals("category system is http://hl7.org/fhir/condition-category", + "http://hl7.org/fhir/condition-category", categorySystem); + Assert.assertEquals("category code is problem-list-item", "problem-list-item", categoryCode); + Assert.assertEquals("category displauy is Problem List Item", "Problem List Item", categoryDisplay); } @@ -96,8 +96,8 @@ public void testRepeatConditionCategory() { CodeableConcept categoryEncounter = problemListItemCondition.getCategoryFirstRep(); CodeableConcept categoryProblemListItem = problemListItemCondition.getCategory().get(1); - Assert.assertEquals(categoryEncounter.getCodingFirstRep().getCode(), "encounter-diagnosis"); - Assert.assertEquals(categoryProblemListItem.getCodingFirstRep().getCode(), "problem-list-item"); + Assert.assertEquals("encounter-diagnosis", categoryEncounter.getCodingFirstRep().getCode()); + Assert.assertEquals("problem-list-item", categoryProblemListItem.getCodingFirstRep().getCode()); } diff --git a/src/test/java/tr/com/srdc/cda2fhir/ValidatorTest.java b/src/test/java/tr/com/srdc/cda2fhir/ValidatorTest.java index 4ab397b52..c53c68846 100644 --- a/src/test/java/tr/com/srdc/cda2fhir/ValidatorTest.java +++ b/src/test/java/tr/com/srdc/cda2fhir/ValidatorTest.java @@ -30,7 +30,6 @@ import org.hl7.fhir.r4.model.Identifier; import org.junit.Assert; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; import org.openhealthtools.mdht.uml.cda.consol.ConsolPackage; import org.openhealthtools.mdht.uml.cda.consol.ContinuityOfCareDocument; @@ -154,39 +153,6 @@ public void testViteraBundleWithProfile() throws Exception { generateDAFProfileMetadata, false); } - // HannahBanana_EpicCCD.xml - @Ignore - public void testHannahBanana() throws Exception { - String cdaResourcePath = "src/test/resources/Epic/HannahBanana_EpicCCD-pretty.xml"; - String targetPathForFHIRResource = "src/test/resources/output/Epic/HannahBanana_EpicCCD-pretty.fhir.xml"; - String targetPathForResultFile = "src/test/resources/output/Epic/HannahBanana_EpicCCD-pretty.validation-result.html"; - boolean generateDAFProfileMetadata = true; - transformAndValidate(cdaResourcePath, targetPathForFHIRResource, targetPathForResultFile, - generateDAFProfileMetadata, false); - } - - // robust CCD.XML - @Ignore - public void testRobust() throws Exception { - String cdaResourcePath = "src/test/resources/Epic/robust CCD.XML"; - String targetPathForFHIRResource = "src/test/resources/output/Epic/robust CCD.fhir.xml"; - String targetPathForResultFile = "src/test/resources/output/Epic/robust CCD.validation-result.html"; - boolean generateDAFProfileMetadata = true; - transformAndValidate(cdaResourcePath, targetPathForFHIRResource, targetPathForResultFile, - generateDAFProfileMetadata, false); - } - - // Person-RAKIA_TEST_DOC0001 (1).xml - @Ignore - public void testRakia() throws Exception { - String cdaResourcePath = "src/test/resources/Cerner/Person-RAKIA_TEST_DOC00001 (1).xml"; - String targetPathForFHIRResource = "src/test/resources/output/Cerner/Person-RAKIA_TEST_DOC00001 (1).fhir.xml"; - String targetPathForResultFile = "src/test/resources/output/Cerner/Person-RAKIA_TEST_DOC00001 (1).validation-result.html"; - boolean generateDAFProfileMetadata = true; - transformAndValidate(cdaResourcePath, targetPathForFHIRResource, targetPathForResultFile, - generateDAFProfileMetadata, false); - } - /** * Transforms a CDA resource to a FHIR resource, validates the FHIR resource and * prints the validation result to the target path.