From 7d7d5bde2ba37e47fbe7895bb0592f379f6bd189 Mon Sep 17 00:00:00 2001 From: tada5hi Date: Wed, 11 Dec 2024 10:13:10 +0100 Subject: [PATCH] feat: initial draft --- .../core/validation/MValidations.ts | 42 +++++++++++++++++++ .../src/runtime/core/http-client/module.ts | 4 ++ packages/mtb/src/runtime/domains/index.ts | 1 + packages/mtb/src/runtime/domains/query/api.ts | 8 ++++ .../mtb/src/runtime/domains/validation/api.ts | 25 +++++++++++ .../src/runtime/domains/validation/index.ts | 8 ++++ .../src/runtime/pages/validation/index.vue | 26 ++++++++++++ packages/mtb/src/runtime/plugins/register.ts | 12 ++++++ 8 files changed, 126 insertions(+) create mode 100644 packages/mtb/src/runtime/components/core/validation/MValidations.ts create mode 100644 packages/mtb/src/runtime/domains/validation/api.ts create mode 100644 packages/mtb/src/runtime/domains/validation/index.ts create mode 100644 packages/mtb/src/runtime/pages/validation/index.vue diff --git a/packages/mtb/src/runtime/components/core/validation/MValidations.ts b/packages/mtb/src/runtime/components/core/validation/MValidations.ts new file mode 100644 index 00000000..c37b356d --- /dev/null +++ b/packages/mtb/src/runtime/components/core/validation/MValidations.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024. + * Author Peter Placzek (tada5hi) + * For the full copyright and license information, + * view the LICENSE file that was distributed with this source code. + */ + +import type { ObjectLiteral, PatientMatchBase, ResourceCollectionSlots } from '@dnpm-dip/core'; +import { createResourceCollectionManager } from '@dnpm-dip/core'; +import type { PropType, SlotsType } from 'vue'; +import { defineComponent, toRef } from 'vue'; +import { injectHTTPClient } from '../../../core/http-client'; + +export default defineComponent({ + props: { + filters: { + type: Object as PropType, + }, + }, + slots: Object as SlotsType>, + setup(props, setup) { + const api = injectHTTPClient(); + + const filters = toRef(props, 'filters'); + + const manager = createResourceCollectionManager({ + load: async () => { + const response = await api.validation.getValidationReport(); + + return { + data: response.entries, + total: response.size, + }; + }, + slots: setup.slots, + expose: setup.expose, + filters, + }); + + return () => manager.render(); + }, +}); diff --git a/packages/mtb/src/runtime/core/http-client/module.ts b/packages/mtb/src/runtime/core/http-client/module.ts index 5bd52b54..bb5259f3 100644 --- a/packages/mtb/src/runtime/core/http-client/module.ts +++ b/packages/mtb/src/runtime/core/http-client/module.ts @@ -2,6 +2,7 @@ import type { HTTPClient } from '@dnpm-dip/core'; import { KaplanMeierAPI, QueryAPI, + ValidationAPI, } from '../../domains'; export class MTBAPIClient { @@ -9,8 +10,11 @@ export class MTBAPIClient { readonly query : QueryAPI; + readonly validation : ValidationAPI; + constructor(client: HTTPClient) { this.kaplanMeier = new KaplanMeierAPI({ client }); this.query = new QueryAPI({ client }); + this.validation = new ValidationAPI({ client }); } } diff --git a/packages/mtb/src/runtime/domains/index.ts b/packages/mtb/src/runtime/domains/index.ts index 9df92af2..02245fd2 100644 --- a/packages/mtb/src/runtime/domains/index.ts +++ b/packages/mtb/src/runtime/domains/index.ts @@ -3,3 +3,4 @@ export * from './kaplan-meier'; export * from './patient'; export * from './permission'; export * from './query'; +export * from './validation'; diff --git a/packages/mtb/src/runtime/domains/query/api.ts b/packages/mtb/src/runtime/domains/query/api.ts index d602cea2..d2781b7b 100644 --- a/packages/mtb/src/runtime/domains/query/api.ts +++ b/packages/mtb/src/runtime/domains/query/api.ts @@ -47,6 +47,8 @@ export class QueryAPI extends BaseAPI { return response.data; } + // -------------------------------------------------------------------- + async getDiagnosisFilter(id: string) : Promise { const response = await this.client.get(`mtb/queries/${id}/filters/diagnosis`); return response.data; @@ -62,6 +64,8 @@ export class QueryAPI extends BaseAPI { return response.data; } + // -------------------------------------------------------------------- + /** * Get all patients in the context of a specific query. * @param id @@ -99,6 +103,8 @@ export class QueryAPI extends BaseAPI { return response.data; } + // -------------------------------------------------------------------- + async getKaplanMeierStatistics( queryId: string, type?: string, @@ -142,6 +148,8 @@ export class QueryAPI extends BaseAPI { return response.data; } + // -------------------------------------------------------------------- + private buildRequestQueryString(query?: URLQueryRecord) { let qs : string = ''; if (typeof query !== 'undefined') { diff --git a/packages/mtb/src/runtime/domains/validation/api.ts b/packages/mtb/src/runtime/domains/validation/api.ts new file mode 100644 index 00000000..e370962f --- /dev/null +++ b/packages/mtb/src/runtime/domains/validation/api.ts @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2024. + * Author Peter Placzek (tada5hi) + * For the full copyright and license information, + * view the LICENSE file that was distributed with this source code. + */ + +import { BaseAPI, type ResourceCollectionResponse } from '@dnpm-dip/core'; + +export class ValidationAPI extends BaseAPI { + async getValidationReport() : Promise>> { + const response = await this.client.get('mtb/validation/infos'); + return response.data; + } + + async getValidationPatientReport(id: string) { + const response = await this.client.get(`mtb/validation/report/${id}`); + return response.data; + } + + async getValidationPatientRecord(id: string) { + const response = await this.client.get(`mtb/validation/patient-record/${id}`); + return response.data; + } +} diff --git a/packages/mtb/src/runtime/domains/validation/index.ts b/packages/mtb/src/runtime/domains/validation/index.ts new file mode 100644 index 00000000..c4745276 --- /dev/null +++ b/packages/mtb/src/runtime/domains/validation/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright (c) 2024. + * Author Peter Placzek (tada5hi) + * For the full copyright and license information, + * view the LICENSE file that was distributed with this source code. + */ + +export * from './api'; diff --git a/packages/mtb/src/runtime/pages/validation/index.vue b/packages/mtb/src/runtime/pages/validation/index.vue new file mode 100644 index 00000000..8727254c --- /dev/null +++ b/packages/mtb/src/runtime/pages/validation/index.vue @@ -0,0 +1,26 @@ + + + diff --git a/packages/mtb/src/runtime/plugins/register.ts b/packages/mtb/src/runtime/plugins/register.ts index 7e3eec93..9991168f 100644 --- a/packages/mtb/src/runtime/plugins/register.ts +++ b/packages/mtb/src/runtime/plugins/register.ts @@ -38,6 +38,18 @@ export default defineNuxtPlugin({ ], }, }, + { + name: 'Validierung', + icon: 'fas fa-shield', + url: 'validation', + meta: { + [PageMetaKey.REQUIRED_PERMISSIONS]: [ + PermissionName.VALIDATION_INFO_READ, + PermissionName.VALIDATION_REPORT_READ, + PermissionName.VALIDATION_PATIENT_RECORD_READ, + ], + }, + }, ], }, );