frontend/src/modules/common/catalogues.js
/**
 * @class The symptoms catalogue can be used to lookup symptoms by their names, synonyms or tags
 * @constructor
 * @param {object} data - The raw symptoms catalogue data as parsed from its json representation
 *
 */
@class The symptoms catalogue can be used to lookup symptoms by their names, synonyms or tags
@constructor
@param {object} data - The raw symptoms catalogue data as parsed from its json representation
@class The symptoms catalogue can be used to lookup symptoms by their names synonyms or tags @constructor @param { object } data - The raw symptoms catalogue data as parsed from its json representation
function Symptoms ( data ) {
  var _tags = db( data.tags );
  var _symptoms = db( data.entries );
  var self = this;
  this.find = function ( criteria ) {
    var matching = _tags( criteria ); 
    var joined = matching.join( _symptoms, function ( left, right ) {
      return left.symptoms.indexOf( right.sid ) != -1;
    } );
    var result = joined.map( function ( record, recordnumber ) {
      return {sid : record.sid, cName : record.cName};
    } );
    return result;
  };
  return {
    find : self.find
  };
}
function Symptoms ( data ) { var _tags = db ( data . tags ) ; var _symptoms = db ( data . entries ) ; var self = this ; this . find = function ( criteria ) { var matching = _tags ( criteria ) ; var joined = matching . join ( _symptoms , function ( left , right ) { return left . symptoms . indexOf ( right . sid ) != - 1 ; } ) ; var result = joined . map ( function ( record , recordnumber ) { return { sid : record . sid , cName : record . cName } ; } ) ; return result ; } ; return { find : self . find } ; }
@class The symptoms catalogue can be used to lookup symptoms by their names, synonyms or tags
 @constructor
 @param {object} data - The raw symptoms catalogue data as parsed from its json representation
@class The symptoms catalogue can be used to lookup symptoms by their names synonyms or tags @constructor @param { object } data - The raw symptoms catalogue data as parsed from its json representation
/**
   * Find a set of symptoms by a given search criteria.
   *
   * @example <caption>Find matching exact value</caption>
   * // returns 2
   *
   * @param criteria
   * @returns {*}
   */ // filter tags by given criteria //var result = joined.select("sid", "cName"); // this is the publicly exposed object