Skip to content

Commit

Permalink
Merge branch 'main' into feature-FDS-829-component-requitrement-endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewelamb authored Apr 26, 2024
2 parents 53dad80 + 24ca9fa commit 3161e40
Show file tree
Hide file tree
Showing 54 changed files with 1,464 additions and 1,138 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/update-oc-db-csv-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,5 @@ jobs:
with:
title: "chore(openchallenges): ${{ env.TODAY }} DB update"
body: Daily OC database update(s)
labels: sonar-scan-approved
commit-message: "${{ env.TODAY }}: add latest CSV dump files"
branch: openchallenges/db-update
branch: openchallenges/db-update
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ src/main/java/org/sagebionetworks/openchallenges/challenge/service/model/dto/Cha
src/main/java/org/sagebionetworks/openchallenges/challenge/service/model/dto/ChallengeSubmissionTypeDto.java
src/main/java/org/sagebionetworks/openchallenges/challenge/service/model/dto/ChallengesPageDto.java
src/main/java/org/sagebionetworks/openchallenges/challenge/service/model/dto/ChallengesPerYearDto.java
src/main/java/org/sagebionetworks/openchallenges/challenge/service/model/dto/EdamConceptDirectionDto.java
src/main/java/org/sagebionetworks/openchallenges/challenge/service/model/dto/EdamConceptDto.java
src/main/java/org/sagebionetworks/openchallenges/challenge/service/model/dto/EdamConceptSearchQueryDto.java
src/main/java/org/sagebionetworks/openchallenges/challenge/service/model/dto/EdamConceptSortDto.java
src/main/java/org/sagebionetworks/openchallenges/challenge/service/model/dto/EdamConceptsPageDto.java
src/main/java/org/sagebionetworks/openchallenges/challenge/service/model/dto/EdamDataDto.java
src/main/java/org/sagebionetworks/openchallenges/challenge/service/model/dto/EdamOperationDto.java
src/main/java/org/sagebionetworks/openchallenges/challenge/service/model/dto/EdamSectionDto.java
src/main/java/org/sagebionetworks/openchallenges/challenge/service/model/dto/PageMetadataDto.java
Expand Down
14 changes: 11 additions & 3 deletions apps/openchallenges/challenge-service/requests.http
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ GET {{basePath}}/challenges?searchTerms=mortality%20dream

GET {{basePath}}/challenges?minStartDate=2017-01-01&maxStartDate=2017-12-31

### List the challenges that include the input data type 'genomic'.
### Get the challenges whose input data types include the EDAM concept ID 2 or 18

GET {{basePath}}/challenges?inputDataTypes=genomic
GET {{basePath}}/challenges?inputDataTypes=2,18

### List the challenges by category: featured

Expand Down Expand Up @@ -146,4 +146,12 @@ GET {{basePath}}/edamConcepts?searchTerms=sequence

### List the EDAM concepts that belong to the "data" or "format" section.

GET {{basePath}}/edamConcepts?sections=data,format
GET {{basePath}}/edamConcepts?sections=data,format

### Sort the EDAM concepts by their preferred label in asc order (asc by default)

GET {{basePath}}/edamConcepts?sort=preferred_label&direction=asc

### Sort the challenges by relevance (still by preferred label if search terms is empty)

