UNPKG

@metabohub/forum-library

Version:

<!-- Put your badges here: --> [![pipeline status](https://forge.inrae.fr/metabohub/forvm/mth-forvm-lib/badges/dev/pipeline.svg)](https://forge.inrae.fr/metabohub/forvm/mth-forvm-lib/-/commits/dev) [![coverage report](https://forge.inrae.fr/metabohub/forv

295 lines (216 loc) 11 kB
# MetaboHUB - Forum Library <!-- Put your badges here: --> [![pipeline status](https://forge.inrae.fr/metabohub/forvm/mth-forvm-lib/badges/dev/pipeline.svg)](https://forge.inrae.fr/metabohub/forvm/mth-forvm-lib/-/commits/dev) [![coverage report](https://forge.inrae.fr/metabohub/forvm/mth-forvm-lib/badges/dev/coverage.svg)](https://forge.inrae.fr/metabohub/forvm/mth-forvm-lib/-/commits/dev) [![Latest Release](https://forge.inrae.fr/metabohub/forvm/mth-forvm-lib/-/badges/release.svg)](https://forge.inrae.fr/metabohub/forvm/mth-forvm-lib/-/releases) <!-- please choose a license badge; full list: https://gist.github.com/lukas-h/2a5d00690736b4c3a7ba --> <!-- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) --> <!-- [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) --> <!-- [![License: CC BY 4.0](https://licensebuttons.net/l/by/4.0/80x15.png)](https://creativecommons.org/licenses/by/4.0/) --> [![License](https://img.shields.io/badge/License-CeCILL_2.1-blue.svg)](https://opensource.org/license/cecill-2-1) <!-- If your software has been certified by MetaboHUB, put the following badge here : --> [![MetaboHUB Logo](https://forge.inrae.fr/pfem/gitlab-tools/-/raw/init/projects-templates/logos/metabohub_logo-20x20.png)![MetaboHUB title](https://img.shields.io/badge/MetaboHub-Software-0066cc?style=flat-square)](https://www.metabohub.fr) ## Metadata - authors: <nils.paulhe@inrae.fr>, <olivier.filangi@inrae.fr> - creation date: `2023-01-20` - main usage: Vue.js webcomponent use for [Forum Web-Applications](https://forum-webapp.semantic-metabolomics.fr/). ## Description <!-- NOTE: this section is required --> FORUM is an open knowledge network aiming at supporting metabolomics results interpretation in biomedical sciences and automated reasoning. Containing more than 8 billion statements, it federate data from several life-science resources such as PubMed, ChEBI and PubChem. Leveraging the bridges in this linked dataset, we automatically extract associations between compound and biomedical concepts, using literature metadata enrichment. ## Features <!-- NOTE: this section is required --> - :pencil: build Forvm queries: provides a web-GUI to create your requests - :rocket: send these queries to the Forvm API: submit your requests to the API and fetch results - :eyes: show / browse Forvm results: display your results in a nice web-GUI - :floppy_disk: download Forvm results: download your results in a CSV file ## Getting Started This WebComponent library is compatible with projects using [Vue.js 3](https://vuejs.org/) and [TypeScript](https://www.typescriptlang.org/). This project is based on [Vue.js](https://vuejs.org/), [Vite](https://vitejs.dev/guide/) and [Vuetify](https://vuetifyjs.com/en/) frameworks. ### Prerequisites <!-- NOTE: this section is required; list what things you need to install the software and how to install them --> Before you begin, ensure you have met the following requirements: - **Programming Language**: [NodeJS](https://nodejs.org/en) version 20.19+ and npm version 11.7 or higher - **Frameworks**: [Vue.js](https://vuejs.org/) version 3.4+, [Vuetify.js](https://vuetifyjs.com/en/) version 3.5+ ### Installing <!-- NOTE: this section is required --> Note: this section is for developers who want to implement and use this library into their own project(s). To add the library to your [Node.js](https://nodejs.org/) project, please enter the following commands: `npm i @metabohub/forum-library` Then you must import the library in your `src/main.ts` file: ```js // import the library and its styles import { MetabohubForumLibrary } from '@metabohub/forum-library'; import '@metabohub/forum-library/dist/src/components/main.css'; const app = createApp(App); registerPlugins(app); // <= import your plugin like vuetify, ... app.use(MetabohubForumLibrary); // <= add this line! app.mount('#app'); ``` Finally you can add our WebComponent in you own Vue components: ```html <!-- Template --> <template> <div class="find-associations"> <mth-forum-form-finder @search-query="onSearchQuery" /> <mth-forum-results-display :search-results="dataSearchResults" /> </div> </template> <!-- Code --> <script lang="ts"> // from Vue core import { ref } from "vue"; // forum - core services and mappers import { // ChebiApi, ChemontApi, PubchemApi,// EndpointSearchQuery, EndpointSearchResults// } from "@metabohub/forum-library"; // main export default { name: "Demo", components: {}, setup() { return { dataSearchResults: ref(new EndpointSearchResults(new ChebiApi(), new ChemontApi(), new PubchemApi())) }; }, methods: { onSearchQuery(data: EndpointSearchQuery): void { // Create new query results this.dataSearchResults = new EndpointSearchResults(new ChebiApi(), new ChemontApi(), new PubchemApi()); // Apply the query emitted this.dataSearchResults.searchQuery = data; }, }, }; </script> <!-- Style --> <style lang="scss"> form { fieldset { padding: 5px; legend { padding: 5px; margin-left: 20px; } } } </style> ``` ### Running the tests <!-- NOTE: this section is required --> Upcoming. <!-- Explain how to run the automated tests for this system. ``` Give an example ``` Explain what these tests test and why. ``` Give an example ``` --> ## Deployment <!-- NOTE: this section is optional --> ### Edit Forum endpoint connection If you edit `src/assets/doc_forum-openapi.json` file, you must re-generate the endpoint client code thanks `npm run openapi-generator` code. ### Library build and publish Build and publish the library ```bash # install node modules listed into 'package.json' / 'package-lock.json' files npm install # build the library npm run build:lib npm pack # publish the library npm publish ``` Notes: - the publication registry is set into these files: - [.npmrc](.npmrc). - [package.json](package.json) - key "publishConfig". - the publication is automatic during CI/CD process; see [.gitlab-ci.yml](.gitlab-ci.yml) file. - during the GitLab CI/CD pipeline, the previous package with the same version identifier is removed thanks: - `curl` commands - to get all published packages in targeted GitLab packages registry and remove a specific one\ (it require a GitLab API token with correct authorizations) You can use non-stable version of the library using the GitLab npm package registry: ```bash # if you already have installed the library, you must remove the previous one: npm remove @metabohub/forum-library # config GitLab npm registry npm config set -- //forge.inrae.fr/api/v4/projects/11325/packages/npm/:_authToken=__YOUR_GITLAB_TOKEN_HERE__ npm config set @metabohub:registry https://forge.inrae.fr/api/v4/projects/11325/packages/npm/ # to install the library in your current Node.js project: npm i --save \ --registry=https://forge.inrae.fr/api/v4/projects/11325/packages/npm/ \ @metabohub/forum-library; ``` ### Standalone showcase build Build the standalone version with these commands ```bash # install node modules listed into 'package.json' / 'package-lock.json' files npm install # either build the DEV standalone version npm run build:dev # or build the PROD standalone version npm run build:prod ``` Please refer to [.env](.env), [.env.development](.env.development) and [.env.production](.env.production) files to see changes between PROD and DEV versions. Note: you can run the standalone version into "dev mode" thanks `npm run dev` command. ## Contributing <!-- NOTE: this section is optional --> We welcome contributions! Please follow these steps: <!-- ### How to Contribute Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us. --> ### Development Guidelines Please read [Development Guidelines](https://gist.github.com/PurpleBooth/b24679402957c63ec426) for details on our code of conduct, and the process for submitting pull requests to us. ### Code Style - Use [Visual Studio Code](https://code.visualstudio.com/) IDE - Use [ESLint](https://eslint.org/) for JavaScript - Use [Prettier](https://prettier.io/) for code formatting - Run `npm run lint` before committing ## Changelog <!-- NOTE: this section is optional --> All notable changes to this project will be documented in [CHANGELOG.md](CHANGELOG.md). For the versions available, see the [tags on this repository](https://todo-link-to/your/project/tags). ## Authors <!-- NOTE: list all authors, maintainers, relevant contributors, ... with their MAIN ROLES and MAIN AFFILIATIONS. --> - **Nils Paulhe** - *Initial work* - MetaboHUB, INRAE, PFEM. - **William Garrier, Paul-Emeric Saunier** - *Design and implement initial GUI and TS code* - UCA. - **Olivier Filangi** - *Discovery* - MetaboHUB, INRAE, P2M2. - **Franck Giacomoni** - *project management* - MetaboHUB, INRAE, PFEM. <!-- optional: add all contributors in a specific markdown file --> <!-- See also the list of [contributors](CONTRIBUTORS.md) who participated in this project. --> See also the list of [contributors](https://forge.inrae.fr/metabohub/forvm/mth-forvm-lib/-/graphs/dev) who participated in this project. ## License <!-- NOTE: this section is required; we recommend Cecill License --> **MetaboHUB - Forvm Library** is distributed under the CeCILL-2.1 (compatible GNU-GPL) license. <!-- Please choose one of the following license: - open license CeCILL-2.1 (compatible GNU-GPL) - MIT License - Creative Commons Attribution-ShareAlike 4.0 International license (CC-BY-SA 4.0) --> Please refer to [LICENSE.txt](LICENSE.txt) file for further details. <!-- ## Support &amp; External resources --> <!-- NOTE: this section is facultative; customize / remove useless / add relevant / ... items in the list below --> <!-- - :page_facing_up: **CheatSheet** - [MTH CheatSheet](https://todo-link-to-this-resource) - :scroll: **Wiki** - [Wiki for Users](https://todo-link-to-this-resource) - [Wiki for Developers](https://todo-link-to-this-resource) - :question: **Frequently Asked Questions** - [FAQ](https://todo-link-to-this-resource) - :book: **Documentation** - [Full documentation](https://docs.projectname.com) - :bug: **Bug Reports** - [GitHub Issues](https://github.com/username/project-name/issues) - :speech_balloon: **Discussions** - [GitHub Discussions](https://github.com/username/project-name/discussions) - :email: **Email** - <support@projectname.com> --> ## Acknowledgments <!-- NOTE: this section is required --> - [MetaboHUB](https://www.metabohub.fr/) - [INRAE](https://www.inrae.fr/) ## Additional Resources <!-- NOTE: this section is optional --> - [FORVM WebApp](https://forum-webapp.semantic-metabolomics.fr/) - [API Documentation](https://unh-pfem-services.ara.inrae.fr/forum-api/doc/index_forum.html) ---