2020-05-20 21:07:25 -04:00
|
|
|
async function getStudiesForPatientByStudyInstanceUID(
|
|
|
|
|
dataSource,
|
|
|
|
|
StudyInstanceUID
|
|
|
|
|
) {
|
2020-05-21 16:24:35 -04:00
|
|
|
// TODO: The `DicomMetadataStore` should short-circuit both of these requests
|
2020-05-20 21:07:25 -04:00
|
|
|
// Data _could_ be here from route query, or if using JSON data source
|
|
|
|
|
// We could also force this to "await" these values being available in the DICOMStore?
|
|
|
|
|
// Kind of like promise fulfillment in cornerstone-wado-image-loader when there are multiple
|
|
|
|
|
// outgoing requests for the same data
|
|
|
|
|
const getStudyResult = await dataSource.query.studies.search({
|
|
|
|
|
studyInstanceUid: StudyInstanceUID,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// TODO: To Erik's point, the data source likely shouldn't deviate from
|
|
|
|
|
// Naturalized DICOM JSON when returning. It makes things like this awkward (mrn)
|
|
|
|
|
if (getStudyResult && getStudyResult.length && getStudyResult[0].mrn) {
|
|
|
|
|
return dataSource.query.studies.search({
|
|
|
|
|
patientId: getStudyResult[0].mrn,
|
|
|
|
|
});
|
|
|
|
|
}
|
2020-05-21 16:24:35 -04:00
|
|
|
}
|
2020-05-20 21:07:25 -04:00
|
|
|
|
|
|
|
|
export default getStudiesForPatientByStudyInstanceUID;
|