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

* Add fuzzmatching property

* Update param

* Add wildcards
This commit is contained in:
Igor Octaviano authored and GitHub committed 2020-07-10 11:59:29 -04:00
1 parent 436df9ed30
commit 8d61e3ae4c
4 files changed
+23 -10

No files matched your search

@@ -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',
};