Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(options): move catalog response key map #121

Merged
merged 3 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ services:

spot:
image: samply/rustyspot:main
platform: linux/amd64
ports:
- "8055:8055"
environment:
Expand Down Expand Up @@ -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}
Expand Down
60 changes: 30 additions & 30 deletions packages/demo/public/options-ccp-demo.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -237,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"
]
]
}
]
Expand Down
60 changes: 30 additions & 30 deletions packages/demo/public/options-ccp-prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -232,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"
]
]
}
]
Expand Down
96 changes: 33 additions & 63 deletions packages/demo/public/options-dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -239,75 +269,15 @@
"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"
]
]
}
],
"blazes": [
{
"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"
}
]
}
}
}
14 changes: 13 additions & 1 deletion packages/lib/src/components/Options.wc.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [];
Expand Down Expand Up @@ -123,6 +126,15 @@
return mappings;
});

$: catalogueKeyToResponseKeyMap.update((mappings) => {
if (!options?.catalogueKeyToResponseKeyMap) return mappings;

options.catalogueKeyToResponseKeyMap.forEach((mapping) => {
mappings.set(mapping[0], mapping[1]);
});
return mappings;
});

$: $lensOptions = options;
$: updateIconStore(options);
$: $catalogue = catalogueData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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.
Expand Down
Loading
Loading