Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #13

Merged
merged 77 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
6b1b233
feat: create 'spectra-parser' post API
hamed-musallam Oct 18, 2022
619e8f5
test: parse spectra from urls
hamed-musallam Oct 18, 2022
41c8b91
chore: remove 'headless' playwright option
hamed-musallam Oct 18, 2022
929916b
chore: update package.json
hamed-musallam Oct 18, 2022
93c76bd
chore: use the correct url based on the NODE_ENV
hamed-musallam Oct 18, 2022
21365e4
fix: update container name
NishaSharma14 Oct 18, 2022
e510e64
chore: basic health check on the default route
hamed-musallam Oct 19, 2022
77931cf
chore: Add Build file.
NishaSharma14 Oct 19, 2022
acb0e3c
fix: build job name
NishaSharma14 Oct 19, 2022
607d5f8
fix: create .env file in build
NishaSharma14 Oct 19, 2022
9d2d821
fix: Update build .env creation on basis of env
NishaSharma14 Oct 19, 2022
b828346
fix: Undo .env creation on basis of env
NishaSharma14 Oct 19, 2022
1c14134
fix: job name
NishaSharma14 Oct 19, 2022
1d56fcd
fix: job name
NishaSharma14 Oct 19, 2022
4aca9fe
chore: use webkit
hamed-musallam Oct 19, 2022
4b9c03d
Revert "chore: use webkit"
hamed-musallam Oct 20, 2022
b27561b
fix: Install playwright package in docker.
NishaSharma14 Oct 20, 2022
b38e0a0
Merge branch 'development' of https://github.com/NFDI4Chem/nmrxiv-nod…
NishaSharma14 Oct 20, 2022
a9a3663
fix: Install playwright as sudo.
NishaSharma14 Oct 20, 2022
9b18517
chore: track playwright
hamed-musallam Oct 20, 2022
5f32bd6
chore: fix playwright install options
hamed-musallam Oct 20, 2022
855c0ee
fix: Install Playwright using docker
NishaSharma14 Oct 20, 2022
e8bd6f7
chore: use webkit browser
hamed-musallam Oct 20, 2022
10d6e4a
chore: update build workflow
hamed-musallam Oct 20, 2022
802e313
Revert "fix: Install Playwright using docker"
hamed-musallam Oct 20, 2022
8e4afb7
chore: install playwright and it's dependencies
hamed-musallam Oct 20, 2022
d8ba2f3
chore: docker install playwright dependencies
hamed-musallam Oct 20, 2022
4a60884
test: docker with playwright options
hamed-musallam Oct 20, 2022
c134de0
chore: remove playwright test from docker file
hamed-musallam Nov 10, 2022
1aca809
feat: update spectra parser
hamed-musallam Nov 10, 2022
f0f91c0
test: fix API test
hamed-musallam Nov 10, 2022
f20e386
feat: return nmrium data version
hamed-musallam Nov 10, 2022
e0f1132
chore: update dependencies
hamed-musallam Nov 10, 2022
61fe14c
chore: update nmr-load-save to version 0.4.8-pre.1668094222
hamed-musallam Nov 10, 2022
1fdeb2d
doc: spectra process API
hamed-musallam Nov 11, 2022
08fbe0c
doc: add details of the API mechanism
hamed-musallam Nov 11, 2022
89a3095
refactor: reshape the responses of spectra parcer API
hamed-musallam Nov 11, 2022
9747016
Merge branch 'development' of https://github.com/NFDI4Chem/nmrxiv-nod…
hamed-musallam Nov 11, 2022
99b4270
refactor: run playwright in headless mode and disable snapshot
hamed-musallam Nov 11, 2022
f704beb
doc: Data conversion warning
hamed-musallam Nov 14, 2022
9335d61
doc: migration notes
hamed-musallam Nov 16, 2022
92d8869
Update README.md
hamed-musallam Nov 16, 2022
32af700
feat: enabled CORS requests
CS76 Nov 21, 2022
02b32fc
chore: update dependencies
hamed-musallam Jan 23, 2023
dd4c63c
feat: update to nmr-load-save version 0.7.14
hamed-musallam Jan 23, 2023
ea9bb44
Merge branch 'development' of https://github.com/NFDI4Chem/nmrxiv-nod…
hamed-musallam Jan 23, 2023
6f110d7
chore: update dependencies
hamed-musallam Feb 3, 2023
65010cf
chore: update playwright
hamed-musallam Feb 3, 2023
56a7b3d
chore: update dependencies
hamed-musallam Feb 24, 2023
feb0530
feat: update nmr-load-save to version 0.7.26
hamed-musallam Feb 24, 2023
fe2899c
chore: update nmr-load-save to version 0.7.27
hamed-musallam Feb 27, 2023
970217e
chore: update dependencies
hamed-musallam Feb 27, 2023
6e4c3d9
test: fix parse spectra test
hamed-musallam Feb 27, 2023
5a07028
doc: integrate with swagger
hamed-musallam Mar 22, 2023
4a7e6f1
doc: add `source` object
hamed-musallam Feb 27, 2023
fe67a7e
feat: upgrade nmr-load-save to version 0.8.5
hamed-musallam Mar 27, 2023
694261f
Merge pull request #7 from NFDI4Chem/upgrade-nmr-load-save-nmrium-ver…
hamed-musallam Mar 27, 2023
42ef598
fix: add release-please workflow
NishaSharma14 Mar 28, 2023
803db4e
feat: updated docker file to add docs and public folders to the build…
CS76 Mar 28, 2023
874ef13
doc: change the default spectra-parser API paramters
hamed-musallam Mar 28, 2023
d79380e
Merge pull request #12 from NFDI4Chem/doc-change-default-params
hamed-musallam Mar 28, 2023
6faf002
Merge pull request #11 from NFDI4Chem/release-please
NishaSharma14 Apr 13, 2023
c090e1c
chore: update dependencies
hamed-musallam May 5, 2023
eedc62f
Merge branch 'development' of https://github.com/NFDI4Chem/nmrxiv-nod…
hamed-musallam May 5, 2023
10068d2
feat: upgrade nmr-load-save to version 0.11.0
hamed-musallam May 5, 2023
e8b041c
chore: update dependencies
hamed-musallam Jul 7, 2023
c3542d8
chore: update nmr-load-save to version 0.13.2
hamed-musallam Jul 7, 2023
5bfcbed
chore: update dependencies
hamed-musallam Jul 28, 2023
f97fd32
feat: update nmr-load-save to version 0.15.1
hamed-musallam Jul 28, 2023
8378b30
Merge branch 'main' of https://github.com/NFDI4Chem/nmrxiv-nodejs-mic…
NishaSharma14 Aug 9, 2023
fdf02ba
chore: update dependencies
hamed-musallam Oct 24, 2023
5c1999d
feat: update nmr-load-save to version 0.22.4
hamed-musallam Oct 24, 2023
662166a
refactor: omit 'data' and 'originalData' from the spectra object list
hamed-musallam Oct 24, 2023
800037c
Revert "chore: update dependencies"
hamed-musallam Oct 24, 2023
caadedc
chore: update package.json and package-lock.json
hamed-musallam Oct 24, 2023
5854182
chore: update workflow node version
hamed-musallam Oct 24, 2023
85004c2
fix: build and push docker image to Docker Hub
NishaSharma14 Oct 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions .adonisrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"commands": [
"./commands",
"@adonisjs/core/build/commands/index.js",
"@adonisjs/repl/build/commands"
"@adonisjs/repl/build/commands",
"adonis5-swagger/build/commands"
],
"exceptionHandlerNamespace": "App/Exceptions/Handler",
"aliases": {
Expand All @@ -12,17 +13,30 @@
"Database": "database",
"Contracts": "contracts"
},
"preloads": ["./start/routes", "./start/kernel"],
"providers": ["./providers/AppProvider", "@adonisjs/core"],
"aceProviders": ["@adonisjs/repl"],
"preloads": [
"./start/routes",
"./start/kernel"
],
"providers": [
"./providers/AppProvider",
"@adonisjs/core",
"adonis5-swagger"
],
"aceProviders": [
"@adonisjs/repl"
],
"tests": {
"suites": [
{
"name": "functional",
"files": ["tests/functional/**/*.spec(.ts|.js)"],
"files": [
"tests/functional/**/*.spec(.ts|.js)"
],
"timeout": 60000
}
]
},
"testProviders": ["@japa/preset-adonis/TestsProvider"]
}
"testProviders": [
"@japa/preset-adonis/TestsProvider"
]
}
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PORT=3333
HOST=0.0.0.0
NODE_ENV=development
NODE_ENV=production
APP_KEY=NZu-mbqukZjV_65cT3ckDB21exh17-ws
DRIVE_DISK=local
DRIVE_DISK=local
86 changes: 86 additions & 0 deletions .github/workflows/dev-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@

# This worklflow will perform following actions when the code is pushed to development branch:
# - Run test using Playwright
# - Build the latest docker image in development which needs test to pass first.
# - Push the latest docker image to Google Artifact Registry-Dev.
# - Rollout the latest image in GKE.
#
# Maintainers:
# - name: Nisha Sharma
# - email: [email protected]

name: Build and Deploy to Dev

on:
push:
branches: [development]

env:
PROJECT_ID: ${{ secrets.GKE_PROJECT }}
GKE_CLUSTER_DEV: nmrxiv-dev
GKE_ZONE: europe-west3-a
DEPLOYMENT_NAME: nodejs-nmrxiv-nodejs-microservice
DOCKER_HUB_USERNAME : ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_PASSWORD : ${{ secrets.DOCKER_HUB_PASSWORD }}
REPOSITORY_NAME: nodejs-microservice
REPOSITORY_NAMESPACE: nfdi4chem

jobs:
e2etest:
uses: NFDI4Chem/nmrxiv-nodejs-microservice/.github/workflows/e2e.yml@development

setup-build-publish-deploy-dev:
name: Deploy to dev
if: github.ref == 'refs/heads/development'
runs-on: ubuntu-latest
needs: e2etest
steps:
- name: Checkout
uses: actions/checkout@v2

# Setup gcloud CLI
- name: Setup CLI
uses: google-github-actions/setup-gcloud@94337306dda8180d967a56932ceb4ddcf01edae7
with:
service_account_key: ${{ secrets.GKE_SA_KEY }}
project_id: ${{ secrets.GKE_PROJECT }}

# Configure docker to use the gcloud command-line tool as a credential helper
- name: Configure docker
run: |-
gcloud auth configure-docker europe-west3-docker.pkg.dev

# Get the GKE credentials
- name: Get GKE credentials
uses: google-github-actions/[email protected]
with:
cluster_name: ${{ env.GKE_CLUSTER_DEV }}
location: ${{ env.GKE_ZONE }}
credentials: ${{ secrets.GKE_SA_KEY }}

# Login to Docker Hub
- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ env.DOCKER_HUB_USERNAME }}
password: ${{ env.DOCKER_HUB_PASSWORD }}

# Build and push image to Docker Hub
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
build-args: |
RELEASE_VERSION=dev-latest
tags: ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:dev-latest
username: ${{ env.DOCKER_HUB_USERNAME }}
password: ${{ env.DOCKER_HUB_PASSWORD }}

# Deploy the latest Docker image to the GKE cluster
- name: Deploy
run: |-
kubectl rollout restart deployment/$DEPLOYMENT_NAME
kubectl rollout status deployment/$DEPLOYMENT_NAME --timeout=300s
kubectl get services -o wide
29 changes: 29 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: e2e tests

on:
workflow_call:

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: 'Create .env file'
run: |
touch .env
cp .env.example .env
- run: npm ci
- run: npm run build --if-present
- name: Install Playwright
run: npx playwright install --with-deps
- name: Run test
run: npm test
68 changes: 68 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@

# This worklflow will perform following actions when the code is pushed to main branch.
# - Run end to end test
# - Test linting.
# - Trigger release-please action to create release which needs e2etest & lint to pass first.
#
# Maintainers:
# - name: Nisha Sharma
# - email: [email protected]

name: release-please

on:
push:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: 'Create .env file'
run: |
touch .env
cp .env.example .env
- run: npm ci
- run: npm run build --if-present
- name: Install Playwright
run: npx playwright install --with-deps
- name: Run test
run: npm test

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 20.x
- name: Install dependencies
run: npm ci
- name: Run ESLint
run: npm run eslint
- name: Run Prettier
run: npm run prettier
- name: Check types
run: npm run check-types

release-please:
runs-on: ubuntu-latest
needs: ['lint', 'test']
steps:
- uses: google-github-actions/release-please-action@v3
with:
release-type: node
package-name: release-please-action
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@ ENV HOST=0.0.0.0
COPY --chown=node:node ./package*.json ./
RUN npm ci --production
COPY --chown=node:node --from=build /home/node/app/build .
COPY --chown=node:node --from=build /home/node/app/docs ./docs
COPY --chown=node:node --from=build /home/node/app/public ./public
EXPOSE $PORT
CMD [ "dumb-init", "node", "server.js" ]
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
# API Service To Process Spectra from various data formats to NMRium format


The API uses the [nmr-load-save](https://github.com/cheminfo/nmr-load-save) package to process the spectra and [playwright](https://playwright.dev/) to load the NMRium from the deployed wrapper [nmrium-react-wrapper](https://github.com/NFDI4Chem/nmrium-react-wrapper) and import the generated data to get the snapshots.

## Secptra processing

Process and convert various data formats (from various manufacturers, JCAMP standard files, or NMReDATA format, Bruker) to NMRium format


```http
POST /spectra-parser
```

| Parameter | Type |Default| Description |
| :--- | :--- | :--- | :--- |
| `urls` | `string[]` || **Required**. Spectra files URLs |
| `snapshot` | `boolean` |`false`| **Optional**. Enable/dispable Spectra snapshot |

## Responses

```javascript
{
"data": {
"source": object[],
"spectra" : object[],
"molecules" : object[],
"version" : number,
},
"images" : {"id":string,"image":string}[]

}
The `source` attribute contains an array of spectra files relative paths.
The `spectra` attribute contains an array of spectra (1D and 2D).
The `molecules` attribute contains an array of molecules.
The `version` attribute contains the current version of the data which is crucial for data migration in NMRium
The `images` attribute contains a list of the images for the spectra which is processed and displayed by NMRium,
where each object contains two attributes the `id` is the spectrum id and an `image` as a Base64 format.
```

> **⚠ WARNING: Data Conversion.**
> Data should be converted from a **Typed Array** to a **Array**, without this step the NMRium will not be able to load the spectra. ```version``` object is important for NMRium data migration.

## Maintained by
This project is developed and maintained by the [NFDI4Chem partners](https://www.nfdi4chem.de/) at the [Friedrich Schiller University](https://www.uni-jena.de/en/) Jena, Germany.
The code for this web application is released under the [MIT license](https://opensource.org/licenses/MIT).
Expand Down
11 changes: 11 additions & 0 deletions ace-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@
"args": [],
"aliases": [],
"flags": []
},
"swagger:generate": {
"settings": {
"loadApp": true
},
"commandPath": "adonis5-swagger/build/commands/GenerateSwaggerFile",
"commandName": "swagger:generate",
"description": "Generate swagger file",
"args": [],
"aliases": [],
"flags": []
}
},
"aliases": {}
Expand Down
Loading
Loading