Skip to content

Commit

Permalink
Cleanup warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
keithboone committed Aug 14, 2024
1 parent 8381e1b commit 8f814dd
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 42 deletions.
66 changes: 28 additions & 38 deletions src/main/java/gov/cdc/izgw/v2tofhir/converter/MessageParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.lang.reflect.InvocationTargetException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
import java.util.LinkedHashMap;
Expand All @@ -13,7 +12,6 @@
import java.util.Objects;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.function.Supplier;

import org.apache.commons.codec.binary.StringUtils;
Expand Down Expand Up @@ -326,29 +324,7 @@ public static void normalizeResources(Bundle bundle) {
// Skip cases where resources aren't of the same type.
continue;
}
Resource toRemove = null;
switch (first.fhirType()) {
case "Endpoint":
toRemove = merge((Endpoint)first, (Endpoint)later);
break;
case "Location":
toRemove = merge((Location)first, (Location)later);
break;
case "Organization":
toRemove = merge((Organization)first, (Organization)later);
break;
case "Practitioner":
toRemove = merge((Practitioner)first, (Practitioner)later);
break;
case "PractitionerRole":
toRemove = merge((PractitionerRole)first, (PractitionerRole)later);
break;
case "RelatedPerson":
toRemove = merge((RelatedPerson)first, (RelatedPerson)later);
break;
default:
break;
}
Resource toRemove = mergeResources(first, later);
if (toRemove != null) {
resourcesToRemove.add(toRemove);
}
Expand All @@ -364,6 +340,33 @@ public static void normalizeResources(Bundle bundle) {
}
}
}

private static Resource mergeResources(Resource first, Resource later) {
Resource toRemove = null;
switch (first.fhirType()) {
case "Endpoint":
toRemove = merge((Endpoint)first, (Endpoint)later);
break;
case "Location":
toRemove = merge((Location)first, (Location)later);
break;
case "Organization":
toRemove = merge((Organization)first, (Organization)later);
break;
case "Practitioner":
toRemove = merge((Practitioner)first, (Practitioner)later);
break;
case "PractitionerRole":
toRemove = merge((PractitionerRole)first, (PractitionerRole)later);
break;
case "RelatedPerson":
toRemove = merge((RelatedPerson)first, (RelatedPerson)later);
break;
default:
break;
}
return toRemove;
}

/**
* Compare two identifiers for compatibility. If one or the other is null
Expand Down Expand Up @@ -450,19 +453,6 @@ private static boolean namesEqual(HumanName first, HumanName later) {
return f.equalsShallow(l);
}

private static int compareStringType(StringType s1, StringType s2) {
if (Objects.equals(s1, s2)) {
return 0;
}
if (s1 == null) {
return -1;
}
if (s2 == null) {
return 1;
}
return s1.asStringValue().compareTo(s2.asStringValue());
}

/**
* Merge two names together than have been identified as being the same.
* @param firstName The name to merge into
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package gov.cdc.izgw.v2tofhir.datatype;

import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;

Expand Down Expand Up @@ -79,7 +77,7 @@ public class AddressParser implements DatatypeParser<Address> {
"TLAXCALA", "VC", "VERACRUZ", "YU", "YUCATAN", "ZA", "ZACATECA"
};
private static final Pattern statePattern = ParserUtils.toPattern(states);
private static Map<String, String[]> STATE_MAP = new LinkedHashMap<>();
private static final Map<String, String[]> STATE_MAP = new LinkedHashMap<>();
static {
for (int i = 0; i < states.length; i += 2) {
String[] stateAndAbbreviation = { states[i], states[i + 1] };
Expand Down
1 change: 0 additions & 1 deletion src/main/java/gov/cdc/izgw/v2tofhir/utils/IzQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.util.List;

import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.r4.model.Immunization;
import org.hl7.fhir.r4.model.Patient;
import ca.uhn.fhir.rest.param.DateParam;
Expand Down

0 comments on commit 8f814dd

Please sign in to comment.