From 071817762d4ff942e2fcd97287fe337f94a010f3 Mon Sep 17 00:00:00 2001 From: Alper Teoman Date: Mon, 26 Apr 2021 14:54:38 +0300 Subject: [PATCH 1/4] :recycle: refactor(TerminologyService): Trim trailing slashes in urls --- src/common/utils/fhir-util.ts | 8 ++++++++ src/components/CodeSystemSelect.vue | 3 ++- src/components/OnFHIRConfig.vue | 4 +++- src/components/TerminologyConfig.vue | 4 +++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/common/utils/fhir-util.ts b/src/common/utils/fhir-util.ts index 0a205ee..be2a8be 100644 --- a/src/common/utils/fhir-util.ts +++ b/src/common/utils/fhir-util.ts @@ -197,6 +197,14 @@ export class FHIRUtil { } } + /** + * Removes the trailing slash in the url + * @param url + */ + static trimUrl (url: string): string { + return (url || '').replace(/\/$/, '') + } + private static readonly secretKey: string = 'E~w*c`r8e?aetZeid]b$y+aIl&p4eNr*a' } diff --git a/src/components/CodeSystemSelect.vue b/src/components/CodeSystemSelect.vue index 4cb4fbc..be7f32e 100644 --- a/src/components/CodeSystemSelect.vue +++ b/src/components/CodeSystemSelect.vue @@ -30,6 +30,7 @@ import { Component, Vue, Prop } from 'vue-property-decorator' import { environment } from '@/common/environment' import { VuexStoreUtil as types } from '@/common/utils/vuex-store-util' + import {FHIRUtil} from '@/common/utils/fhir-util' @Component export default class CodeSystemSelect extends Vue { @@ -54,7 +55,7 @@ } updateUrl (val: string) { - this.url = val?.trim() || '' + this.url = FHIRUtil.trimUrl(val?.trim() || '') this.$emit('input', this.url) } } diff --git a/src/components/OnFHIRConfig.vue b/src/components/OnFHIRConfig.vue index bae21a8..e2b7608 100644 --- a/src/components/OnFHIRConfig.vue +++ b/src/components/OnFHIRConfig.vue @@ -6,7 +6,7 @@ {{ $t('LABELS.PROVIDE_FHIR_URL') }} - { diff --git a/src/components/TerminologyConfig.vue b/src/components/TerminologyConfig.vue index d11d11f..69aa114 100644 --- a/src/components/TerminologyConfig.vue +++ b/src/components/TerminologyConfig.vue @@ -4,7 +4,7 @@ {{ $t('LABELS.ADD_TERMINOLOGY_SERVICE') }} - { From 3ea7060676ddb64345974933d73ca947ebd5ba94 Mon Sep 17 00:00:00 2001 From: Alper Teoman Date: Mon, 26 Apr 2021 16:08:25 +0300 Subject: [PATCH 2/4] :sparkles: feat: Put the number of created resources into the extension part of Provenance and DocumentManifest --- src/common/environment.ts | 5 +++++ src/components/BackgroundEngine.ts | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/common/environment.ts b/src/common/environment.ts index edeb76d..ed47b4d 100644 --- a/src/common/environment.ts +++ b/src/common/environment.ts @@ -2,6 +2,10 @@ const onfhirBase = 'http://localhost:8080/fhir' const hl7Base = 'http://hl7.org/fhir' +// The url representing how many resources created during transformation +// Placed in the extension part of the Provenance and DocumentManifest resources +const numberOfResourcesUrlBase = `${hl7Base}/f4h/resource-count` + export let environment = { toolID: 'data-curation-tool', server: { @@ -19,6 +23,7 @@ export let environment = { databaseTypes: ['postgres'], hl7: hl7Base, FHIRBatchOperationSize: 1000, + numberOfResourcesUrlBase, codesystems: { ATC: 'http://www.whocc.no/atc', SNOMED: 'http://snomed.info/sct', diff --git a/src/components/BackgroundEngine.ts b/src/components/BackgroundEngine.ts index 734188f..6203332 100644 --- a/src/components/BackgroundEngine.ts +++ b/src/components/BackgroundEngine.ts @@ -1057,12 +1057,29 @@ export default class BackgroundEngine extends Vue { */ createProvenanceAndLicense (author: string, license: License, provenanceTargets: fhir.Reference[], documentManifestContent: fhir.Reference[]): Promise { const currentDate: string = new Date().toISOString() + const resourceCounts = provenanceTargets.reduce((acc, currReference) => { + const reference = currReference.reference.split('/')[0] + if (!acc.hasOwnProperty(reference)) { + acc[reference] = 0 + } + acc[reference]++ + return acc + }, {}) + const extension: fhir.Extension[] = [] + Object.keys(resourceCounts).map((resourceType: string) => { + extension.push({ + url: `${environment.numberOfResourcesUrlBase}/${resourceType}`, + valueInteger: resourceCounts[resourceType] + }) + }) // Modify provenance resource + this.provenance.extension = extension this.provenance.target = provenanceTargets this.provenance.recorded = currentDate this.provenance.signature[0].when = currentDate this.provenance.agent[0].who.display = author // Modify documentManifest resource + this.documentManifest.extension = extension this.documentManifest.content = documentManifestContent this.documentManifest.created = currentDate this.documentManifest.related[0].ref.display = license.display From 67735c693128f584f11dbf5a240fa8de1211ab8a Mon Sep 17 00:00:00 2001 From: Alper Teoman Date: Mon, 26 Apr 2021 16:16:23 +0300 Subject: [PATCH 3/4] :memo: docs: Update the Terminology Service API --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6956ddd..b8baebb 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,8 @@ The tool writes logs to the following locations: - on **Linux**: `~/.config/FAIR4Health Data Curation Tool/logs/log.txt` ## Terminology Server Connection -The tool is compatible with FHIR based Terminology Servers, in order to translate values from one system to another. As the sample API https://terminology-service.atosresearch.eu provided by ATOS was used. +The tool is compatible with FHIR based Terminology Servers, in order to translate values from one system to another. + As the sample API `https://health-digital-term.ari-health.eu` provided by ATOS was used. Currently, in the tool: - For the translation operation, the ConceptMap translate API: `/ConceptMap/$translate` is consumed. From 950a724d8ef0837b3bb88879135fb2fe96aa31b1 Mon Sep 17 00:00:00 2001 From: Alper Teoman Date: Mon, 26 Apr 2021 16:18:05 +0300 Subject: [PATCH 4/4] :wrench: chore(app): Bump version v1.2.3 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 447c368..2bfdbbc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "fair4health-data-curation-tool", - "version": "1.2.2", + "version": "1.2.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 13718fd..a0fc5d0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "fair4health-data-curation-tool", "productName": "FAIR4Health Data Curation Tool", - "version": "1.2.2", + "version": "1.2.3", "private": true, "author": "SRDC Corporation ", "description": "FAIR4Health | Data Curation and Validation Tool",