Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linting run over once, pushing up for review. #3

Open
wants to merge 2 commits into
base: fhir-r4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another way of doing this is if(!bundleEntry.getResource().getResourceType().name().equals("Medication"))

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I mostly just wanted it to be explicit what the intent of the statement was without having to add comments to the code.

&& bundleEntry.getResource().getResourceType().name().equals("PractitionerRole") == false) {
if (identifierObject != null) {
List<Base> identifiers = identifierObject.getValues();
if (identifiers != null) {
Expand All @@ -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=";
Expand All @@ -80,7 +80,7 @@ public static String generateIfNoneExist(BundleEntryComponent bundleEntry) {
}
}
} else {
if (ifNotExistString != "") {
if (ifNotExistString.equals("") == false) {
ifNotExistString = ifNotExistString + ",";
} else {
ifNotExistString = "identifier=";
Expand All @@ -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<Base> conceptList = medicationCode.getValues();
Expand All @@ -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=";
Expand All @@ -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=";
Expand All @@ -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="
Expand Down
20 changes: 10 additions & 10 deletions src/test/java/tr/com/srdc/cda2fhir/ConditionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}

Expand All @@ -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());

}

Expand Down
34 changes: 0 additions & 34 deletions src/test/java/tr/com/srdc/cda2fhir/ValidatorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down