OHIF-8: Pass fuzzymatching option from config (#1837)

* Add fuzzmatching property

* Update param

* Add wildcards
This commit is contained in:
Igor Octaviano 2020-07-10 12:59:29 -03:00 committed by GitHub
parent 436df9ed30
commit 8d61e3ae4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 10 deletions

View File

@ -37,7 +37,13 @@ const EXPLICIT_VR_LITTLE_ENDIAN = '1.2.840.10008.1.2.1';
* @param {bool} lazyLoadStudy - "enableStudyLazyLoad"; Request series meta async instead of blocking
*/
function createDicomWebApi(dicomWebConfig) {
const { qidoRoot, wadoRoot, enableStudyLazyLoad } = dicomWebConfig;
const {
qidoRoot,
wadoRoot,
enableStudyLazyLoad,
supportsFuzzyMatching,
supportsWildcard
} = dicomWebConfig;
const qidoConfig = {
url: qidoRoot,
@ -57,9 +63,9 @@ function createDicomWebApi(dicomWebConfig) {
query: {
studies: {
mapParams: mapParams.bind(),
search: async function(origParams) {
search: async function (origParams) {
const { studyInstanceUid, seriesInstanceUid, ...mappedParams } =
mapParams(origParams) || {};
mapParams(origParams, { supportsFuzzyMatching, supportsWildcard }) || {};
const results = await qidoSearch(
qidoDicomWebClient,
@ -74,7 +80,7 @@ function createDicomWebApi(dicomWebConfig) {
},
series: {
// mapParams: mapParams.bind(),
search: async function(studyInstanceUid) {
search: async function (studyInstanceUid) {
const results = await seriesInStudy(
qidoDicomWebClient,
studyInstanceUid

View File

@ -151,7 +151,7 @@ export default function searchStudies(server, filter) {
* @param serverSupportsQIDOIncludeField
* @returns {string} The URL with encoded filter query data
*/
function mapParams(params) {
function mapParams(params, options = {}) {
if (!params) {
return;
}
@ -161,17 +161,22 @@ function mapParams(params) {
// Add more fields here if you want them in the result
].join(',');
const { supportsWildcard } = options;
const withWildcard = value => {
return supportsWildcard && value ? `*${value}*` : value;
};
const parameters = {
// Named
PatientName: params.patientName,
PatientID: params.patientId,
AccessionNumber: params.accessionNumber,
StudyDescription: params.studyDescription,
PatientName: withWildcard(params.patientName),
PatientID: withWildcard(params.patientId),
AccessionNumber: withWildcard(params.accessionNumber),
StudyDescription: withWildcard(params.studyDescription),
ModalitiesInStudy: params.modalitiesInStudy,
// Other
limit: params.limit || 101,
offset: params.offset || 0,
fuzzymatching: params.fuzzymatching === undefined ? false : true,
fuzzymatching: options.supportsFuzzyMatching === true,
includefield: commaSeparatedFields, // serverSupportsQIDOIncludeField ? commaSeparatedFields : 'all',
};

View File

@ -20,6 +20,7 @@ window.config = {
thumbnailRendering: 'wadors',
enableStudyLazyLoad: true,
supportsFuzzyMatching: true,
supportsWildcard: true
},
},
],

View File

@ -20,6 +20,7 @@ window.config = {
thumbnailRendering: 'wadors',
enableStudyLazyLoad: true,
supportsFuzzyMatching: true,
supportsWildcard: true
},
},
],