Skip to content

Commit

Permalink
Sample status bug fix (#908)
Browse files Browse the repository at this point in the history
- Add status to mock incoming request data

Signed-off-by: Angelica Ochoa <[email protected]>
  • Loading branch information
ao508 authored Mar 16, 2023
1 parent 403ebcd commit 2a08454
Show file tree
Hide file tree
Showing 22 changed files with 370 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ public Boolean updateSampleMetadata(SampleMetadata sampleMetadata, Boolean fromL
}
LOG.info("Persisting new sample to db: " + sampleMetadata.getPrimaryId());
SmileSample sample = SampleDataFactory.buildNewResearchSampleFromMetadata(
sampleMetadata.getIgoRequestId(), sampleMetadata, request.getIsCmoRequest());
sampleMetadata.getIgoRequestId(), sampleMetadata,
request.getIsCmoRequest(), sampleMetadata.getStatus());
saveSmileSample(sample);
createSampleRequestRelationship(sample.getSmileSampleId(), request.getSmileRequestId());
return Boolean.TRUE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.mskcc.smile.model.RequestMetadata;
Expand Down Expand Up @@ -54,15 +55,28 @@ public static RequestMetadata buildNewRequestMetadataFromMetadata(String request
private static List<SmileSample> extractSmileSamplesFromIgoResponse(Object message)
throws JsonProcessingException {
Map<String, Object> map = mapper.readValue(message.toString(), Map.class);
IgoSampleManifest[] samples = mapper.convertValue(map.get("samples"),
IgoSampleManifest[].class);
/// SAMPLE STATUS NOT GETTING SET HERE
List<Object> sampleManifests =
Arrays.asList(mapper.convertValue(map.get("samples"),
Object[].class));
String requestId = (String) map.get("requestId");
Boolean isCmoRequest = (Boolean) map.get("isCmoRequest");

List<SmileSample> requestSamplesList = new ArrayList<>();
for (IgoSampleManifest s: samples) {
for (Object s : sampleManifests) {
Map<String, Object> sampleMap = mapper.convertValue(s, Map.class);
Map<String, Object> sampleStatusMap = mapper.convertValue(
sampleMap.get("status"), Map.class);
Status sampleStatus = new Status(Boolean.valueOf(
sampleStatusMap.get("validationStatus").toString()),
sampleStatusMap.get("validationReport").toString());

IgoSampleManifest sampleManifest = mapper.convertValue(s,
IgoSampleManifest.class);
SmileSample sample = SampleDataFactory
.buildNewResearchSampleFromMetadata(requestId, s, isCmoRequest);
.buildNewResearchSampleFromMetadata(requestId,
sampleManifest, isCmoRequest, sampleStatus);

requestSamplesList.add(sample);
}
return requestSamplesList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ private static Map<Integer, String> initDmpClinicalMetastasisValuesMap() {
* @param requestId
* @param sampleMetadata
* @param isCmoRequest
* @param sampleStatus
* @return SmileSample
*/
public static SmileSample buildNewResearchSampleFromMetadata(String requestId,
SampleMetadata sampleMetadata, Boolean isCmoRequest) {
SampleMetadata sampleMetadata, Boolean isCmoRequest, Status sampleStatus) {
sampleMetadata.setIgoRequestId(requestId);
if (sampleMetadata.getImportDate() == null) {
sampleMetadata.setImportDate(LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE));
Expand All @@ -58,6 +59,7 @@ public static SmileSample buildNewResearchSampleFromMetadata(String requestId,
if (isCmoRequest != null) {
sampleMetadata.addAdditionalProperty("isCmoSample", Boolean.TRUE.toString());
}
sampleMetadata.setStatus(sampleStatus);

SmileSample sample = new SmileSample();
sample.addSampleMetadata(sampleMetadata);
Expand All @@ -80,13 +82,15 @@ public static SmileSample buildNewResearchSampleFromMetadata(String requestId,
* @param requestId
* @param igoSampleManifest
* @param isCmoRequest
* @param sampleStatus
* @return SmileSample
* @throws JsonProcessingException
*/
public static SmileSample buildNewResearchSampleFromMetadata(String requestId,
IgoSampleManifest igoSampleManifest, Boolean isCmoRequest) throws JsonProcessingException {
IgoSampleManifest igoSampleManifest, Boolean isCmoRequest, Status sampleStatus)
throws JsonProcessingException {
SampleMetadata sampleMetadata = new SampleMetadata(igoSampleManifest);
return buildNewResearchSampleFromMetadata(requestId, sampleMetadata, null);
return buildNewResearchSampleFromMetadata(requestId, sampleMetadata, null, sampleStatus);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ public org.neo4j.ogm.config.Configuration configuration() {

/**
* Persists the Mock Request data to the test database.
* @throws Exception
* @param requestRepository
* @param sampleRepository
* @param patientRepository
*/
@Autowired
public CorrectCmoPatientIdHandlerTest(SmileRequestRepository requestRepository,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
"recipe": "GENESET101_BAITS",
"normalizedPatientId": "testingNormalizedPatientIdvalue",
"sampleType": "PDX"
},
"status": {
"validationStatus": true,
"validationReport": "{}"
}
},
{
Expand Down Expand Up @@ -105,6 +109,10 @@
"recipe": "GENESET101_BAITS",
"normalizedPatientId": "testingNormalizedPatientIdvalue",
"sampleType": "Blood"
},
"status": {
"validationStatus": true,
"validationReport": "{}"
}
},
{
Expand Down Expand Up @@ -156,6 +164,10 @@
"recipe": "GENESET101_BAITS",
"normalizedPatientId": "testingNormalizedPatientIdvalue",
"sampleType": "PDX"
},
"status": {
"validationStatus": true,
"validationReport": "{}"
}
},
{
Expand Down Expand Up @@ -208,6 +220,10 @@
"recipe": "GENESET101_BAITS",
"normalizedPatientId": "testingNormalizedPatientIdvalue",
"sampleType": "Blood"
},
"status": {
"validationStatus": true,
"validationReport": "{}"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@
"sampleType": "Tissue",
"normalizedPatientId": "MRN_REDACTED",
"recipe": "GENESET101_BAITS"
},
"status": {
"validationStatus": true,
"validationReport": "{}"
}
},
{
Expand Down Expand Up @@ -123,6 +127,10 @@
"sampleType": "Whole Blood",
"normalizedPatientId": "MRN_REDACTED",
"recipe": "GENESET101_BAITS"
},
"status": {
"validationStatus": true,
"validationReport": "{}"
}
},
{
Expand Down Expand Up @@ -178,6 +186,10 @@
"sampleType": "Tissue",
"normalizedPatientId": "MRN_REDACTED",
"recipe": "GENESET101_BAITS"
},
"status": {
"validationStatus": true,
"validationReport": "{}"
}
},
{
Expand Down Expand Up @@ -233,6 +245,10 @@
"sampleType": "Whole Blood",
"normalizedPatientId": "MRN_REDACTED",
"recipe": "GENESET101_BAITS"
},
"status": {
"validationStatus": true,
"validationReport": "{}"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@
"sampleType": "Tissue",
"normalizedPatientId": "MRN_REDACTED",
"recipe": "GENESET101_BAITS"
},
"status": {
"validationStatus": true,
"validationReport": "{}"
}
},
{
Expand Down Expand Up @@ -123,6 +127,10 @@
"sampleType": "Whole Blood",
"normalizedPatientId": "MRN_REDACTED",
"recipe": "GENESET101_BAITS"
},
"status": {
"validationStatus": true,
"validationReport": "{}"
}
},
{
Expand Down Expand Up @@ -178,6 +186,10 @@
"sampleType": "Tissue",
"normalizedPatientId": "MRN_REDACTED",
"recipe": "GENESET101_BAITS"
},
"status": {
"validationStatus": true,
"validationReport": "{}"
}
},
{
Expand Down Expand Up @@ -233,6 +245,10 @@
"sampleType": "Whole Blood",
"normalizedPatientId": "MRN_REDACTED",
"recipe": "GENESET101_BAITS"
},
"status": {
"validationStatus": true,
"validationReport": "{}"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@
"recipe": "GENESET101_BAITS",
"normalizedPatientId": "testingNormalizedPatientIdvalue",
"sampleType": "PDX"
},
"status": {
"validationStatus": true,
"validationReport": "{}"
}
},
{
Expand Down Expand Up @@ -123,6 +127,10 @@
"recipe": "GENESET101_BAITS",
"normalizedPatientId": "testingNormalizedPatientIdvalue",
"sampleType": "Blood"
},
"status": {
"validationStatus": true,
"validationReport": "{}"
}
},
{
Expand Down Expand Up @@ -174,6 +182,10 @@
"recipe": "GENESET101_BAITS",
"normalizedPatientId": "testingNormalizedPatientIdvalue",
"sampleType": "PDX"
},
"status": {
"validationStatus": true,
"validationReport": "{}"
}
},
{
Expand Down Expand Up @@ -226,6 +238,10 @@
"recipe": "GENESET101_BAITS",
"normalizedPatientId": "testingNormalizedPatientIdvalue",
"sampleType": "Blood"
},
"status": {
"validationStatus": true,
"validationReport": "{}"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@
"sampleType": "Tissue",
"normalizedPatientId": "MRN_REDACTED",
"recipe": "GENESET101_BAITS"
},
"status": {
"validationStatus": true,
"validationReport": "{}"
}
},
{
Expand Down Expand Up @@ -123,6 +127,10 @@
"sampleType": "Whole Blood",
"normalizedPatientId": "MRN_REDACTED",
"recipe": "GENESET101_BAITS"
},
"status": {
"validationStatus": true,
"validationReport": "{}"
}
},
{
Expand Down Expand Up @@ -178,6 +186,10 @@
"sampleType": "Tissue",
"normalizedPatientId": "MRN_REDACTED",
"recipe": "GENESET101_BAITS"
},
"status": {
"validationStatus": true,
"validationReport": "{}"
}
},
{
Expand Down Expand Up @@ -233,6 +245,10 @@
"sampleType": "Whole Blood",
"normalizedPatientId": "MRN_REDACTED",
"recipe": "GENESET101_BAITS"
},
"status": {
"validationStatus": true,
"validationReport": "{}"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@
"recipe": "GENESET101_BAITS",
"normalizedPatientId": "testingNormalizedPatientIdvalue",
"sampleType": "PDX"
},
"status": {
"validationStatus": true,
"validationReport": "{}"
}
},
{
Expand Down Expand Up @@ -123,6 +127,10 @@
"recipe": "GENESET101_BAITS",
"normalizedPatientId": "testingNormalizedPatientIdvalue",
"sampleType": "XenograftDerivedCellLine"
},
"status": {
"validationStatus": true,
"validationReport": "{}"
}
},
{
Expand Down Expand Up @@ -178,6 +186,10 @@
"recipe": "GENESET101_BAITS",
"normalizedPatientId": "testingNormalizedPatientIdvalue",
"sampleType": "Exosome"
},
"status": {
"validationStatus": true,
"validationReport": "{}"
}
},
{
Expand Down Expand Up @@ -233,6 +245,10 @@
"sampleType": "Whole Blood",
"normalizedPatientId": "testingNormalizedPatientIdvalue",
"recipe": "GENESET101_BAITS"
},
"status": {
"validationStatus": true,
"validationReport": "{}"
}
}
],
Expand Down
Loading

0 comments on commit 2a08454

Please sign in to comment.