Burni docs
Code API DocumentationModelsCode API Documentation

searchParameterQueryHandler

This file is in models/FHIR/.

Functions

getStringQuery(query, paramsSearchFields, queryFieldName)
getAddressQuery(query, queryFieldName)
getNameQuery(query, queryFieldName)
getTokenQuery(query, paramsSearchFields, queryFieldName)
getPolyTokenQuery(query, paramsSearchFields, queryFieldName, paramsSearchFunc)
getNumberQuery(query, paramsSearchFields, queryFieldName)
getPolyDateQuery(query, paramsSearchFields, queryFieldName, paramsSearchFunc)

getStringQuery(query, paramsSearchFields, queryFieldName)

Kind: global function

ParamTypeDescription
querystringThe request query object
paramsSearchFieldsArray.<string>The fields of search parameter that in resource
queryFieldNamestringThe name of search parameter

Example (Example of `address-city` of search parameter of the Patient resource)

// refresh query object to 
// {
//    "$and": [
//       {
//           "$or": [
//               {
//                   "address.city": {
//                       "$regex": /^PleasantVille/gi
//                   }
//               }
//          ]
//      }
//   ]
// }
getStringQuery(
{
   "address-city": "PleasantVille",
   "gender": "male",
   "$and": []
}, ["address.city"], "address-city");

getAddressQuery(query, queryFieldName)

Kind: global function

ParamTypeDescription
querystringThe request query object
queryFieldNamestringThe name of search parameter

Example (Example of `address` of search parameter of the Patient resource)

// refresh query object to 
// {
//     "$and": [
//         {
//             "$or": [
//                 {
//                     "address.line": {
//                         "$regex": /^PleasantVille/gi
//                     }
//                 },
//                 {
//                     "address.city": {
//                         "$regex": /^PleasantVille/gi
//                     }
//                 },
//                 {
//                     "address.district": {
//                         "$regex": /^PleasantVille/gi
//                     }
//                 },
//                 {
//                     "address.state": {
//                         "$regex": /^PleasantVille/gi
//                     }
//                 },
//                 {
//                     "address.postalCode": {
//                         "$regex": /^PleasantVille/gi
//                     }
//                 },
//                 {
//                     "address.country": {
//                         "$regex": /^PleasantVille/gi
//                     }
//                 }
//             ]
//         }
//     ]
// }
getAddressQuery(
{
   "address": "PleasantVille",
   "gender": "male",
   "$and": []
}, "address");

getNameQuery(query, queryFieldName)

Kind: global function

ParamTypeDescription
querystringThe request query object
queryFieldNamestringThe name of search parameter

Example (Example of `name` of search parameter of the Patient resource)

// refresh query object to 
// {
//     "$and": [
//         {
//             "$or": [
//                 {
//                     "$or": [
//                         {
//                             "name.text": {
//                                 "$regex": /^Chalmers/gi
//                             }
//                         },
//                         {
//                             "name.family": {
//                                 "$regex": /^Chalmers/gi
//                             }
//                         },
//                         {
//                             "name.given": {
//                                 "$regex": /^Chalmers/gi
//                             }
//                         },
//                         {
//                             "name.suffix": {
//                                 "$regex": /^Chalmers/gi
//                             }
//                         },
//                         {
//                             "name.prefix": {
//                                 "$regex": /^Chalmers/gi
//                             }
//                         }
//                     ]
//                 }
//             ]
//         }
//     ]
// }

Example

getNameQuery(
{
    "name": "Chalmers"
}, ["name"], "name");

getTokenQuery(query, paramsSearchFields, queryFieldName)

Kind: global function

ParamTypeDescription
querystringThe request query object that in resource
paramsSearchFieldsArray.<string>The fields of search parameter that in resource
queryFieldNamestringThe name of search parameter

getPolyTokenQuery(query, paramsSearchFields, queryFieldName, paramsSearchFunc)

Kind: global function

ParamTypeDescription
queryObjectThe request query object
paramsSearchFieldsArray.<string>The fields of search parameters that in resource
queryFieldNamestringThe name of search parameter
paramsSearchFuncfunctionparameter search function corresponds to data type e.g. code, codeable concept

Example (Example of `address-use` of search parameter of the Patient resource)

// refresh query object to 
// {
//     "$and": [
//         {
//             "$or": [
//                 {
//                     "$or": [
//                         {
//                             "address.use.system": "home" //because some data types have system 
//                         },
//                         {
//                             "address.use": "home"
//                         }
//                     ]
//                 }
//             ]
//         }
//     ]
// }
getPolyTokenQuery(
{
    "address-use": "home"
}, ["address.use"], "address-use", (query)=> {
    try {
          queryHandler.getStringQuery(query, paramsSearchFields, *"address-city");
      } catch (e) {
          console.error(e);
          throw e;
      }
});

getNumberQuery(query, paramsSearchFields, queryFieldName)

Kind: global function

ParamTypeDescription
querystringThe request query object
paramsSearchFieldsArray.<string>The fields of search parameters that in resource
queryFieldNamestringThe name of search parameter

Example (Example of `variant-start` of search parameter of the Molecularsequence resource)

// refresh query object to 
// {
//     "$and": [
//         {
//             "$or": [
//                 {
//                     "variant.start": {
//                         "$eq": 22125503
//                     }
//                 }
//             ]
//         }
//     ]
// }
getNumberQuery(
{
    "$and": [], 
    "variant-start" : 22125503
}, ["variant.start"], "variant-start");

getPolyDateQuery(query, paramsSearchFields, queryFieldName, paramsSearchFunc)

Kind: global function

ParamTypeDescription
queryObjectThe request query object
paramsSearchFieldsstringThe fields of search parameters that in resource
queryFieldNamestringThe name of search parameter
paramsSearchFuncfunctionparameter search function corresponds to data type e.g. date, dateTime

On this page