From c3e5d1b79919cae73b5008929a0953ed79dc9977 Mon Sep 17 00:00:00 2001 From: Mats Johansen Date: Tue, 19 Dec 2023 14:46:44 +0100 Subject: [PATCH 01/25] wip --- packages/demo/public/options.json | 88 ++++++- .../demo/src/AppFragmentDevelopment.svelte | 174 +++++++------ packages/demo/src/main.ts | 8 +- .../NegotiateButtonComponent.wc.svelte | 11 +- .../results/ResultTableComponent.wc.svelte | 1 + packages/lib/src/stores/negotiate.ts | 228 +++++++++++++----- packages/lib/src/stores/query.ts | 21 +- packages/lib/src/types/collection.ts | 6 + packages/lib/src/types/queryData.ts | 8 +- 9 files changed, 396 insertions(+), 149 deletions(-) create mode 100644 packages/lib/src/types/collection.ts diff --git a/packages/demo/public/options.json b/packages/demo/public/options.json index 60321b4..40fe930 100644 --- a/packages/demo/public/options.json +++ b/packages/demo/public/options.json @@ -118,5 +118,91 @@ "dataKey": "specimen" } ] + }, + "negotiateOptions": { + "negotiatorURL": "https://negotiator.bbmri-eric.eu/api/directory/create_query", + "siteMapping": [ + { + "site": "Dresden", + "collection": "bbmri-eric:ID:DE_BBD:collection:DILB" + }, + { + "site": "Frankfurt", + "collection": "bbmri-eric:ID:DE_iBDF:collection:UCT" + }, + { + "site": "Berlin", + "collection": "bbmri-eric:ID:DE_ZeBanC:collection:Onoloy" + }, + { + "site": "Würzburg", + "collection": "bbmri-eric:ID:DE_ibdw:collection:bc" + }, + { + "site": "Brno", + "collection": "bbmri-eric:ID:CZ_MMCI:collection:LTS" + }, + { + "site": "Aachen", + "collection": "bbmri-eric:ID:DE_RWTHCBMB:collection:RWTHCBMB_BC" + }, + { + "site": "Leipzig", + "collection": "bbmri-eric:ID:DE_LMB:collection:LIFE_ADULT" + }, + { + "site": "München (HMGU)", + "collection": "bbmri-eric:ID:DE_Helmholtz-MuenchenBiobank:collection:DE_KORA" + }, + { + "site": "Pilsen", + "collection": "bbmri-eric:ID:CZ_CUNI_PILS:collection:serum_plasma" + }, + { + "site": "Regensburg", + "collection": "bbmri-eric:ID:DE_ZBR:collection:Tissue" + }, + { + "site": "Heidelberg", + "collection": "bbmri-eric:ID:DE_BMBH:collection:Lungenbiobank" + }, + { + "site": "Lübeck", + "collection": "bbmri-eric:ID:DE_ICBL:collection:ICBL" + }, + { + "site": "Augsburg", + "collection": "bbmri-eric:ID:DE_ACBB:collection:TISSUE" + }, + { + "site": "Mannheim", + "collection": "bbmri-eric:ID:DE_BioPsy:collection:Main_collecion" + }, + { + "site": "Marburg", + "collection": "bbmri-eric:ID:DE_CBBMR:collection:main" + }, + { + "site": "Göttingen", + "collection": "bbmri-eric:ID:DE_UMGB:collection:UMG-startegy" + }, + { + "site": "Hanover", + "collection": "bbmri-eric:ID:DE_HUB:collection:ProBase" + }, + { + "site": "Olomouc", + "collection": "bbmri-eric:ID:CZ_UPOL_LF:collection:all_samples" + }, + { + "site": "Prague (FFM)", + "collection": "bbmri-eric:ID:CZ_CUNI_PILS:collection:serum_plasma" + }, + { + "site": "Prague (IOR)", + "collection": "bbmri-eric:ID:CZ_CUNI_LF1:collection" + } + + ] } -} \ No newline at end of file +} diff --git a/packages/demo/src/AppFragmentDevelopment.svelte b/packages/demo/src/AppFragmentDevelopment.svelte index 7c445b4..ea30e8d 100644 --- a/packages/demo/src/AppFragmentDevelopment.svelte +++ b/packages/demo/src/AppFragmentDevelopment.svelte @@ -2,14 +2,15 @@ import "../../lib"; import type { CatalogueText } from "../../lib/src/types/texts"; import { - patientsMeasure, - diagnosisMeasure, - specimenMeasure, - proceduresMeasure, - medicationStatementsMeasure, + dktkDiagnosisMeasure, + dktkMedicationStatementsMeasure, + dktkPatientsMeasure, + dktkProceduresMeasure, + dktkSpecimenMeasure, } from "./measures"; let mockCatalogueData = ""; + let libraryOptions = "" fetch("catalogues/catalogue-dktk.json") .then((response) => response.text()) @@ -17,66 +18,56 @@ mockCatalogueData = data; }); + fetch("options.json") + .then((response) => response.json()) + .then((data) => { + libraryOptions = data + }); + const measures = [ - patientsMeasure, - diagnosisMeasure, - specimenMeasure, - proceduresMeasure, - medicationStatementsMeasure, + dktkPatientsMeasure, + dktkDiagnosisMeasure, + dktkSpecimenMeasure, + dktkProceduresMeasure, + dktkMedicationStatementsMeasure, ]; - const cqlHeader = `library Retrieve - using FHIR version '4.0.0' - include FHIRHelpers version '4.0.0' - - codesystem loinc: 'http://loinc.org' - - context Patient - - DKTK_STRAT_GENDER_STRATIFIER - - DKTK_STRAT_AGE_STRATIFIER - - DKTK_STRAT_DECEASED_STRATIFIER - - DKTK_STRAT_DIAGNOSIS_STRATIFIER - - DKTK_STRAT_SPECIMEN_STRATIFIER - - DKTK_STRAT_PROCEDURE_STRATIFIER - - DKTK_STRAT_MEDICATION_STRATIFIER - - DKTK_STRAT_ENCOUNTER_STRATIFIER - - DKTK_STRAT_DEF_IN_INITIAL_POPULATION -` - + const backendMeasures = `DKTK_STRAT_DEF_IN_INITIAL_POPULATION`; const catalogueText: CatalogueText = { group: "Group", collapseButtonTitle: "Collapse Tree", expandButtonTitle: "Expand Tree", numberInput: { - labelFrom: "From", - labelTo: "to", + labelFrom: "von", + labelTo: "bis", }, }; - let catalogueopen = false; const resultSummaryConfig = [ { key: "sites", - title: "Sites", + title: "Standorte", }, { key: "patients", - title: "Patients", + title: "Patienten", }, ]; + const catalogueKeyToResponseKeyMap = [ + ["gender", "Gender"], + ["age_at_diagnosis", "Age"], + ["diagnosis", "diagnosis"], + ["medicationStatements", "MedicationType"], + ["sample_kind", "sample_kind"], + ["therapy_of_tumor", "ProcedureType"], + ["75186-7", "75186-7"], + // ["encounter", "Encounter"], + ]; + const siteToDefaultCollectionId: string[][] = [ ["dresden", "bbmri-eric:ID:DE_BBD:collection:DILB"], ["frankfurt", "bbmri-eric:ID:DE_iBDF:collection:UCT"], @@ -85,7 +76,10 @@ ["brno", "bbmri-eric:ID:CZ_MMCI:collection:LTS"], ["aachen", "bbmri-eric:ID:DE_RWTHCBMB:collection:RWTHCBMB_BC"], ["leipzig", "bbmri-eric:ID:DE_LMB:collection:LIFE_ADULT"], - ["muenchen-hmgu", "bbmri-eric:ID:DE_Helmholtz-MuenchenBiobank:collection:DE_KORA"], + [ + "muenchen-hmgu", + "bbmri-eric:ID:DE_Helmholtz-MuenchenBiobank:collection:DE_KORA", + ], ["Pilsen", "bbmri-eric:ID:CZ_CUNI_PILS:collection:serum_plasma"], ["regensburg", "bbmri-eric:ID:DE_ZBR:collection:Tissue"], ["heidelberg", "bbmri-eric:ID:DE_BMBH:collection:Lungenbiobank"], @@ -109,61 +103,73 @@ ["freiburg", "Freiburg"], ["hannover", "Hannover"], ["mainz", "Mainz"], - ["muenchen-lmu", "München(LMU],"], - ["muenchen-tum", "München(TUM],"], + ["muenchen-lmu", "München(LMU)"], + ["muenchen-tum", "München(TUM)"], ["ulm", "Ulm"], ["wuerzburg", "Würzburg"], ["mannheim", "Mannheim"], ["dktk-test", "DKTK-Test"], ["hamburg", "Hamburg"], - ]; -const catalogueKeyToResponseKeyMap = [ - ['gender', 'Gender'], - ["age_at_diagnosis", 'Age'] -] + // VITE_TARGET_ENVIRONMENT should be set by the ci pipeline + const backendUrl = (import.meta.env.VITE_TARGET_ENVIRONMENT === "production") + ? "https://backend.data.dktk.dkfz.de/prod/" + : "https://backend.demo.lens.samply.de/prod/" const backendConfig = { - url: "http://localhost:8080", + url: (import.meta.env.PROD) ? backendUrl : "http://localhost:8080", backends: [ - 'mannheim', - 'freiburg', - 'muenchen-tum', - 'hamburg', - 'frankfurt', - 'berlin', - 'dresden', - 'mainz', - 'muenchen-lmu', - 'essen', - 'ulm', - 'wuerzburg', + "mannheim", + "freiburg", + "muenchen-tum", + "hamburg", + "frankfurt", + "berlin", + "dresden", + "mainz", + "muenchen-lmu", + "essen", + "ulm", + "wuerzburg", + "hannover", ], uiSiteMap: uiSiteMap, catalogueKeyToResponseKeyMap: catalogueKeyToResponseKeyMap, }; + const genderHeaders: Map = new Map() + .set("male", "männlich") + .set("female", "weiblich") + .set("other", "divers, intersexuell") + .set("unknown", "unbekannt"); + + const vitalStateHeaders: Map = new Map() + .set("lebend", "alive") + .set("verstorben", "deceased") + .set("unbekannt", "unknown"); + + const therapyHeaders: Map = new Map().set( + "medicationStatements", + "Sys. T" + ); +

Search Button

+ title="Suchen" + {measures} + backendConfig={JSON.stringify(backendConfig)} + {backendMeasures} + />
-

Result Summary Bar

+

Negotiator Button

- +

Result Table

@@ -175,18 +181,24 @@ const catalogueKeyToResponseKeyMap = [
+

Result Summary Bar

+
+ +
+

Result Bar Chart

@@ -208,9 +220,17 @@ const catalogueKeyToResponseKeyMap = [ noMatchesFoundMessage={"No matches found"} />
+
+ +

State display

+ + \ No newline at end of file diff --git a/packages/demo/src/main.ts b/packages/demo/src/main.ts index 226be0a..fba51e0 100644 --- a/packages/demo/src/main.ts +++ b/packages/demo/src/main.ts @@ -1,8 +1,8 @@ -// import './fragment-development.css' -// import App from './AppFragmentDevelopment.svelte' +import './fragment-development.css' +import App from './AppFragmentDevelopment.svelte' -import './ccp.css' -import App from './AppCCP.svelte' +// import './ccp.css' +// import App from './AppCCP.svelte' // import App from './AppBBMRI.svelte' // import './bbmri.css' diff --git a/packages/lib/src/components/buttons/NegotiateButtonComponent.wc.svelte b/packages/lib/src/components/buttons/NegotiateButtonComponent.wc.svelte index 6fe1d84..9da6612 100644 --- a/packages/lib/src/components/buttons/NegotiateButtonComponent.wc.svelte +++ b/packages/lib/src/components/buttons/NegotiateButtonComponent.wc.svelte @@ -1,5 +1,12 @@ + + +