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

Song 559 change base schema #573

Merged
merged 42 commits into from
Jan 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
5017f27
formatted
rtisma Dec 17, 2019
31407f8
Merge branch 'develop' into song-559-change-base-schema
rtisma Dec 17, 2019
085d3f7
updated studyId on the code side
rtisma Dec 17, 2019
21b64ef
change study to studyId in server
rtisma Dec 17, 2019
11a450c
fixed studyId outside of server
rtisma Dec 17, 2019
3b023f0
update presentation of info field to not_empty
rtisma Dec 17, 2019
df0cd62
renamed the sample field in the java analysis model to samples
rtisma Dec 17, 2019
af8b1dc
renamed sample to samples in json fixtures
rtisma Dec 17, 2019
fe7795d
fixed failing tests for sample->samples rename
rtisma Dec 18, 2019
24cf094
renamed file to files for java models
rtisma Dec 18, 2019
43b0c89
renamed field file->files in json test fixtures
rtisma Dec 18, 2019
1641329
passing tests for file->files rename
rtisma Dec 18, 2019
f6f36d2
changed /upload endpoint to /submit
rtisma Dec 18, 2019
dbcf8e0
added data_type to java code
rtisma Dec 18, 2019
94094ed
Merge pull request #570 from overture-stack/file-study-submit-sample-…
rtisma Dec 18, 2019
6e15436
updated test fixtures with dataType
rtisma Dec 18, 2019
2f2fc55
test passing for dataType change
rtisma Dec 18, 2019
9716bbb
Merge branch 'song-559-change-base-schema' into type-changes
rtisma Dec 18, 2019
0c3a33e
renamed donorSubmitterId to submitterDonorId in code
rtisma Dec 18, 2019
66bb64d
changed specimenSubmitterId to submitterSpecimenId
rtisma Dec 18, 2019
9404c84
changed sampleSubmitterId to sampleSpecimenId
rtisma Dec 18, 2019
2eb91a8
deleted unused code and deprecated VariantCall and SequencingCall leg…
rtisma Dec 19, 2019
185fafe
cleaned up old comments and unused code. Added migrations for tumour …
rtisma Dec 20, 2019
8d0bd45
added tumourNormalDesignation and specimenTissueSource
rtisma Dec 20, 2019
f811774
added fix script
rtisma Dec 22, 2019
33c7762
updated
rtisma Jan 2, 2020
8279d34
fixed
rtisma Jan 2, 2020
7a374a9
updated
rtisma Jan 2, 2020
cf7cea0
updated
rtisma Jan 2, 2020
94cc061
added ordering
rtisma Jan 2, 2020
f357200
updated json test fixtures
rtisma Jan 2, 2020
a9c63c5
all tests passing
rtisma Jan 2, 2020
67dbbb3
fixed tumourNormalDesignation and added matched normal and did migration
rtisma Jan 3, 2020
9c473b2
updated all json fixtures
rtisma Jan 3, 2020
c9754c9
updated
rtisma Jan 3, 2020
bc8b426
fixed failing tests
rtisma Jan 6, 2020
b185562
updated code rename from donorGender to gender
rtisma Jan 6, 2020
99c37a5
test passing and ready to merge into main feature branch
rtisma Jan 6, 2020
c262c38
Merge branch 'develop' into song-559-change-base-schema
rtisma Jan 6, 2020
f7d5102
removed helper python script
rtisma Jan 6, 2020
81cd8de
typo: forgot to remove specimenClass and undeprecate speciemnType for…
rtisma Jan 6, 2020
bd86319
merged all migrations created in this branch into 1 file
rtisma Jan 6, 2020
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 @@ -270,7 +270,7 @@ public void testAnalysisSearch() {
.analysisId(DUMMY_ANALYSIS_ID)
.analysisState(UNPUBLISHED)
.analysisType(ANALYSIS_TYPE_ID1)
.study(DUMMY_STUDY_ID)
.studyId(DUMMY_STUDY_ID)
.build();
when(songApi.getAnalysis(DUMMY_STUDY_ID, DUMMY_ANALYSIS_ID)).thenReturn(expectedAnalysis);
assertOutputJson(objectToTree(expectedAnalysis), "search", "-a", DUMMY_ANALYSIS_ID);
Expand All @@ -289,7 +289,7 @@ public void testIdSearch() {
.analysisId(DUMMY_ANALYSIS_ID)
.analysisState(UNPUBLISHED)
.analysisType(ANALYSIS_TYPE_ID1)
.study(DUMMY_STUDY_ID)
.studyId(DUMMY_STUDY_ID)
.build());

when(songApi.idSearch(DUMMY_STUDY_ID, expectedSample.getSampleId(), null, null, null))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
public class Analysis extends DynamicData {

private String analysisId;
private String study;
private String studyId;
private AnalysisStates analysisState;
private AnalysisTypeId analysisType;
private List<CompositeSample> sample;
private List<FileDTO> file;
private List<CompositeSample> samples;
private List<FileDTO> files;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ public class Donor extends Metadata {

private String donorId;
private String studyId;
private String donorSubmitterId;
private String donorGender;
private String submitterDonorId;
private String gender;
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ public interface File extends FileMetadata, FileContent {
String getFileName();

String getFileType();

String getDataType();
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ public class FileDTO extends Metadata implements File {
private String fileMd5sum;
private Long fileSize;
private String fileAccess;
private String dataType;
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
@AllArgsConstructor
@EqualsAndHashCode
@ToString
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class Metadata {

private final Map<String, Object> info = new TreeMap<>();
Expand All @@ -59,6 +59,7 @@ public void setInfo(String info) {
}

@JsonGetter
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public JsonNode getInfo() {
return JsonUtils.toJsonNode(info);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class Sample extends Metadata {

private String sampleId;
private String specimenId;
private String sampleSubmitterId;
private String submitterSampleId;
private String sampleType;
private String matchedNormalSubmitterSampleId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public class Specimen extends Metadata {

private String specimenId;
private String donorId;
private String specimenSubmitterId;
private String specimenClass;
private String submitterSpecimenId;
private String tumourNormalDesignation;
private String specimenTissueSource;
private String specimenType;
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,6 @@ public boolean isAlive() {
}
}

/**
* TODO: [DCC-5641] the ResponseEntity from AnalysisController is not returned, since
* RestTemplate.put is a void method. need to find RestTemplate implementation that returns a
* response
*/
public String publish(
@NonNull String studyId, @NonNull String analysisId, boolean ignoreUndefinedMd5) {
val url = endpoint.publish(studyId, analysisId, ignoreUndefinedMd5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public Endpoint() {
}

public String submit(@NonNull String studyId) {
return format("%s/upload/%s", serverUrl, studyId);
return format("%s/submit/%s", serverUrl, studyId);
}

public String getAnalysisFiles(@NonNull String studyId, @NonNull String analysisId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ public class RestClientTest {
private static final Sample EXAMPLE_SAMPLE1 =
Sample.builder()
.sampleId("someSampleId_1")
.sampleSubmitterId("someSampleSubmitterId_1")
.submitterSampleId("someSampleSubmitterId_1")
.sampleType("someSampleType_1")
.specimenId("someSpecimenId_1")
.build();
private static final JsonNode EXAMPLE_SAMPLE1_JSON = objectToTree(EXAMPLE_SAMPLE1);
private static final Sample EXAMPLE_SAMPLE2 =
Sample.builder()
.sampleId("someSampleId_2")
.sampleSubmitterId("someSampleSubmitterId_2")
.submitterSampleId("someSampleSubmitterId_2")
.sampleType("someSampleType_2")
.specimenId("someSpecimenId_2")
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
*/
package bio.overture.song.server.config;

import static bio.overture.song.server.model.enums.Constants.SEQUENCING_READ_TYPE;
import static bio.overture.song.server.model.enums.Constants.VARIANT_CALL_TYPE;
import static bio.overture.song.server.utils.ParameterChecker.createParameterChecker;

import bio.overture.song.core.utils.JsonDocUtils;
Expand All @@ -28,7 +26,6 @@
import bio.overture.song.server.utils.ParameterChecker;
import bio.overture.song.server.validation.SchemaValidator;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.collect.ImmutableMap;
import com.networknt.schema.JsonSchema;
import java.util.HashMap;
import java.util.Map;
Expand All @@ -47,10 +44,7 @@
public class ValidationConfig {

private static String[] schemaList = {
"schemas/sequencingRead.json",
"schemas/variantCall.json",
"schemas/fileUpdateRequest.json",
"schemas/storageDownloadResponse.json"
"schemas/fileUpdateRequest.json", "schemas/storageDownloadResponse.json"
};

@Value("${validation.delayMs:500}")
Expand Down Expand Up @@ -88,12 +82,4 @@ public Map<String, JsonSchema> schemaCache() {
}
return cache;
}

@Bean
public Map<String, String> jsonSchemaMap() {
return ImmutableMap.<String, String>builder()
.put(SEQUENCING_READ_TYPE, "schemas/sequencingRead.json")
.put(VARIANT_CALL_TYPE, "schemas/variantCall.json")
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,6 @@ public Donor read(@PathVariable("studyId") String studyId, @PathVariable("id") S
return donorService.securedRead(studyId, id);
}

/**
* [DCC-5726] - updates disabled until back propagation updates due to business key updates is
* implemented
*/
// @PutMapping(value = "/donors/{id}", consumes = { APPLICATION_JSON_VALUE,
// APPLICATION_JSON_UTF8_VALUE })
// @ResponseBody
// @PreAuthorize("@studySecurity.authorize(authentication, #studyId)")
// public String update(@PathVariable("study") String studyId, @PathVariable("id") String id,
// @RequestBody Donor donor) {
// // TODO: [DCC-5642] Add checkRequest between path ID and Entity's ID
// return donorService.update(donor);
// }

@ApiOperation(
value = "DeleteDonors",
notes = "Deletes donor data and all dependent specimens and samples for donorIds")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,6 @@ public Sample read(@PathVariable("studyId") String studyId, @PathVariable("id")
return sampleService.securedRead(studyId, id);
}

/**
* [DCC-5726] - updates disabled until back propagation updates due to business key updates is
* implemented
*/
// @PutMapping(value = "/samples/{id}", consumes = { APPLICATION_JSON_VALUE,
// APPLICATION_JSON_UTF8_VALUE })
// @ResponseBody
// @PreAuthorize("@studySecurity.authorize(authentication, #studyId)")
// public String update(@PathVariable("studyId") String studyId, @PathVariable("id") String id,
// @RequestBody Sample sample) {
// // TODO: [DCC-5642] Add checkRequest between path ID and Entity's ID
// return sampleService.update(sample);
// }

@ApiOperation(value = "DeleteSamples", notes = "Deletes sample data for sampleIds")
@DeleteMapping(value = "/samples/{ids}")
@ResponseBody
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,6 @@ public Specimen read(@PathVariable("studyId") String studyId, @PathVariable("id"
return specimenService.securedRead(studyId, id);
}

/**
* [DCC-5726] - updates disabled until back propagation updates due to business key updates is
* implemented
*/
// @PutMapping(value = "/specimens/{id}", consumes = { APPLICATION_JSON_VALUE,
// APPLICATION_JSON_UTF8_VALUE })
// @ResponseBody
// @PreAuthorize("@studySecurity.authorize(authentication, #studyId)")
// public String update(@PathVariable("studyId") String studyId, @PathVariable("id") String id,
// @RequestBody Specimen specimen) {
// // TODO: [DCC-5642] Add checkRequest between path ID and Entity's ID
// return specimenService.update(specimen);
// }

@ApiOperation(
value = "DeleteSpecimens",
notes = "Deletes specimen data and all dependent samples for specimenIds")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;

import bio.overture.song.core.model.SubmitResponse;
import bio.overture.song.server.service.UploadService;
import bio.overture.song.server.service.SubmitService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javax.validation.Valid;
Expand All @@ -39,13 +39,13 @@

@Slf4j
@RestController
@RequestMapping(path = "/upload")
@RequestMapping(path = "/submit")
@RequiredArgsConstructor
@Api(tags = "Upload", description = "Submit and validate json metadata")
public class UploadController {
@Api(tags = "Submit", description = "Submit and validate json metadata")
public class SubmitController {

/** Dependencies */
@Autowired private final UploadService uploadService;
@Autowired private final SubmitService submitService;

@ApiOperation(value = "Submit", notes = "Synchronously submit a json payload")
@PostMapping(
Expand All @@ -56,6 +56,6 @@ public SubmitResponse submit(
@RequestHeader(value = AUTHORIZATION, required = false) final String accessToken,
@PathVariable("studyId") String studyId,
@RequestBody @Valid String json_payload) {
return uploadService.submit(studyId, json_payload);
return submitService.submit(studyId, json_payload);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public interface FileConverter {
FileUpdateRequest fileEntityToFileUpdateRequest(FileEntity file);

@Mapping(target = "fileType", ignore = true)
@Mapping(target = "dataType", ignore = true)
@Mapping(target = "objectId", ignore = true)
@Mapping(target = "studyId", ignore = true)
@Mapping(target = "analysisId", ignore = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public interface PayloadConverter {
@Mapping(target = "objectId", ignore = true)
@Mapping(target = "studyId", ignore = true)
@Mapping(target = "info", ignore = true)
@Mapping(target = "dataType", nullValuePropertyMappingStrategy = SET_TO_DEFAULT)
@Mapping(target = "fileType", nullValuePropertyMappingStrategy = SET_TO_DEFAULT)
@Mapping(target = "fileAccess", nullValuePropertyMappingStrategy = SET_TO_DEFAULT)
void updateFile(FileEntity ref, @MappingTarget FileEntity entityToUpdate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class Analysis {
private String analysisId;

@Column(name = TableAttributeNames.STUDY_ID, nullable = false)
private String study;
private String studyId;

@Column(name = TableAttributeNames.STATE, nullable = false)
private String analysisState = UNPUBLISHED.name();
Expand All @@ -82,9 +82,9 @@ public class Analysis {
@JsonIgnore
private AnalysisData analysisData;

@Transient private List<CompositeEntity> sample;
@Transient private List<CompositeEntity> samples;

@Transient private List<FileEntity> file;
@Transient private List<FileEntity> files;

// TODO: need to remove this, and replace anything that needs this with Payload object
public AnalysisTypeId getAnalysisType() {
Expand Down

This file was deleted.

This file was deleted.

Loading