Skip to content

Commit

Permalink
Return empty string for NULL dataset full name (#60)
Browse files Browse the repository at this point in the history
If a NULL value is returned for the dataset full name the R adapter will not be able to merge the results.
  • Loading branch information
Gcolon021 authored Dec 3, 2024
1 parent 895525d commit 400f964
Showing 1 changed file with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public Result mapContinuousMetadata(ResultSet rs) throws SQLException {
String description = getDescription(rs);
String parentName = getParentName(rs);
String parentDisplay = getParentDisplay(rs);
String dsFullName = getDatasetFullName(rs);

String max = String.valueOf(jsonBlobParser.parseMax(rs.getString("values")));
String min = String.valueOf(jsonBlobParser.parseMin(rs.getString("values")));
Expand All @@ -41,8 +42,8 @@ public Result mapContinuousMetadata(ResultSet rs) throws SQLException {
rs.getString("stigmatized"), rs.getString("display"), description, min, rs.getString("conceptPath"), parentName,
rs.getString("conceptPath"), rs.getString("name"), parentDisplay, description, // changed
"{}", "", parentName, max, description, rs.getString("dataset"), hashedVarId, rs.getString("conceptType"), rs.getString("name"),
rs.getString("dataset"), rs.getString("stigmatized"), rs.getString("display"), rs.getString("studyAcronym"),
rs.getString("dsFullName"), parentName, parentDisplay, rs.getString("conceptPath"), min, max
rs.getString("dataset"), rs.getString("stigmatized"), rs.getString("display"), rs.getString("studyAcronym"), dsFullName,
parentName, parentDisplay, rs.getString("conceptPath"), min, max
);
return new Result(
metadata, jsonBlobParser.parseValues(rs.getString("values")), rs.getString("dataset"), parentName, rs.getString("name"), false,
Expand All @@ -55,13 +56,14 @@ public Result mapCategoricalMetadata(ResultSet rs) throws SQLException {
String description = getDescription(rs);
String parentName = getParentName(rs);
String parentDisplay = getParentDisplay(rs);
String dsFullName = getDatasetFullName(rs);

CategoricalMetadata metadata = new CategoricalMetadata(
rs.getString("stigmatized"), rs.getString("display"), description, "", rs.getString("conceptPath"), parentName,
rs.getString("conceptPath"), rs.getString("name"), parentDisplay, description, // changed
"{}", "", parentName, "", description, rs.getString("dataset"), hashedVarId, rs.getString("conceptType"), rs.getString("name"),
rs.getString("dataset"), rs.getString("stigmatized"), rs.getString("display"), rs.getString("studyAcronym"),
rs.getString("dsFullName"), parentName, parentDisplay, rs.getString("conceptPath")
rs.getString("conceptPath"), rs.getString("name"), parentDisplay, description, "{}", "", parentName, "", description,
rs.getString("dataset"), hashedVarId, rs.getString("conceptType"), rs.getString("name"), rs.getString("dataset"),
rs.getString("stigmatized"), rs.getString("display"), rs.getString("studyAcronym"), dsFullName, parentName, parentDisplay,
rs.getString("conceptPath")
);

return new Result(
Expand All @@ -70,6 +72,8 @@ public Result mapCategoricalMetadata(ResultSet rs) throws SQLException {
);
}



private static String hashVarId(String hpdsPath) {
String hashedVarId = "";
try {
Expand Down Expand Up @@ -106,4 +110,9 @@ private String getParentName(ResultSet rs) throws SQLException {
private String getDescription(ResultSet rs) throws SQLException {
return StringUtils.hasLength(rs.getString("description")) ? rs.getString("description") : "";
}

private String getDatasetFullName(ResultSet rs) throws SQLException {
return StringUtils.hasLength(rs.getString("dsFullName")) ? rs.getString("dsFullName") : "";
}

}

0 comments on commit 400f964

Please sign in to comment.