{"id":22266285,"url":"https://github.com/vsm/vsm-dictionary-combiner","last_synced_at":"2025-10-24T10:33:04.418Z","repository":{"id":39447275,"uuid":"199328361","full_name":"vsm/vsm-dictionary-combiner","owner":"vsm","description":" A package that combines the results from multiple VSM-dictionaries, reporting them back through a single channel","archived":false,"fork":false,"pushed_at":"2023-01-06T02:04:01.000Z","size":1971,"stargazers_count":3,"open_issues_count":20,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-15T23:39:04.683Z","etag":null,"topics":["combiner","dictionary","terms","vsm"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vsm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-28T19:25:04.000Z","updated_at":"2024-06-14T07:42:02.000Z","dependencies_parsed_at":"2023-02-05T02:30:35.757Z","dependency_job_id":null,"html_url":"https://github.com/vsm/vsm-dictionary-combiner","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsm%2Fvsm-dictionary-combiner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsm%2Fvsm-dictionary-combiner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsm%2Fvsm-dictionary-combiner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsm%2Fvsm-dictionary-combiner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vsm","download_url":"https://codeload.github.com/vsm/vsm-dictionary-combiner/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227895751,"owners_count":17836464,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["combiner","dictionary","terms","vsm"],"created_at":"2024-12-03T10:18:13.982Z","updated_at":"2025-10-24T10:32:59.400Z","avatar_url":"https://github.com/vsm.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vsm-dictionary-combiner\n\n\u003c!-- badges: start --\u003e\n[![Node.js CI](https://github.com/vsm/vsm-dictionary-combiner/workflows/Node.js%20CI/badge.svg)](https://github.com/vsm/vsm-dictionary-combiner/actions)\n[![npm version](https://img.shields.io/npm/v/vsm-dictionary-combiner)](https://www.npmjs.com/package/vsm-dictionary-combiner)\n[![Downloads](https://img.shields.io/npm/dm/vsm-dictionary-combiner)](https://www.npmjs.com/package/vsm-dictionary-combiner)\n[![License](https://img.shields.io/npm/l/vsm-dictionary-combiner)](#license)\n\u003c!-- badges: end --\u003e\n\n## Summary\n\n`vsm-dictionary-combiner` is an implementation \nof the 'VsmDictionary' parent-class/interface (from the package\n[`vsm-dictionary`](https://github.com/vsm/vsm-dictionary)). It differs \nthough from other vsm-dictionaries in the sense that it does not communicate\nwith any external data source directly, but gets results from other `vsm-dictionary-xyz` \npackages and combines them.\n\n## Install\n\nRun: `npm install`\n\n## Example use\n\nTo see an example of how to use this package to get results from 3 \nvsm-dictionaries (namely [vsm-dictionary-uniprot](https://github.com/UniBioDicts/vsm-dictionary-uniprot), \n[vsm-dictionary-ensembl](https://github.com/UniBioDicts/vsm-dictionary-ensembl) and \n[vsm-dictionary-bioportal](https://github.com/UniBioDicts/vsm-dictionary-bioportal)), \ngo to the `test` directory and run:\n```\nnode getDictInfos.test.js\nnode getEntries.test.js\nnode getEntryMatchesForString.test.js\n```\n\n## 'Build' configuration\n\nTo use a VsmDictionary in Node.js, one can simply run `npm install` and then use `require()`.\nBut it is also convenient to have a version of the code that can just be loaded via a `\u003cscript\u003e`-tag in the browser.\n\nTherefore, we included [webpack.config.js](https://github.com/vsm/vsm-dictionary-combiner/blob/master/webpack.config.js), which is a Webpack configuration file for generating such a browser-ready package.\n\nBy running `npm build`, the built file will appear in a 'dist' subfolder.\nYou can use it by including: `\u003cscript src=\"../dist/vsm-dictionary-combiner.min.js\"\u003e\u003c/script\u003e` in the header of an HTML file.\n\nNote that you should **always include** all other vsm-dictionaries that the combiner package will use either by using `require()` (in Node.js) or by including the specific script source for each package in the HTML header.\nSee the [example HTML file](https://github.com/vsm/vsm-dictionary-combiner/blob/master/test/combiner%2Bvsm-box.test.html) in the `test` directory for a demo of the `vsm-dictionary-combiner` integrated in a [vsm-box](https://github.com/vsm/vsm-box) and how to include the minified distribution built files for each respective vsm-dictionary.\n\n## Specification\n\nSince the `vsm-dictionary-combiner` follows the parent's class \n[specification](https://github.com/vsm/vsm-dictionary/blob/master/Dictionary.spec.md),\nit supports the merging of results for the 4 functions:\n- `getDictInfos`\n- `getEntries`\n- `getEntryMatchesForString`\n- `getRefTerms`\n\nFor each of the above functions, the combiner module concatenates the results \nfrom the subsequent vsm-dictionaries calls, **in the order the dictionaries \nwere given to the constructor**. This means that the `options.perPage` and \n`options.page` for example will be sent unchanged to each dictionary and no \ncutoff whatsoever will be applied to the merged result array object.\n\n- A **key configuration option** is the `dictionaries` property - an array \nof VsmDictionary classes that the combiner package will use (other objects\nare ignored):\n\n```javascript\nconst DictionaryCombiner          = require('vsm-dictionary-combiner');\nconst VsmDictionaryUniProt        = require('vsm-dictionary-uniprot');\nconst VsmDictionaryEnsembl        = require('vsm-dictionary-ensembl');\nconst VsmDictionaryEnsemblGenomes = require('vsm-dictionary-ensembl-genomes');\n\nconst dictCombiner = new DictionaryCombiner({\n  dictionaries: [\n    new VsmDictionaryUniProt(),\n    new VsmDictionaryEnsembl(),\n    new VsmDictionaryEnsemblGenomes()\n  ]\n});\n```\n\n- Regarding *error handling*, we use the option: `errorIfAllErrors`. The default\nvalue is *true* (or absent) which means that only if **all** of the subsequent \nvsm-dictionaries return an error, only then the combiner class returns a global \nerror object by concatenating the subsequent error objects in an array `arr` and \nsending back the object: `{errors: arr}`. So, in that case even if some of the \nunderlying vsm-dictionaries have errors, we still return the results from the \nother dictionaries (*flexible* error handling). If `errorIfAllErrors` is *false*, \nthen we return the first error (object) that occurs (*strict* error handling).\n\n## License\n\nThis project is licensed under the AGPL license - see [LICENSE.md](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvsm%2Fvsm-dictionary-combiner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvsm%2Fvsm-dictionary-combiner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvsm%2Fvsm-dictionary-combiner/lists"}