From 111284e4ff412b8f399b55ae09fde8b255289f75 Mon Sep 17 00:00:00 2001 From: Mats Johansen Date: Wed, 20 Dec 2023 11:35:22 +0100 Subject: [PATCH 1/5] feat: add support for aggregation between groups and stratifiers --- packages/demo/public/options.json | 28 ++++++++ packages/demo/src/AppCCP.svelte | 26 ++++--- .../results/ResultSummaryComponent.wc.svelte | 72 +++++++++++++------ packages/lib/src/stores/options.ts | 2 +- 4 files changed, 91 insertions(+), 37 deletions(-) diff --git a/packages/demo/public/options.json b/packages/demo/public/options.json index 60321b42..d7c1adf7 100644 --- a/packages/demo/public/options.json +++ b/packages/demo/public/options.json @@ -118,5 +118,33 @@ "dataKey": "specimen" } ] + }, + "resultSummaryOptions": { + "title": "Ergebnisse", + "dataTypes": [ + { + "title": "Standorte", + "dataKey": "collections" + }, + { + "title": "Patienten", + "dataKey": "patients" + }, + { + "title": "Bioproben*", + "dataKey": "specimen", + "aggregatedDataKeys": [ + { + "groupCode": "specimen" + }, + { + "stratifierCode": "Histlogoies",//typo? + "stratumCode": "1" + }, + { + } + ] + } + ] } } \ No newline at end of file diff --git a/packages/demo/src/AppCCP.svelte b/packages/demo/src/AppCCP.svelte index c8d67103..92886331 100644 --- a/packages/demo/src/AppCCP.svelte +++ b/packages/demo/src/AppCCP.svelte @@ -120,19 +120,19 @@ const backendConfig = { url: (import.meta.env.PROD) ? backendUrl : "http://localhost:8080", backends: [ - "mannheim", - "freiburg", - "muenchen-tum", - "hamburg", - "frankfurt", - "berlin", - "dresden", + // "mannheim", + // "freiburg", + // "muenchen-tum", + // "hamburg", + // "frankfurt", + // "berlin", + // "dresden", "mainz", - "muenchen-lmu", - "essen", - "ulm", - "wuerzburg", - "hannover", + // "muenchen-lmu", + // "essen", + // "ulm", + // "wuerzburg", + // "hannover", ], uiSiteMap: uiSiteMap, catalogueKeyToResponseKeyMap: catalogueKeyToResponseKeyMap, @@ -209,8 +209,6 @@
Diagramme repräsentieren nicht mehr die aktuelle Suche!
diff --git a/packages/lib/src/components/results/ResultSummaryComponent.wc.svelte b/packages/lib/src/components/results/ResultSummaryComponent.wc.svelte index 4112df2b..76d3480e 100644 --- a/packages/lib/src/components/results/ResultSummaryComponent.wc.svelte +++ b/packages/lib/src/components/results/ResultSummaryComponent.wc.svelte @@ -8,24 +8,34 @@ /> -{#if title} +{#if options?.title}

- {title} + {options.title}

{/if} @@ -80,8 +112,4 @@
{/each} -{#if negotiateButton} -
- -
-{/if} + diff --git a/packages/lib/src/stores/options.ts b/packages/lib/src/stores/options.ts index f718ad94..c23ed862 100644 --- a/packages/lib/src/stores/options.ts +++ b/packages/lib/src/stores/options.ts @@ -1,4 +1,4 @@ import { writable } from "svelte/store"; -export const lensOptions = writable() \ No newline at end of file +export const lensOptions = writable({}) \ No newline at end of file From e8eb5d96ac2e53395bc6f3d7367a442361bf562e Mon Sep 17 00:00:00 2001 From: Mats Johansen Date: Wed, 20 Dec 2023 11:52:35 +0100 Subject: [PATCH 2/5] feat(result summary): combine specimens and histologies --- packages/demo/public/options.json | 3 +- packages/demo/src/AppCCP.svelte | 2 + packages/demo/src/measures.ts | 46 +++++++++++++++++++ .../results/ResultSummaryComponent.wc.svelte | 1 + 4 files changed, 50 insertions(+), 2 deletions(-) diff --git a/packages/demo/public/options.json b/packages/demo/public/options.json index d7c1adf7..56c5b44b 100644 --- a/packages/demo/public/options.json +++ b/packages/demo/public/options.json @@ -132,13 +132,12 @@ }, { "title": "Bioproben*", - "dataKey": "specimen", "aggregatedDataKeys": [ { "groupCode": "specimen" }, { - "stratifierCode": "Histlogoies",//typo? + "stratifierCode": "Histlogoies", "stratumCode": "1" }, { diff --git a/packages/demo/src/AppCCP.svelte b/packages/demo/src/AppCCP.svelte index 92886331..a4fd888a 100644 --- a/packages/demo/src/AppCCP.svelte +++ b/packages/demo/src/AppCCP.svelte @@ -7,6 +7,7 @@ dktkPatientsMeasure, dktkProceduresMeasure, dktkSpecimenMeasure, + dktkHistologyMeasure } from "./measures"; let mockCatalogueData = ""; @@ -30,6 +31,7 @@ dktkSpecimenMeasure, dktkProceduresMeasure, dktkMedicationStatementsMeasure, + dktkHistologyMeasure ]; const backendMeasures = `DKTK_STRAT_DEF_IN_INITIAL_POPULATION`; diff --git a/packages/demo/src/measures.ts b/packages/demo/src/measures.ts index 373f4c1c..cb24a233 100644 --- a/packages/demo/src/measures.ts +++ b/packages/demo/src/measures.ts @@ -1025,3 +1025,49 @@ export const dktkMedicationStatementsMeasure = { DKTK_STRAT_MEDICATION_STRATIFIER `, }; + +export const dktkHistologyMeasure = { + key: 'Histo', + measure: { + code: { + text: 'Histo', + }, + extension: [ + { + url: 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-populationBasis', + valueCode: 'Observation', + }, + ], + population: [ + { + code: { + coding: [ + { + system: + 'http://terminology.hl7.org/CodeSystem/measure-population', + code: 'initial-population', + }, + ], + }, + criteria: { + language: 'text/cql-identifier', + expression: 'Histo', + }, + }, + ], + stratifier: [ + { + code: { + text: 'Histlogoies', + }, + criteria: { + language: 'text/cql-identifier', + expression: 'Histlogoy', + }, + }, + ], + }, + cql: ` + DKTK_STRAT_HISTOLOGY_STRATIFIER +`, +}; diff --git a/packages/lib/src/components/results/ResultSummaryComponent.wc.svelte b/packages/lib/src/components/results/ResultSummaryComponent.wc.svelte index 76d3480e..39326fec 100644 --- a/packages/lib/src/components/results/ResultSummaryComponent.wc.svelte +++ b/packages/lib/src/components/results/ResultSummaryComponent.wc.svelte @@ -53,6 +53,7 @@ }); resultSummaryDataTypes = options.dataTypes.map((type) => { + console.log(getAggregatedPopulationForStratumCode(store, '1', "Histlogoies")); /** * If the type is collections, the population is the length of the store */ From 16dcc7c3305149d527af30c95fb744f574d280ba Mon Sep 17 00:00:00 2001 From: Mats Johansen Date: Wed, 20 Dec 2023 12:16:59 +0100 Subject: [PATCH 3/5] feat(result table): add support for aggregation between groups and specimens combine specimen and histologies --- packages/demo/public/options.json | 12 ++++++- .../results/ResultTableComponent.wc.svelte | 31 ++++++++++++++++--- packages/lib/src/types/biobanks.ts | 7 ++++- 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/packages/demo/public/options.json b/packages/demo/public/options.json index 56c5b44b..0546e91e 100644 --- a/packages/demo/public/options.json +++ b/packages/demo/public/options.json @@ -115,7 +115,17 @@ }, { "title": "Bioproben*", - "dataKey": "specimen" + "aggregatedDataKeys": [ + { + "groupCode": "specimen" + }, + { + "stratifierCode": "Histlogoies", + "stratumCode": "1" + }, + { + } + ] } ] }, diff --git a/packages/lib/src/components/results/ResultTableComponent.wc.svelte b/packages/lib/src/components/results/ResultTableComponent.wc.svelte index 74f84675..7eefb569 100644 --- a/packages/lib/src/components/results/ResultTableComponent.wc.svelte +++ b/packages/lib/src/components/results/ResultTableComponent.wc.svelte @@ -10,6 +10,7 @@ import { negotiateStore } from "../../stores/negotiate"; import { getSitePopulationForCode, + getSitePopulationForStratumCode, responseStore, } from "../../stores/response"; import TableItemComponent from "./TableItemComponent.svelte"; @@ -26,7 +27,7 @@ */ let options: any; $: options = ($lensOptions?.tableOptions && $lensOptions?.tableOptions) || { - headerData: [{ title: "", dataKey: "" }], + headerData: [{ title: "", dataKey: "", aggregatedDataKeys: []}], }; $: options?.headerData?.forEach( @@ -49,16 +50,36 @@ let tableRow: (string | number)[] = []; + + options.headerData.forEach( (header: HeaderData, index: number): void => { if (index === 0) { const name = $uiSiteMappingsStore.get(key); tableRow.push(name); - } else { - tableRow.push( - getSitePopulationForCode(value.data, header.dataKey) - ); + return; } + if(header.dataKey) { + tableRow.push(getSitePopulationForCode(value.data, header.dataKey)); + return; + } + + let aggregatedPopulation: number = 0; + + header.aggregatedDataKeys.forEach((dataKey) => { + if(dataKey.groupCode){ + aggregatedPopulation += getSitePopulationForCode(value.data, dataKey.groupCode); + } else if(dataKey.stratifierCode && dataKey.stratumCode) { + aggregatedPopulation += getSitePopulationForStratumCode(value.data, dataKey.stratumCode, dataKey.stratifierCode); + } + /** + * TODO: add support for stratifiers if needed? + * needs to be implemented in response.ts + */ + }); + + tableRow.push(aggregatedPopulation); + } ); diff --git a/packages/lib/src/types/biobanks.ts b/packages/lib/src/types/biobanks.ts index d83b2cf9..3ff2a714 100644 --- a/packages/lib/src/types/biobanks.ts +++ b/packages/lib/src/types/biobanks.ts @@ -1,7 +1,12 @@ export type HeaderData = { title: string; - dataKey: string; + dataKey?: string; + aggregatedDataKeys?: { + groupCode?: string; + stratifierCode?: string; + stratumCode?: string; + }[]; ascending?: boolean; hintText?: string[]; }; \ No newline at end of file From f1af84ab8ad1c545650dac0ba637c9274346d81a Mon Sep 17 00:00:00 2001 From: Mats Johansen Date: Wed, 20 Dec 2023 13:16:43 +0100 Subject: [PATCH 4/5] feat(results components): add documentary --- .../src/components/results/ResultSummaryComponent.wc.svelte | 4 ---- .../src/components/results/ResultTableComponent.wc.svelte | 6 +++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/lib/src/components/results/ResultSummaryComponent.wc.svelte b/packages/lib/src/components/results/ResultSummaryComponent.wc.svelte index 39326fec..85234196 100644 --- a/packages/lib/src/components/results/ResultSummaryComponent.wc.svelte +++ b/packages/lib/src/components/results/ResultSummaryComponent.wc.svelte @@ -17,9 +17,6 @@ import type { ResponseStore } from "../../types/backend"; - /** - * options set in project - */ let options: any = {}; $: options = $lensOptions.resultSummaryOptions @@ -71,7 +68,6 @@ return type; } - /** * if the type has multiple dataKeys to aggregate, the population is the aggregated population of all dataKeys */ diff --git a/packages/lib/src/components/results/ResultTableComponent.wc.svelte b/packages/lib/src/components/results/ResultTableComponent.wc.svelte index 7eefb569..0f7fe5ba 100644 --- a/packages/lib/src/components/results/ResultTableComponent.wc.svelte +++ b/packages/lib/src/components/results/ResultTableComponent.wc.svelte @@ -51,7 +51,11 @@ let tableRow: (string | number)[] = []; - + /** + * builds the table items for each row + * the first item is the name of the collection + * the following items are the population for each data type (single or aggregated) + */ options.headerData.forEach( (header: HeaderData, index: number): void => { if (index === 0) { From a278559b123f1dbcda622d2ced446695e9806b62 Mon Sep 17 00:00:00 2001 From: Mats Johansen Date: Wed, 20 Dec 2023 13:20:26 +0100 Subject: [PATCH 5/5] fix(backend config): comment in other sites --- packages/demo/src/AppCCP.svelte | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/demo/src/AppCCP.svelte b/packages/demo/src/AppCCP.svelte index a4fd888a..08f5f003 100644 --- a/packages/demo/src/AppCCP.svelte +++ b/packages/demo/src/AppCCP.svelte @@ -122,19 +122,19 @@ const backendConfig = { url: (import.meta.env.PROD) ? backendUrl : "http://localhost:8080", backends: [ - // "mannheim", - // "freiburg", - // "muenchen-tum", - // "hamburg", - // "frankfurt", - // "berlin", - // "dresden", + "mannheim", + "freiburg", + "muenchen-tum", + "hamburg", + "frankfurt", + "berlin", + "dresden", "mainz", - // "muenchen-lmu", - // "essen", - // "ulm", - // "wuerzburg", - // "hannover", + "muenchen-lmu", + "essen", + "ulm", + "wuerzburg", + "hannover", ], uiSiteMap: uiSiteMap, catalogueKeyToResponseKeyMap: catalogueKeyToResponseKeyMap,