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

feat(openchallenges): add EDAM terms SQL table and update Challenge.inputDataTypes #2265

Closed
wants to merge 17 commits into from
Closed
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 @@ -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\", \"slug\" : \"awesome-challenge\", \"startDate\" : \"2017-07-21T00:00:00.000+00:00\", \"doi\" : \"https://doi.org/123/abc\", \"status\" : \"active\", \"inputDataTypes\" : [ { \"name\" : \"gene expression\", \"id\" : 1, \"slug\" : \"gene-expression\" }, { \"name\" : \"gene expression\", \"id\" : 1, \"slug\" : \"gene-expression\" } ], \"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\", \"slug\" : \"awesome-challenge\", \"startDate\" : \"2017-07-21T00:00:00.000+00:00\", \"doi\" : \"https://doi.org/123/abc\", \"status\" : \"active\", \"inputDataTypes\" : [ { \"createdAt\" : \"2022-07-04T22:19:11Z\", \"subclassOf\" : \"data_0006\", \"name\" : \"Alignment\", \"edamId\" : \"data_1916\", \"updatedAt\" : \"2000-01-23T04:56:07.000+00:00\" }, { \"createdAt\" : \"2022-07-04T22:19:11Z\", \"subclassOf\" : \"data_0006\", \"name\" : \"Alignment\", \"edamId\" : \"data_1916\", \"updatedAt\" : \"2000-01-23T04:56:07.000+00:00\" } ], \"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 @@ -11,22 +11,22 @@
import javax.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;

/** A challenge input data type. */
@Schema(name = "ChallengeInputDataType", description = "A challenge input data type.")
/** A challenge EDAM annotation. */
@Schema(name = "ChallengeInputDataType", description = "A challenge EDAM annotation.")
@JsonTypeName("ChallengeInputDataType")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
// TODO Add x-java-class-annotations
public class ChallengeInputDataTypeDto {

@JsonProperty("id")
private Long id;

@JsonProperty("slug")
private String slug;
@JsonProperty("edamId")
private String edamId;

@JsonProperty("name")
private String name;

@JsonProperty("subclassOf")
private String subclassOf = null;

@JsonProperty("createdAt")
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
private OffsetDateTime createdAt;
Expand All @@ -35,79 +35,79 @@ public class ChallengeInputDataTypeDto {
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
private OffsetDateTime updatedAt;

public ChallengeInputDataTypeDto id(Long id) {
this.id = id;
public ChallengeInputDataTypeDto edamId(String edamId) {
this.edamId = edamId;
return this;
}

/**
* The unique identifier of a challenge input data type.
* The prefix Internationalized Resource Identifier (IRI) of the EDAM ontology term.
*
* @return id
* @return edamId
*/
@NotNull
@Size(min = 3, max = 16)
@Schema(
name = "id",
example = "1",
description = "The unique identifier of a challenge input data type.",
name = "edamId",
example = "data_1916",
description =
"The prefix Internationalized Resource Identifier (IRI) of the EDAM ontology term.",
required = true)
public Long getId() {
return id;
public String getEdamId() {
return edamId;
}

public void setId(Long id) {
this.id = id;
public void setEdamId(String edamId) {
this.edamId = edamId;
}

public ChallengeInputDataTypeDto slug(String slug) {
this.slug = slug;
public ChallengeInputDataTypeDto name(String name) {
this.name = name;
return this;
}

/**
* The slug of the challenge input data type.
* The preferred name/label of the EDAM ontology term.
*
* @return slug
* @return name
*/
@NotNull
@Pattern(regexp = "^[a-z0-9]+(?:-[a-z0-9]+)*$")
@Size(min = 3, max = 30)
@Size(min = 3, max = 80)
@Schema(
name = "slug",
example = "gene-expression",
description = "The slug of the challenge input data type.",
name = "name",
example = "Alignment",
description = "The preferred name/label of the EDAM ontology term.",
required = true)
public String getSlug() {
return slug;
public String getName() {
return name;
}

public void setSlug(String slug) {
this.slug = slug;
public void setName(String name) {
this.name = name;
}

public ChallengeInputDataTypeDto name(String name) {
this.name = name;
public ChallengeInputDataTypeDto subclassOf(String subclassOf) {
this.subclassOf = subclassOf;
return this;
}

/**
* The name of the challenge input data type.
* The parent EDAM ID(s) of the EDAM ontology term.
*
* @return name
* @return subclassOf
*/
@NotNull
@Size(min = 3, max = 50)
@Size(min = 3, max = 60)
@Schema(
name = "name",
example = "gene expression",
description = "The name of the challenge input data type.",
required = true)
public String getName() {
return name;
name = "subclassOf",
example = "data_0006",
description = "The parent EDAM ID(s) of the EDAM ontology term.",
required = false)
public String getSubclassOf() {
return subclassOf;
}

public void setName(String name) {
this.name = name;
public void setSubclassOf(String subclassOf) {
this.subclassOf = subclassOf;
}

public ChallengeInputDataTypeDto createdAt(OffsetDateTime createdAt) {
Expand Down Expand Up @@ -143,7 +143,7 @@ public ChallengeInputDataTypeDto updatedAt(OffsetDateTime updatedAt) {
*/
@NotNull
@Valid
@Schema(name = "updatedAt", example = "2022-07-04T22:19:11Z", required = true)
@Schema(name = "updatedAt", required = true)
public OffsetDateTime getUpdatedAt() {
return updatedAt;
}
Expand All @@ -161,25 +161,25 @@ public boolean equals(Object o) {
return false;
}
ChallengeInputDataTypeDto challengeInputDataType = (ChallengeInputDataTypeDto) o;
return Objects.equals(this.id, challengeInputDataType.id)
&& Objects.equals(this.slug, challengeInputDataType.slug)
return Objects.equals(this.edamId, challengeInputDataType.edamId)
&& Objects.equals(this.name, challengeInputDataType.name)
&& Objects.equals(this.subclassOf, challengeInputDataType.subclassOf)
&& Objects.equals(this.createdAt, challengeInputDataType.createdAt)
&& Objects.equals(this.updatedAt, challengeInputDataType.updatedAt);
}

@Override
public int hashCode() {
return Objects.hash(id, slug, name, createdAt, updatedAt);
return Objects.hash(edamId, name, subclassOf, createdAt, updatedAt);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ChallengeInputDataTypeDto {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" slug: ").append(toIndentedString(slug)).append("\n");
sb.append(" edamId: ").append(toIndentedString(edamId)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" subclassOf: ").append(toIndentedString(subclassOf)).append("\n");
sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n");
sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n");
sb.append("}");
Expand Down
Loading
Loading