-
Notifications
You must be signed in to change notification settings - Fork 497
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
Resolve KM plot censored event bug and add caching #11027
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
import org.cbioportal.web.parameter.PatientIdentifier; | ||
import org.cbioportal.web.parameter.SurvivalRequest; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.cache.annotation.Cacheable; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
|
@@ -36,7 +37,7 @@ | |
@Tag(name = "Survival", description = " ") | ||
public class SurvivalController { | ||
private final ClinicalEventService clinicalEventService; | ||
|
||
@Autowired | ||
public SurvivalController(ClinicalEventService clinicalEventService) { | ||
this.clinicalEventService = clinicalEventService; | ||
|
@@ -59,18 +60,25 @@ public ResponseEntity<List<ClinicalData>> fetchSurvivalData( | |
// prevent reference to this attribute in the swagger-ui interface. this attribute is needed for the @PreAuthorize tag above. | ||
@Valid @RequestAttribute(required = false, value = "interceptedSurvivalRequest") SurvivalRequest interceptedSurvivalRequest) { | ||
|
||
return new ResponseEntity<>(cachedSurvivalData(interceptedSurvivalRequest), | ||
HttpStatus.OK); | ||
} | ||
|
||
@Cacheable( | ||
cacheResolver = "staticRepositoryCacheOneResolver", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wondering why we need to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure. will update |
||
condition = "@cacheEnabledConfig.getEnabled()" | ||
) | ||
public List<ClinicalData> cachedSurvivalData(SurvivalRequest interceptedSurvivalRequest) { | ||
List<String> studyIds = new ArrayList<>(); | ||
List<String> patientIds = new ArrayList<>(); | ||
for (PatientIdentifier patientIdentifier : interceptedSurvivalRequest.getPatientIdentifiers()) { | ||
studyIds.add(patientIdentifier.getStudyId()); | ||
patientIds.add(patientIdentifier.getPatientId()); | ||
} | ||
|
||
List<ClinicalData> result = clinicalEventService.getSurvivalData(studyIds, | ||
patientIds, | ||
interceptedSurvivalRequest.getAttributeIdPrefix(), | ||
interceptedSurvivalRequest); | ||
|
||
return new ResponseEntity<>(result, HttpStatus.OK); | ||
return clinicalEventService.getSurvivalData(studyIds, | ||
patientIds, | ||
interceptedSurvivalRequest.getAttributeIdPrefix(), | ||
interceptedSurvivalRequest); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this line causing the issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes