diff --git a/.github/workflows/release-develop.yaml b/.github/workflows/release-develop.yaml new file mode 100644 index 0000000..dc61faa --- /dev/null +++ b/.github/workflows/release-develop.yaml @@ -0,0 +1,35 @@ +name: "Release new Develop Version" +on: + workflow_run: + workflows: ["Verify new Code"] + types: + - completed + push: + branches: + - feature/ci-builds + +jobs: + download-lib: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + repository: "samply/lens-angular" + ref: "feature/eucaim-prototype" + path: "lib" + - uses: actions/upload-artifact@v4 + with: + name: "lib" + path: "**" + + build-and-publish: + uses: samply/github-workflows/.github/workflows/docker-ci.yml@main + needs: download-lib + with: + image-name: ${{ github.repository }} + build-platforms: 'linux/amd64' + artifact-name: '*' + push-to: dockerhub + secrets: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 02e3f47..540d938 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,10 +5,30 @@ on: - "[0-9]+.[0-9]+.[0-9]+" jobs: + download-lib: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + repository: "samply/lens-angular" + ref: "feature/eucaim-prototype" + path: "lib" + - uses: actions/upload-artifact@v4 + with: + name: "lib" + path: "**" + build-and-publish: uses: samply/github-workflows/.github/workflows/docker-ci.yml@main + needs: download-lib with: image-name: ${{ github.repository }} + build-platforms: 'linux/amd64' + build-args: | + PRODUCTION=true + artifact-name: '*' + push-to: dockerhub + secrets: DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} diff --git a/.github/workflows/verify-new-code.yml b/.github/workflows/verify-new-code.yml index 8d029df..9c90b32 100644 --- a/.github/workflows/verify-new-code.yml +++ b/.github/workflows/verify-new-code.yml @@ -28,14 +28,14 @@ jobs: run: npm run lint:check-commits - run: npm run lint:check - test: - needs: [verify-code] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 16 - cache: 'npm' - - run: npm ci - - run: npm run test:headless + # test: + # needs: [verify-code] + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v3 + # - uses: actions/setup-node@v3 + # with: + # node-version: 16 + # cache: 'npm' + # - run: npm ci + # - run: npm run test:headless diff --git a/Dockerfile b/Dockerfile index f815fa3..4e0c61e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,27 @@ FROM node:lts as build -WORKDIR /usr/src/app +ARG PRODUCTION=false RUN sh -c '[ -z "$http_proxy" ] || ( npm config set proxy $http_proxy; npm config set https-proxy $http_proxy )' -COPY package.json package-lock.json ./ +# First build the lib +WORKDIR /usr/src/lib +COPY ./artifacts/lib/lib/package.json ./artifacts/lib/lib/package-lock.json ./ RUN npm install +COPY ./artifacts/lib/lib/angular.json ./artifacts/lib/lib/tsconfig.json ./ +COPY ./artifacts/lib/lib/core ./core/ +COPY ./artifacts/lib/lib/components ./components/ +RUN npm run build @samply/lens-core && npm run build @samply/lens-components +RUN cd dist/samply/lens-core && npm link \ + && cd ../lens-components && npm link +# Second build the application +WORKDIR /usr/src/app +COPY package.json package-lock.json ./ +RUN npm install && npm link @samply/lens-core @samply/lens-components COPY ./angular.json ./tsconfig.json ./tsconfig.app.json ./tsconfig.spec.json ./ COPY ./src ./src -RUN npm run build +RUN if [ "${PRODUCTION}" = true ]; then \ + npm run build:prod ${TARGET_PROJECT}; \ + else \ + npm run build ${TARGET_PROJECT}; \ + fi; FROM nginx:stable-alpine ENV NGINX_PORT=80 NGINX_DEPLOYMENT_CONTEXT=/ diff --git a/src/app/main/main.component.ts b/src/app/main/main.component.ts index 1552dff..2b67fe4 100644 --- a/src/app/main/main.component.ts +++ b/src/app/main/main.component.ts @@ -102,7 +102,7 @@ export class MainComponent { return values; } else { // 1) Reduce the key to the necessary part (for later aggregation leave the .) - let adjustedIcdCodes = values.map((value) => { + const adjustedIcdCodes = values.map((value) => { return { key: value.key.substring(0, 4), population: value.population, @@ -111,7 +111,7 @@ export class MainComponent { // 2) Aggregate the populations let aggregatedResults: Array<{ key: string; population: number }> = []; adjustedIcdCodes.forEach((value) => { - let index = aggregatedResults.findIndex( + const index = aggregatedResults.findIndex( (icdCode) => icdCode.key === value.key ); if (index != -1) { @@ -121,7 +121,7 @@ export class MainComponent { } }); // 3) Add % for wildcards on codes with . - let result = aggregatedResults.map((value) => { + const result = aggregatedResults.map((value) => { if (value.key.indexOf('.') !== -1) { return { key: value.key + '%', population: value.population }; } else { diff --git a/src/assets/catalogue.ts b/src/assets/catalogue.ts index 6c6dbe3..79df20d 100644 --- a/src/assets/catalogue.ts +++ b/src/assets/catalogue.ts @@ -10,7 +10,7 @@ export const staticCatalogue: Array = [ new Criteria( 'SNOMEDCT263495000', { de: 'Gender', en: 'Gender' }, - "gender", + 'gender', 'string', '', ['IN'], @@ -44,7 +44,7 @@ export const staticCatalogue: Array = [ new Criteria( 'SNOMEDCT423493009', { de: 'Age at Diagnosis', en: 'Age at Diagnosis' }, - "age at diagnosis", + 'age at diagnosis', 'number', '', ['LOWER_THAN', 'GREATER_THAN', 'BETWEEN'] @@ -55,7 +55,7 @@ export const staticCatalogue: Array = [ new Criteria( 'SNOMEDCT432213005', { de: 'Year of Diagnosis', en: 'Year of Diagnosis' }, - "year of diagnosis", + 'year of diagnosis', 'number', '', ['LOWER_THAN', 'GREATER_THAN', 'BETWEEN'] @@ -65,7 +65,7 @@ export const staticCatalogue: Array = [ new Criteria( 'RID10311', { de: 'Modality', en: 'Modality' }, - "modality", + 'modality', 'string', 'urn:oid:2.16.840.1.113883.6.256', ['IN'], diff --git a/src/assets/diagnosen.ts b/src/assets/diagnosen.ts index ca1fbd2..7f44e87 100644 --- a/src/assets/diagnosen.ts +++ b/src/assets/diagnosen.ts @@ -5,7 +5,7 @@ export const Diagnosen: Criteria = new Criteria( en: 'Diagnosis', de: 'Diagnosis', }, - "diagnosis", + 'diagnosis', 'string', 'urn:snomed-org/sct', ['EQUALS', 'CONTAINS'], diff --git a/src/assets/lokalisation.ts b/src/assets/lokalisation.ts index 6e8a5f7..2ed3463 100644 --- a/src/assets/lokalisation.ts +++ b/src/assets/lokalisation.ts @@ -6,7 +6,7 @@ export const Lokalisation: Criteria = new Criteria( de: 'Body Part', en: 'Body Part', }, - "body part", + 'body part', 'string', 'urn:snomed-org/sct', ['EQUALS', 'CONTAINS'], diff --git a/src/assets/manufacturer.ts b/src/assets/manufacturer.ts index 3b81e2a..015855f 100644 --- a/src/assets/manufacturer.ts +++ b/src/assets/manufacturer.ts @@ -6,7 +6,7 @@ export const Manufacturer: Criteria = new Criteria( de: 'Manufacturer', en: 'Manufacturer', }, - "manufacturer", + 'manufacturer', 'string', 'http://bioontology.org/projects/ontologies/birnlex', ['IN'], diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 751df39..319cf24 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -12,20 +12,12 @@ export const environment = { production: true, lensConfig: new LensConfig( [ - new Beam('broker', new URL('https://explorer.eucaim.cancerimage.eu/backend/'), [ - // new Beam('broker', new URL('http://localhost:8085'), [ - // 'proxy1', - // 'proxy2', - 'chaimeleon', - 'procanceri' - ]), + new Beam( + 'broker', + new URL('https://explorer.eucaim.cancerimage.eu/backend/'), + ['chaimeleon', 'procanceri'] + ), ], - [ - // patientsMeasure, - // diagnosisMeasure, - // specimenMeasure, - // proceduresMeasure, - // medicationStatementsMeasure, - ] + [] ), }; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 2efb4e7..a12a37d 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -2,27 +2,20 @@ // `ng build` replaces `environment.ts` with `environment.prod.ts`. // The list of file replacements can be found in `angular.json`. -import { - diagnosisMeasure, - LensConfig, - medicationStatementsMeasure, - patientsMeasure, - proceduresMeasure, - specimenMeasure, -} from '@samply/lens-core'; -import { Blaze } from '@samply/lens-core/cql'; +import { LensConfig } from '@samply/lens-core'; +import { Beam } from '@samply/lens-core/cql'; export const environment = { production: false, lensConfig: new LensConfig( - [new Blaze('blaze', new URL('http://localhost:8080'))], [ - patientsMeasure, - diagnosisMeasure, - specimenMeasure, - proceduresMeasure, - medicationStatementsMeasure, - ] + new Beam( + 'broker', + new URL('https://explorer-eucaim.grycap.i3m.upv.es/backend/'), + ['chaimeleon', 'procanceri'] + ), + ], + [] ), };