Skip to content

Commit

Permalink
Do not search string gazetteer with ISO, but with name
Browse files Browse the repository at this point in the history
  • Loading branch information
GenieTim committed Dec 1, 2023
1 parent ecdfc35 commit 8f43f63
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
9 changes: 6 additions & 3 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,18 @@
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/annotations">
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="test" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
Expand Down
25 changes: 12 additions & 13 deletions src/main/java/edu/harvard/mcz/imagecapture/data/NahimaManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -761,14 +761,15 @@ public JSONObject resolveLocation(Specimen specimen) throws IOException, Interru
return null;
}
String searchString = "";
if (specimen.getPrimaryDivisonISO() != null && !specimen.getPrimaryDivisonISO().equals("unknown")) {
searchString = specimen.getPrimaryDivisonISO();
} else {
if (specimen.getPrimaryDivison() != null && !specimen.getPrimaryDivison().equals("unknown")) {
searchString = specimen.getPrimaryDivison();
}
if (specimen.getCountry() != null && !specimen.getCountry().equals("unknown")) {
searchString += " " + specimen.getCountry();
if (specimen.getPrimaryDivison() != null && !specimen.getPrimaryDivison().equals("unknown")) {
searchString = specimen.getPrimaryDivison();
}
if (specimen.getCountry() != null && !specimen.getCountry().equals("unknown")) {
searchString += " " + specimen.getCountry();
}
if (Objects.equals(searchString.trim(), "")) {
if (specimen.getPrimaryDivisonISO() != null && !specimen.getPrimaryDivisonISO().equals("unknown")) {
searchString = specimen.getPrimaryDivisonISO();
}
}

Expand All @@ -781,7 +782,7 @@ public JSONObject resolveLocation(Specimen specimen) throws IOException, Interru
JSONObject parent = null;
try {
parent = resolveCountry(specimen.getCountry());
} catch (Exception e) {
} catch (Exception ignored) {
}

JSONObject finalParent = parent;
Expand All @@ -800,11 +801,10 @@ public JSONObject resolveLocation(Specimen specimen) throws IOException, Interru
* @return the nahima returned object if only one
*/
public JSONObject resolveTypeStatus(String status) throws IOException, InterruptedException, SkipSpecimenException, InvocationTargetException {
JSONObject result = this.resolveOrCreateInteractive(status, "typusstatus", "typusstatus_all_fields_1", new JSONObject(new HashMap<>() {{
return this.resolveOrCreateInteractive(status, "typusstatus", "typusstatus_all_fields_1", new JSONObject(new HashMap<>() {{
put("name", status);
put("bemerkung", getCreatedByThisSoftwareIndication());
}}), false, 0);
return result;
}

/**
Expand All @@ -814,11 +814,10 @@ public JSONObject resolveTypeStatus(String status) throws IOException, Interrupt
* @param unitSubject the unit type
*/
public JSONObject resolveUnitFor(String unit, String unitSubject) throws IOException, InterruptedException, SkipSpecimenException, InvocationTargetException {
JSONObject results = this.resolveOrCreateInteractive(unit, unitSubject, unitSubject + "_all_fields", new JSONObject(new HashMap<>() {{
return this.resolveOrCreateInteractive(unit, unitSubject, unitSubject + "_all_fields", new JSONObject(new HashMap<>() {{
put("name", unit);
put("bemerkung", getCreatedByThisSoftwareIndication());
}}));
return results;
}

/**
Expand Down

0 comments on commit 8f43f63

Please sign in to comment.