From d2c0bd37498e7e35cdeda6daf0d064c24fcf88d5 Mon Sep 17 00:00:00 2001 From: Mats Johansen Date: Wed, 28 Aug 2024 12:50:34 +0200 Subject: [PATCH 1/3] feat(options): move catalog response key map --- docker-compose.yml | 2 + packages/demo/public/options-ccp-demo.json | 30 ++++++ packages/demo/public/options-ccp-prod.json | 30 ++++++ packages/demo/public/options-dev.json | 96 +++++++------------ packages/lib/src/components/Options.wc.svelte | 16 +++- .../buttons/SearchButtonComponenet.wc.svelte | 19 +--- packages/lib/src/types/options.schema.json | 33 +++---- packages/lib/src/types/options.ts | 1 + 8 files changed, 124 insertions(+), 103 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 146da345..68a0509e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -58,6 +58,7 @@ services: spot: image: samply/rustyspot:main + platform: linux/amd64 ports: - "8055:8055" environment: @@ -93,6 +94,7 @@ services: beam-proxy: image: docker.verbis.dkfz.de/cache/samply/beam-proxy:develop + platform: linux/amd64 environment: BROKER_URL: https://${BROKER_HOST} PROXY_ID: ${LOCAL_BEAM_ID}.${BROKER_HOST} diff --git a/packages/demo/public/options-ccp-demo.json b/packages/demo/public/options-ccp-demo.json index f57e95c6..1de78757 100644 --- a/packages/demo/public/options-ccp-demo.json +++ b/packages/demo/public/options-ccp-demo.json @@ -24,6 +24,36 @@ "dktk-test": "DKTK-Test", "hamburg": "Hamburg" }, + "catalogueKeyToResponseKeyMap": [ + [ + "gender", + "Gender" + ], + [ + "age_at_diagnosis", + "Age" + ], + [ + "diagnosis", + "diagnosis" + ], + [ + "medicationStatements", + "MedicationType" + ], + [ + "sample_kind", + "sample_kind" + ], + [ + "therapy_of_tumor", + "ProcedureType" + ], + [ + "75186-7", + "75186-7" + ] + ], "chartOptions": { "patients": { "legendMapping": { diff --git a/packages/demo/public/options-ccp-prod.json b/packages/demo/public/options-ccp-prod.json index 9b30387a..2f224180 100644 --- a/packages/demo/public/options-ccp-prod.json +++ b/packages/demo/public/options-ccp-prod.json @@ -25,6 +25,36 @@ "dktk-test": "DKTK-Test", "hamburg": "Hamburg" }, + "catalogueKeyToResponseKeyMap": [ + [ + "gender", + "Gender" + ], + [ + "age_at_diagnosis", + "Age" + ], + [ + "diagnosis", + "diagnosis" + ], + [ + "medicationStatements", + "MedicationType" + ], + [ + "sample_kind", + "sample_kind" + ], + [ + "therapy_of_tumor", + "ProcedureType" + ], + [ + "75186-7", + "75186-7" + ] + ], "chartOptions": { "patients": { "legendMapping": { diff --git a/packages/demo/public/options-dev.json b/packages/demo/public/options-dev.json index 7b5f2966..96226d45 100644 --- a/packages/demo/public/options-dev.json +++ b/packages/demo/public/options-dev.json @@ -23,6 +23,36 @@ "dktk-test": "DKTK-Test", "hamburg": "Hamburg" }, + "catalogueKeyToResponseKeyMap": [ + [ + "gender", + "Gender" + ], + [ + "age_at_diagnosis", + "Age" + ], + [ + "diagnosis", + "diagnosis" + ], + [ + "medicationStatements", + "MedicationType" + ], + [ + "sample_kind", + "sample_kind" + ], + [ + "therapy_of_tumor", + "ProcedureType" + ], + [ + "75186-7", + "75186-7" + ] + ], "chartOptions": { "patients": { "legendMapping": { @@ -149,7 +179,7 @@ "rna": "RNA", "derivative-other": "Derivat, Andere" }, - "legendMapping":{ + "legendMapping": { "ffpe-tissue": "Gewebe FFPE", "frozen-tissue": "Gewebe schockgefroren", "tissue-other": "Gewebe, Andere Konservierungsart", @@ -239,36 +269,6 @@ "wuerzburg", "mannheim", "hamburg" - ], - "catalogueKeyToResponseKeyMap": [ - [ - "gender", - "Gender" - ], - [ - "age_at_diagnosis", - "Age" - ], - [ - "diagnosis", - "diagnosis" - ], - [ - "medicationStatements", - "MedicationType" - ], - [ - "sample_kind", - "sample_kind" - ], - [ - "therapy_of_tumor", - "ProcedureType" - ], - [ - "75186-7", - "75186-7" - ] ] } ], @@ -276,38 +276,8 @@ { "name": "DKTK", "backendMeasures": "DKTK_STRAT_DEF_IN_INITIAL_POPULATION", - "url": "http://localhost:8080", - "catalogueKeyToResponseKeyMap": [ - [ - "gender", - "Gender" - ], - [ - "age_at_diagnosis", - "Age" - ], - [ - "diagnosis", - "diagnosis" - ], - [ - "medicationStatements", - "MedicationType" - ], - [ - "sample_kind", - "sample_kind" - ], - [ - "therapy_of_tumor", - "ProcedureType" - ], - [ - "75186-7", - "75186-7" - ] - ] + "url": "http://localhost:8080" } ] } -} +} \ No newline at end of file diff --git a/packages/lib/src/components/Options.wc.svelte b/packages/lib/src/components/Options.wc.svelte index 600ac086..c1cdec1a 100644 --- a/packages/lib/src/components/Options.wc.svelte +++ b/packages/lib/src/components/Options.wc.svelte @@ -23,7 +23,10 @@ import catalogueSchema from "../types/catalogue.schema.json"; import { parser } from "@exodus/schemasafe"; import type { LensOptions } from "../types/options"; - import { uiSiteMappingsStore } from "../stores/mappings"; + import { + catalogueKeyToResponseKeyMap, + uiSiteMappingsStore, + } from "../stores/mappings"; export let options: LensOptions = {}; export let catalogueData: Criteria[] = []; @@ -123,6 +126,17 @@ return mappings; }); + $: catalogueKeyToResponseKeyMap.update((mappings) => { + if (!options?.catalogueKeyToResponseKeyMap) return mappings; + console.log(options.catalogueKeyToResponseKeyMap); + + options.catalogueKeyToResponseKeyMap.forEach((mapping) => { + console.log(mapping); + mappings.set(mapping[0], mapping[1]); + }); + return mappings; + }); + $: $lensOptions = options; $: updateIconStore(options); $: $catalogue = catalogueData; diff --git a/packages/lib/src/components/buttons/SearchButtonComponenet.wc.svelte b/packages/lib/src/components/buttons/SearchButtonComponenet.wc.svelte index c84ddf1a..ec4624f8 100644 --- a/packages/lib/src/components/buttons/SearchButtonComponenet.wc.svelte +++ b/packages/lib/src/components/buttons/SearchButtonComponenet.wc.svelte @@ -17,17 +17,16 @@ import { buildLibrary, buildMeasure } from "../../helpers/cql-measure"; import { Spot } from "../../classes/spot"; import { Blaze } from "../../classes/blaze"; - import { catalogueKeyToResponseKeyMap } from "../../stores/mappings"; import { responseStore, updateResponseStore } from "../../stores/response"; import { lensOptions } from "../../stores/options"; import type { BackendOptions, - BlazeOption, Measure, MeasureItem, MeasureOption, - SpotOption, } from "../../types/backend"; + import type { BlazeOption } from "../../types/blaze"; + import type { SpotOption } from "../../types/spot"; import type { AstTopLayer } from "../../types/ast"; import type { Site } from "../../types/response"; @@ -39,20 +38,6 @@ let controller: AbortController = new AbortController(); - $: catalogueKeyToResponseKeyMap.update((mappings) => { - options?.spots?.forEach((spot) => { - spot.catalogueKeyToResponseKeyMap.forEach((mapping) => { - mappings.set(mapping[0], mapping[1]); - }); - }); - options?.blazes?.forEach((blaze: BlazeOption) => { - blaze.catalogueKeyToResponseKeyMap.forEach((mapping) => { - mappings.set(mapping[0], mapping[1]); - }); - }); - return mappings; - }); - /** * Triggers a request to the backend. * Multiple spots and blazes can be configured in lens options. diff --git a/packages/lib/src/types/options.schema.json b/packages/lib/src/types/options.schema.json index 42bdfc2f..8bedab4b 100644 --- a/packages/lib/src/types/options.schema.json +++ b/packages/lib/src/types/options.schema.json @@ -47,6 +47,17 @@ "unevaluatedProperties": false, "required": [] }, + "catalogueKeyToResponseKeyMap": { + "type": "array", + "items": { + "type": "array", + "items": { + "type": "string", + "pattern": "^.+$", + "description": "The mapping of the catalogue key to the response key" + } + } + }, "chartOptions": { "type": "object", "patternProperties": { @@ -286,17 +297,6 @@ "pattern": "^.+$", "description": "The sites of the spot" } - }, - "catalogueKeyToResponseKeyMap": { - "type": "array", - "items": { - "type": "array", - "items": { - "type": "string", - "pattern": "^.+$", - "description": "The mapping of the catalogue key to the response key" - } - } } }, "additionalProperties": false, @@ -323,17 +323,6 @@ "type": "string", "pattern": "^.+$", "description": "The URL of the blaze" - }, - "catalogueKeyToResponseKeyMap": { - "type": "array", - "items": { - "type": "array", - "items": { - "type": "string", - "pattern": "^.+$", - "description": "The mapping of the catalogue key to the response key" - } - } } }, "additionalProperties": false, diff --git a/packages/lib/src/types/options.ts b/packages/lib/src/types/options.ts index 965cc9f9..493f0052 100644 --- a/packages/lib/src/types/options.ts +++ b/packages/lib/src/types/options.ts @@ -1,6 +1,7 @@ export type LensOptions = { [key: string]: unknown; chartOptions?: ChartOptions; + catalogueKeyToResponseKeyMap?: string[][]; }; export type ChartOptions = { From d8c7c6fd50734a7f74d87e02f4f3ed1e43f4b0e1 Mon Sep 17 00:00:00 2001 From: Mats Johansen Date: Wed, 28 Aug 2024 12:57:24 +0200 Subject: [PATCH 2/3] chore(logs): remove logs --- packages/lib/src/components/Options.wc.svelte | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/lib/src/components/Options.wc.svelte b/packages/lib/src/components/Options.wc.svelte index c1cdec1a..5c0a6636 100644 --- a/packages/lib/src/components/Options.wc.svelte +++ b/packages/lib/src/components/Options.wc.svelte @@ -128,10 +128,8 @@ $: catalogueKeyToResponseKeyMap.update((mappings) => { if (!options?.catalogueKeyToResponseKeyMap) return mappings; - console.log(options.catalogueKeyToResponseKeyMap); options.catalogueKeyToResponseKeyMap.forEach((mapping) => { - console.log(mapping); mappings.set(mapping[0], mapping[1]); }); return mappings; From 640fb99eb5dc7fac98ee42c74e32b8951c1c65d9 Mon Sep 17 00:00:00 2001 From: Mats Johansen Date: Mon, 2 Sep 2024 08:55:12 +0200 Subject: [PATCH 3/3] feat(options): update prod and demo options to new schema --- packages/demo/public/options-ccp-demo.json | 30 ---------------------- packages/demo/public/options-ccp-prod.json | 30 ---------------------- 2 files changed, 60 deletions(-) diff --git a/packages/demo/public/options-ccp-demo.json b/packages/demo/public/options-ccp-demo.json index 1de78757..0122c8f8 100644 --- a/packages/demo/public/options-ccp-demo.json +++ b/packages/demo/public/options-ccp-demo.json @@ -267,36 +267,6 @@ "wuerzburg", "mannheim", "hamburg" - ], - "catalogueKeyToResponseKeyMap": [ - [ - "gender", - "Gender" - ], - [ - "age_at_diagnosis", - "Age" - ], - [ - "diagnosis", - "diagnosis" - ], - [ - "medicationStatements", - "MedicationType" - ], - [ - "sample_kind", - "sample_kind" - ], - [ - "therapy_of_tumor", - "ProcedureType" - ], - [ - "75186-7", - "75186-7" - ] ] } ] diff --git a/packages/demo/public/options-ccp-prod.json b/packages/demo/public/options-ccp-prod.json index 2f224180..77f517cb 100644 --- a/packages/demo/public/options-ccp-prod.json +++ b/packages/demo/public/options-ccp-prod.json @@ -262,36 +262,6 @@ "wuerzburg", "mannheim", "hamburg" - ], - "catalogueKeyToResponseKeyMap": [ - [ - "gender", - "Gender" - ], - [ - "age_at_diagnosis", - "Age" - ], - [ - "diagnosis", - "diagnosis" - ], - [ - "medicationStatements", - "MedicationType" - ], - [ - "sample_kind", - "sample_kind" - ], - [ - "therapy_of_tumor", - "ProcedureType" - ], - [ - "75186-7", - "75186-7" - ] ] } ]