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/data request/project manager #162

Open
wants to merge 12 commits into
base: rc1
Choose a base branch
from
4,043 changes: 654 additions & 3,389 deletions packages/demo/public/catalogues/catalogue-dktk-with-mol-markers.json

Large diffs are not rendered by default.

19 changes: 11 additions & 8 deletions packages/demo/public/options-ccp-demo.json
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,12 @@
}
]
},
"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": [
"projectmanagerOptions": {
"newProjectUrl": "https://requests.dktk.dkfz.de/project-manager-api/create-query-and-design-project",
"editProjectUrl": "https://requests.dktk.dkfz.de/project-manager-api/edit-project",
"siteMappings": [
{
"site": "dktk-test",
"site": "DKTK-Test",
"collection": "lens-dktk-test"
},
{
Expand All @@ -300,6 +299,10 @@
"site": "Berlin",
"collection": "lens-berlin"
},
{
"site": "Berlin (OBDS)",
"collection": "lens-berlin"
},
{
"site": "Dresden",
"collection": "lens-dresden"
Expand All @@ -325,11 +328,11 @@
"collection": "lens-mainz"
},
{
"site": "München LMU",
"site": "München(LMU)",
"collection": "lens-muenchen-lmu"
},
{
"site": "München TUM",
"site": "München(TUM)",
"collection": "lens-muenchen-tum"
},
{
Expand Down
2 changes: 1 addition & 1 deletion packages/demo/public/options-dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@
"negotiateApp": "project-manager",
"newProjectUrl": "http://localhost:8097/create-query-and-design-project",
"editProjectUrl": "http://localhost:8097/edit-project",
"siteMapping": [
"siteMappings": [
{
"site": "Dresden",
"collection": "dresden"
Expand Down
6 changes: 5 additions & 1 deletion packages/demo/src/AppCCP.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
catalogueUrl = "catalogues/catalogue-dktk.json";
optionsFilePath = "options-ccp-prod.json";
} else {
catalogueUrl = "catalogues/catalogue-dktk-staging.json";
catalogueUrl = "catalogues/catalogue-dktk-with-mol-markers.json";
optionsFilePath = "options-ccp-demo.json";
}

Expand Down Expand Up @@ -157,6 +157,10 @@
<div class="charts">
<div class="chart-wrapper result-summary">
<lens-result-summary />
<lens-negotiate-button
type={"ccp"}
title={"Daten und Proben Anfragen"}
></lens-negotiate-button>
<lens-search-modified-display
>Diagramme repräsentieren nicht mehr die aktuelle Suche!</lens-search-modified-display
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,29 @@

<script lang="ts">
import { datarequestsStore } from "../../stores/datarequests";
import { negotiate } from "../../services/bbmriNegotiate.ts";

export let title: string = "Negotiate with biobanks";
export let type: string;
import { negotiate } from "../../services/ccpProjectManager.ts";
import { bbmrinegotiate } from "../../services/bbmriNegotiate.ts";

/**
*
*/
function exec(): void {
if (type == "bbmri") {
bbmrinegotiate($datarequestsStore);
} else if (type == "ccp") {
negotiate($datarequestsStore);
}
}
</script>

<button
part={`lens-negotiate-button lens-negotiate-button-${
$datarequestsStore.length === 0 ? "disabled" : "active"
}`}
on:click={() => negotiate($datarequestsStore)}
on:click={exec}
disabled={$datarequestsStore.length === 0}
>
<div part="lens-negotiate-button-title">
Expand Down
12 changes: 7 additions & 5 deletions packages/lib/src/services/bbmriNegotiate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { v4 as uuidv4 } from "uuid";
import type { QueryItem, SendableQuery } from "../types/queryData";
import type {
LensOptions,
NegotiateOptions,
NegotiaterOptions,
NegotiateOptionsSiteMapping,
} from "../types/options";
import { getHumanReadableQuery } from "../stores/datarequests";
Expand All @@ -17,7 +17,7 @@ type NegotiatorResponse = Response & {
status: number;
};

let negotiateOptions: NegotiateOptions;
let negotiateOptions: NegotiaterOptions;
const siteCollectionMap: Map<string, NegotiateOptionsSiteMapping> = new Map();

lensOptions.subscribe((options: LensOptions) => {
Expand All @@ -28,7 +28,7 @@ lensOptions.subscribe((options: LensOptions) => {
* need to know how multiple collections are returned from the backend
*/

negotiateOptions = options.negotiateOptions as NegotiateOptions;
negotiateOptions = options.negotiateOptions as NegotiaterOptions;
negotiateOptions?.siteMappings?.forEach((site) => {
siteCollectionMap.set(site.site, site);
});
Expand Down Expand Up @@ -59,7 +59,9 @@ export const getCollections = (
* redirects to negotiator
* @param sitesToNegotiate the sites to negotiate with
*/
export const negotiate = async (sitesToNegotiate: string[]): Promise<void> => {
export const bbmrinegotiate = async (
sitesToNegotiate: string[],
): Promise<void> => {
let sendableQuery!: SendableQuery;
queryStore.subscribe((value: QueryItem[][]) => {
const uuid = uuidv4();
Expand Down Expand Up @@ -153,7 +155,7 @@ async function sendRequestToNegotiator(
});

try {
response = await fetch(`${negotiateOptions.newProjectUrl}`, {
response = await fetch(`${negotiateOptions.url}`, {
method: "POST",
headers: {
Accept: "application/json; charset=utf-8",
Expand Down
Loading