Skip to content

Commit

Permalink
feat: initial draft
Browse files Browse the repository at this point in the history
  • Loading branch information
tada5hi committed Dec 11, 2024
1 parent 3559031 commit 7d7d5bd
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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<ObjectLiteral>,
},
},
slots: Object as SlotsType<ResourceCollectionSlots<PatientMatchBase>>,
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();
},
});
4 changes: 4 additions & 0 deletions packages/mtb/src/runtime/core/http-client/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@ import type { HTTPClient } from '@dnpm-dip/core';
import {
KaplanMeierAPI,
QueryAPI,
ValidationAPI,
} from '../../domains';

export class MTBAPIClient {
readonly kaplanMeier : KaplanMeierAPI;

readonly query : QueryAPI;

readonly validation : ValidationAPI;

constructor(client: HTTPClient) {
this.kaplanMeier = new KaplanMeierAPI({ client });
this.query = new QueryAPI({ client });
this.validation = new ValidationAPI({ client });
}
}
1 change: 1 addition & 0 deletions packages/mtb/src/runtime/domains/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export * from './kaplan-meier';
export * from './patient';
export * from './permission';
export * from './query';
export * from './validation';
8 changes: 8 additions & 0 deletions packages/mtb/src/runtime/domains/query/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export class QueryAPI extends BaseAPI {
return response.data;
}

// --------------------------------------------------------------------

async getDiagnosisFilter(id: string) : Promise<QueryDiagnosisFilter> {
const response = await this.client.get(`mtb/queries/${id}/filters/diagnosis`);
return response.data;
Expand All @@ -62,6 +64,8 @@ export class QueryAPI extends BaseAPI {
return response.data;
}

// --------------------------------------------------------------------

/**
* Get all patients in the context of a specific query.
* @param id
Expand Down Expand Up @@ -99,6 +103,8 @@ export class QueryAPI extends BaseAPI {
return response.data;
}

// --------------------------------------------------------------------

async getKaplanMeierStatistics(
queryId: string,
type?: string,
Expand Down Expand Up @@ -142,6 +148,8 @@ export class QueryAPI extends BaseAPI {
return response.data;
}

// --------------------------------------------------------------------

private buildRequestQueryString(query?: URLQueryRecord) {
let qs : string = '';
if (typeof query !== 'undefined') {
Expand Down
25 changes: 25 additions & 0 deletions packages/mtb/src/runtime/domains/validation/api.ts
Original file line number Diff line number Diff line change
@@ -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<ResourceCollectionResponse<Record<string, any>>> {
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;
}
}
8 changes: 8 additions & 0 deletions packages/mtb/src/runtime/domains/validation/index.ts
Original file line number Diff line number Diff line change
@@ -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';
26 changes: 26 additions & 0 deletions packages/mtb/src/runtime/pages/validation/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!--
- 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.
-->
<script lang="ts">
import { defineComponent } from 'vue';
import MValidations from '../../components/core/validation/MValidations';

export default defineComponent({
components: { MValidations },
});
</script>
<template>
<div>
<h1 class="title no-border mb-3">
<i class="fa fa-shield" /> Validierung
</h1>
<MValidations>
<template #default="props">
{{ props.data }}
</template>
</MValidations>
</div>
</template>
12 changes: 12 additions & 0 deletions packages/mtb/src/runtime/plugins/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
],
},
},
],
},
);
Expand Down

0 comments on commit 7d7d5bd

Please sign in to comment.