Skip to content

Commit

Permalink
Merge pull request #147 from samply/develop
Browse files Browse the repository at this point in the history
Release 0.4.3
  • Loading branch information
patrickskowronekdkfz authored Oct 30, 2024
2 parents dbad8c1 + 33c9c95 commit 2b251f0
Show file tree
Hide file tree
Showing 16 changed files with 561 additions and 447 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@samply/lens",
"description": "A web component library for clinical data search and visualisation",
"version": "0.4.2",
"version": "0.4.3",
"type": "module",
"module": "dist/lens.js",
"main": "dist/lens.umd.js",
Expand Down
72 changes: 72 additions & 0 deletions packages/demo/public/options-ccp-demo.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"wuerzburg": "Würzburg",
"mannheim": "Mannheim",
"dktk-test": "DKTK-Test",
"dktk-datashield-test": "DKTK Datashield Test",
"hamburg": "Hamburg"
},
"catalogueKeyToResponseKeyMap": [
Expand Down Expand Up @@ -70,6 +71,8 @@
"ulm": "Ulm",
"wuerzburg": "Würzburg",
"mannheim": "Mannheim",
"dktk-test": "DKTK-Test",
"dktk-datashield-test": "DKTK Datashield Test",
"hamburg": "Hamburg"
}
},
Expand Down Expand Up @@ -260,6 +263,8 @@
"backendMeasures": "DKTK_STRAT_DEF_IN_INITIAL_POPULATION",
"url": "https://backend.demo.lens.samply.de/prod/",
"sites": [
"dktk-test",
"dktk-datashield-test",
"berlin",
"berlin-test",
"dresden",
Expand All @@ -277,5 +282,72 @@
]
}
]
},
"negotiateOptions": {
"negotiateApp": "project-manager",
"newProjectUrl": "https://e260-ccp-req/project-manager/create-query-and-design-project",
"editProjectUrl": "https://e260-ccp-req/project-manager/edit-project",
"siteMapping": [
{
"site": "dktk-test",
"collection": "lens-dktk-test"
},
{
"site": "dktk-datashield-test",
"collection": "lens-dktk-datashield-test"
},
{
"site": "Berlin",
"collection": "lens-berlin"
},
{
"site": "Dresden",
"collection": "lens-dresden"
},
{
"site": "Essen",
"collection": "lens-essen"
},
{
"site": "Frankfurt",
"collection": "lens-frankfurt"
},
{
"site": "Freiburg",
"collection": "lens-freiburg"
},
{
"site": "Hannover",
"collection": "lens-hannover"
},
{
"site": "Mainz",
"collection": "lens-mainz"
},
{
"site": "München LMU",
"collection": "lens-muenchen-lmu"
},
{
"site": "München TUM",
"collection": "lens-muenchen-tum"
},
{
"site": "Ulm",
"collection": "lens-ulm"
},
{
"site": "Würzburg",
"collection": "lens-wuerzburg"
},
{
"site": "Mannheim",
"collection": "lens-mannheim"
},
{
"site": "Hamburg",
"collection": "lens-hamburg"
}
]
}
}
2 changes: 0 additions & 2 deletions packages/demo/src/AppCCP.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@
<lens-search-modified-display
>Diagramme repräsentieren nicht mehr die aktuelle Suche!</lens-search-modified-display
>
<!-- TODO: comment in when backend is ready -->
<!-- <lens-negotiate-button /> -->
</div>
<div class="chart-wrapper">
<lens-chart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import {
getHumanReadableQuery,
buildHumanReadableRecursively,
} from "../../stores/negotiate";
} from "../../stores/datarequests";
import { returnNestedValues } from "../../helpers/ast-transformer";
import type { AstElement } from "../../types/ast";
import type { QueryItem } from "../../types/queryData";
Expand All @@ -33,6 +33,10 @@
};
const displayQueryInfo = (e: MouseEvent, queryItem?: QueryItem): void => {
if (typeof message == "string") {
message = message.split(",");
}
const target: HTMLElement = e.target as HTMLElement;
if (showQuery) {
if (onlyChildInfo && queryItem !== undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
/>

<script lang="ts">
import { negotiate, negotiateStore } from "../../stores/negotiate";
import { datarequestsStore } from "../../stores/datarequests";
import { negotiate } from "../../services/bbmriNegotiate.ts";
export let title: string = "Negotiate with biobanks";
let disabled: boolean = false;
</script>

<button
part={`lens-negotiate-button lens-negotiate-button-${
disabled ? "disabled" : "active"
$datarequestsStore.length === 0 ? "disabled" : "active"
}`}
on:click={() => negotiate($negotiateStore)}
{disabled}
on:click={() => negotiate($datarequestsStore)}
disabled={$datarequestsStore.length === 0}
>
<div part="lens-negotiate-button-title">
{title}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@
const ast = buildAstFromQuery($queryStore);
if (ast.children.includes(null)) {
alert(
"No query entered in one of the queries. You can enter a query or remove the query fields.",
);
return;
}
options?.spots?.forEach((spot: SpotOption) => {
const name = spot.name;
const measureItem: MeasureOption | undefined = $measureStore.find(
Expand Down
9 changes: 9 additions & 0 deletions packages/lib/src/components/results/ChartComponent.wc.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@
): ChartDataSets => {
let dataSet: number[];
// This is bad. For some reason the passed value is a string not a array of strings. With this conversion it does work!
if (typeof backgroundColor == "string") {
backgroundColor = backgroundColor.split(",");
}
if (perSite) {
dataSet = chartLabels.map((label: string) => {
const site: Site | undefined = responseStore.get(label);
Expand Down Expand Up @@ -431,6 +436,10 @@
chart.data.datasets = chartData.data;
chartLabels = chartData.labels;
if (typeof groupRange == "string") {
groupRange = Number(groupRange);
}
/**
* lets the user define a range for the labels when only single values are used eg. '60' -> '60 - 69'
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<script lang="ts">
import { uiSiteMappingsStore } from "../../stores/mappings";
import { negotiateStore } from "../../stores/negotiate";
import { datarequestsStore } from "../../stores/datarequests.ts";
import {
getSitePopulationForCode,
getSitePopulationForStratumCode,
Expand Down Expand Up @@ -134,21 +134,21 @@
);
/**
* watches the negotiateStore for changes to check or uncheck the checkbox
* watches the datarequestsStore for changes to check or uncheck the checkbox
*/
let allChecked: boolean = false;
$: allChecked =
$negotiateStore.length === tableRowData.length &&
$datarequestsStore.length === tableRowData.length &&
tableRowData.length !== 0;
/**
* checks or unchecks all biobanks
*/
const checkAllBiobanks = (): void => {
if (allChecked) {
$negotiateStore = [];
$datarequestsStore = [];
} else {
$negotiateStore = tableRowData.map(
$datarequestsStore = tableRowData.map(
(tableRow: (string | number)[]) => tableRow[0] as string,
);
}
Expand Down
8 changes: 4 additions & 4 deletions packages/lib/src/components/results/TableItemComponent.svelte
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<script lang="ts">
import { negotiateStore } from "../../stores/negotiate";
import { datarequestsStore } from "../../stores/datarequests";
export let tableRow: (string | number)[];
let checked: boolean = false;
$: checked = $negotiateStore.includes(tableRow[0] as string);
$: checked = $datarequestsStore.includes(tableRow[0] as string);
/**
* adds and removes tableRows from the negotiateStore whenever the checkbox is checked or unchecked
*/
const updateStoreOnCheck = (): void => {
if (!checked) {
negotiateStore.update((store: string[]) => {
datarequestsStore.update((store: string[]) => {
return [...store, tableRow[0] as string];
});
}
if (checked) {
negotiateStore.update((store: string[]) => {
datarequestsStore.update((store: string[]) => {
return store.filter((site: string) => site !== tableRow[0]);
});
}
Expand Down
Loading

0 comments on commit 2b251f0

Please sign in to comment.