GET {{basePath}}/edamConcepts?sort=relevance&searchTerms=data
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ default ResponseEntity<ChallengeDto> getChallenge(Long challengeId) {
for (MediaType mediaType : MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString =
"{ \"avatarUrl\" : \"https://openchallenges.io\", \"endDate\" : \"2017-07-21T00:00:00.000+00:00\", \"description\" : \"This is an example description of the challenge.\", \"platform\" : { \"name\" : \"name\", \"id\" : 1, \"slug\" : \"example-challenge-platform\" }, \"starredCount\" : 100, \"createdAt\" : \"2022-07-04T22:19:11Z\", \"incentives\" : [ \"publication\", \"publication\" ], \"submissionTypes\" : [ \"container_image\", \"container_image\" ], \"websiteUrl\" : \"https://openchallenges.io\", \"name\" : \"name\", \"id\" : 1, \"categories\" : [ \"featured\", \"featured\" ], \"headline\" : \"Example challenge headline\", \"operation\" : { \"classId\" : \"http://edamontology.org/operation_0230\", \"preferredLabel\" : \"Sequence generation\" }, \"slug\" : \"awesome-challenge\", \"startDate\" : \"2017-07-21T00:00:00.000+00:00\", \"doi\" : \"https://doi.org/123/abc\", \"status\" : \"active\", \"inputDataTypes\" : [ { \"classId\" : \"http://edamontology.org/data_0850\", \"preferredLabel\" : \"Sequence set\" }, { \"classId\" : \"http://edamontology.org/data_0850\", \"preferredLabel\" : \"Sequence set\" } ], \"updatedAt\" : \"2022-07-04T22:19:11Z\" }";
"{ \"avatarUrl\" : \"https://openchallenges.io\", \"endDate\" : \"2017-07-21T00:00:00.000+00:00\", \"description\" : \"This is an example description of the challenge.\", \"platform\" : { \"name\" : \"name\", \"id\" : 1, \"slug\" : \"example-challenge-platform\" }, \"starredCount\" : 100, \"createdAt\" : \"2022-07-04T22:19:11Z\", \"incentives\" : [ \"publication\", \"publication\" ], \"submissionTypes\" : [ \"container_image\", \"container_image\" ], \"websiteUrl\" : \"https://openchallenges.io\", \"name\" : \"name\", \"id\" : 1, \"categories\" : [ \"featured\", \"featured\" ], \"headline\" : \"Example challenge headline\", \"operation\" : { \"classId\" : \"http://edamontology.org/operation_0230\", \"preferredLabel\" : \"Sequence generation\" }, \"slug\" : \"awesome-challenge\", \"startDate\" : \"2017-07-21T00:00:00.000+00:00\", \"doi\" : \"https://doi.org/123/abc\", \"status\" : \"active\", \"inputDataTypes\" : [ { \"classId\" : \"http://edamontology.org/data_0850\", \"preferredLabel\" : \"Sequence set\", \"id\" : 1 }, { \"classId\" : \"http://edamontology.org/data_0850\", \"preferredLabel\" : \"Sequence set\", \"id\" : 1 } ], \"updatedAt\" : \"2022-07-04T22:19:11Z\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import org.sagebionetworks.openchallenges.challenge.service.model.dto.ChallengeSortDto;
import org.sagebionetworks.openchallenges.challenge.service.model.dto.ChallengeStatusDto;
import org.sagebionetworks.openchallenges.challenge.service.model.dto.ChallengeSubmissionTypeDto;
import org.sagebionetworks.openchallenges.challenge.service.model.dto.EdamConceptDirectionDto;
import org.sagebionetworks.openchallenges.challenge.service.model.dto.EdamConceptSortDto;
import org.sagebionetworks.openchallenges.challenge.service.model.dto.EdamSectionDto;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand Down Expand Up @@ -107,6 +109,26 @@ public ChallengeSubmissionTypeDto convert(String source) {
};
}

@Bean
Converter<String, EdamConceptDirectionDto> edamConceptDirectionConverter() {
return new Converter<String, EdamConceptDirectionDto>() {
@Override
public EdamConceptDirectionDto convert(String source) {
return EdamConceptDirectionDto.fromValue(source);
}
};
}

@Bean
Converter<String, EdamConceptSortDto> edamConceptSortConverter() {
return new Converter<String, EdamConceptSortDto>() {
@Override
public EdamConceptSortDto convert(String source) {
return EdamConceptSortDto.fromValue(source);
}
};
}

@Bean
Converter<String, EdamSectionDto> edamSectionConverter() {
return new Converter<String, EdamSectionDto>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class ChallengeDto {

@JsonProperty("inputDataTypes")
@Valid
private List<EdamDataDto> inputDataTypes = null;
private List<EdamConceptDto> inputDataTypes = null;

@JsonProperty("categories")
@Valid
Expand Down Expand Up @@ -380,12 +380,12 @@ public void setSubmissionTypes(List<ChallengeSubmissionTypeDto> submissionTypes)
this.submissionTypes = submissionTypes;
}

public ChallengeDto inputDataTypes(List<EdamDataDto> inputDataTypes) {
public ChallengeDto inputDataTypes(List<EdamConceptDto> inputDataTypes) {
this.inputDataTypes = inputDataTypes;
return this;
}

public ChallengeDto addInputDataTypesItem(EdamDataDto inputDataTypesItem) {
public ChallengeDto addInputDataTypesItem(EdamConceptDto inputDataTypesItem) {
if (this.inputDataTypes == null) {
this.inputDataTypes = new ArrayList<>();
}
Expand All @@ -400,11 +400,11 @@ public ChallengeDto addInputDataTypesItem(EdamDataDto inputDataTypesItem) {
*/
@Valid
@Schema(name = "inputDataTypes", required = false)
public List<EdamDataDto> getInputDataTypes() {
public List<EdamConceptDto> getInputDataTypes() {
return inputDataTypes;
}

public void setInputDataTypes(List<EdamDataDto> inputDataTypes) {
public void setInputDataTypes(List<EdamConceptDto> inputDataTypes) {
this.inputDataTypes = inputDataTypes;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public class ChallengeSearchQueryDto {
@Valid
private List<ChallengeSubmissionTypeDto> submissionTypes = null;

@JsonProperty("inputDataTypes")
@Valid
private List<Long> inputDataTypes = null;

@JsonProperty("categories")
@Valid
private List<ChallengeCategoryDto> categories = null;
Expand Down Expand Up @@ -379,6 +383,36 @@ public void setSubmissionTypes(List<ChallengeSubmissionTypeDto> submissionTypes)
this.submissionTypes = submissionTypes;
}

public ChallengeSearchQueryDto inputDataTypes(List<Long> inputDataTypes) {
this.inputDataTypes = inputDataTypes;
return this;
}

public ChallengeSearchQueryDto addInputDataTypesItem(Long inputDataTypesItem) {
if (this.inputDataTypes == null) {
this.inputDataTypes = new ArrayList<>();
}
this.inputDataTypes.add(inputDataTypesItem);
return this;
}

/**
* An array of EDAM concept ID used to filter the results.
*
* @return inputDataTypes
*/
@Schema(
name = "inputDataTypes",
description = "An array of EDAM concept ID used to filter the results.",
required = false)
public List<Long> getInputDataTypes() {
return inputDataTypes;
}

public void setInputDataTypes(List<Long> inputDataTypes) {
this.inputDataTypes = inputDataTypes;
}

public ChallengeSearchQueryDto categories(List<ChallengeCategoryDto> categories) {
this.categories = categories;
return this;
Expand Down Expand Up @@ -454,6 +488,7 @@ public boolean equals(Object o) {
&& Objects.equals(this.organizations, challengeSearchQuery.organizations)
&& Objects.equals(this.status, challengeSearchQuery.status)
&& Objects.equals(this.submissionTypes, challengeSearchQuery.submissionTypes)
&& Objects.equals(this.inputDataTypes, challengeSearchQuery.inputDataTypes)
&& Objects.equals(this.categories, challengeSearchQuery.categories)
&& Objects.equals(this.searchTerms, challengeSearchQuery.searchTerms);
}
Expand All @@ -473,6 +508,7 @@ public int hashCode() {
organizations,
status,
submissionTypes,
inputDataTypes,
categories,
searchTerms);
}
Expand All @@ -493,6 +529,7 @@ public String toString() {
sb.append(" organizations: ").append(toIndentedString(organizations)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append(" submissionTypes: ").append(toIndentedString(submissionTypes)).append("\n");
sb.append(" inputDataTypes: ").append(toIndentedString(inputDataTypes)).append("\n");
sb.append(" categories: ").append(toIndentedString(categories)).append("\n");
sb.append(" searchTerms: ").append(toIndentedString(searchTerms)).append("\n");
sb.append("}");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package org.sagebionetworks.openchallenges.challenge.service.model.dto;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.*;
import javax.annotation.Generated;
import javax.validation.constraints.*;

/** The direction to sort the results by. */
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public enum EdamConceptDirectionDto {
ASC("asc"),

DESC("desc");

private String value;

EdamConceptDirectionDto(String value) {
this.value = value;
}

@JsonValue
public String getValue() {
return value;
}

@Override
public String toString() {
return String.valueOf(value);
}

@JsonCreator
public static EdamConceptDirectionDto fromValue(String value) {
for (EdamConceptDirectionDto b : EdamConceptDirectionDto.values()) {
if (b.value.equals(value)) {
return b;
}
}
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ public class EdamConceptSearchQueryDto {
@JsonProperty("pageSize")
private Integer pageSize = 100;

@JsonProperty("sort")
private EdamConceptSortDto sort = EdamConceptSortDto.RELEVANCE;

@JsonProperty("direction")
private EdamConceptDirectionDto direction = null;

@JsonProperty("searchTerms")
private String searchTerms;

Expand Down Expand Up @@ -74,6 +80,46 @@ public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}

public EdamConceptSearchQueryDto sort(EdamConceptSortDto sort) {
this.sort = sort;
return this;
}

/**
* Get sort
*
* @return sort
*/
@Valid
@Schema(name = "sort", required = false)
public EdamConceptSortDto getSort() {
return sort;
}

public void setSort(EdamConceptSortDto sort) {
this.sort = sort;
}

public EdamConceptSearchQueryDto direction(EdamConceptDirectionDto direction) {
this.direction = direction;
return this;
}

/**
* Get direction
*
* @return direction
*/
@Valid
@Schema(name = "direction", required = false)
public EdamConceptDirectionDto getDirection() {
return direction;
}

public void setDirection(EdamConceptDirectionDto direction) {
this.direction = direction;
}

public EdamConceptSearchQueryDto searchTerms(String searchTerms) {
this.searchTerms = searchTerms;
return this;
Expand Down Expand Up @@ -139,13 +185,15 @@ public boolean equals(Object o) {
EdamConceptSearchQueryDto edamConceptSearchQuery = (EdamConceptSearchQueryDto) o;
return Objects.equals(this.pageNumber, edamConceptSearchQuery.pageNumber)
&& Objects.equals(this.pageSize, edamConceptSearchQuery.pageSize)
&& Objects.equals(this.sort, edamConceptSearchQuery.sort)
&& Objects.equals(this.direction, edamConceptSearchQuery.direction)
&& Objects.equals(this.searchTerms, edamConceptSearchQuery.searchTerms)
&& Objects.equals(this.sections, edamConceptSearchQuery.sections);
}

@Override
public int hashCode() {
return Objects.hash(pageNumber, pageSize, searchTerms, sections);
return Objects.hash(pageNumber, pageSize, sort, direction, searchTerms, sections);
}

@Override
Expand All @@ -154,6 +202,8 @@ public String toString() {
sb.append("class EdamConceptSearchQueryDto {\n");
sb.append(" pageNumber: ").append(toIndentedString(pageNumber)).append("\n");
sb.append(" pageSize: ").append(toIndentedString(pageSize)).append("\n");
sb.append(" sort: ").append(toIndentedString(sort)).append("\n");
sb.append(" direction: ").append(toIndentedString(direction)).append("\n");
sb.append(" searchTerms: ").append(toIndentedString(searchTerms)).append("\n");
sb.append(" sections: ").append(toIndentedString(sections)).append("\n");
sb.append("}");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package org.sagebionetworks.openchallenges.challenge.service.model.dto;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.*;
import javax.annotation.Generated;
import javax.validation.constraints.*;

/** What to sort results by. */
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public enum EdamConceptSortDto {
PREFERRED_LABEL("preferred_label"),

RELEVANCE("relevance");

private String value;

EdamConceptSortDto(String value) {
this.value = value;
}

@JsonValue
public String getValue() {
return value;
}

@Override
public String toString() {
return String.valueOf(value);
}

@JsonCreator
public static EdamConceptSortDto fromValue(String value) {
for (EdamConceptSortDto b : EdamConceptSortDto.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}
Loading

0 comments on commit 3161e40

Please sign in to comment.