From 847c00454a6943927372e01ec8a796b6f95a5551 Mon Sep 17 00:00:00 2001 From: Paul Bui-Quang Date: Mon, 21 Oct 2024 11:10:23 +0200 Subject: [PATCH] feat: add docref config --- .../CreationCohort/DataList_Criteria.tsx | 4 +- src/config.tsx | 6 ++ src/views/Dashboard/Dashboard.tsx | 55 ++++++++++++------- 3 files changed, 45 insertions(+), 20 deletions(-) diff --git a/src/components/CreationCohort/DataList_Criteria.tsx b/src/components/CreationCohort/DataList_Criteria.tsx index 3fcf1d6d9..e65ae7acf 100644 --- a/src/components/CreationCohort/DataList_Criteria.tsx +++ b/src/components/CreationCohort/DataList_Criteria.tsx @@ -24,6 +24,7 @@ const criteriaList: () => CriteriaItemType[] = () => { const ODD_BIOLOGY = getConfig().features.observation.enabled const ODD_IMAGING = getConfig().features.imaging.enabled const ODD_MEDICATION = getConfig().features.medication.enabled + const ODD_DOCUMENT_REFERENCE = getConfig().features.documentReference.enabled return [ { id: CriteriaType.REQUEST, @@ -71,7 +72,8 @@ const criteriaList: () => CriteriaItemType[] = () => { { id: CriteriaType.DOCUMENTS, title: CriteriaTypeLabels.DOCUMENTS, - color: '#0063AF', + color: ODD_DOCUMENT_REFERENCE ? '#0063AF' : '#808080', + disabled: !ODD_DOCUMENT_REFERENCE, fontWeight: 'bold', components: DocumentsForm, fetch: { diff --git a/src/config.tsx b/src/config.tsx index 88096e7e4..d42062635 100644 --- a/src/config.tsx +++ b/src/config.tsx @@ -53,6 +53,9 @@ type AppConfig = { procedureHierarchy: ValueSetConfig } } + documentReference: { + enabled: boolean + } claim: { enabled: boolean valueSets: { @@ -231,6 +234,9 @@ let config: AppConfig = { procedureHierarchy: { url: '' } } }, + documentReference: { + enabled: true + }, claim: { enabled: true, valueSets: { diff --git a/src/views/Dashboard/Dashboard.tsx b/src/views/Dashboard/Dashboard.tsx index 06dfad30d..6d2af6f45 100644 --- a/src/views/Dashboard/Dashboard.tsx +++ b/src/views/Dashboard/Dashboard.tsx @@ -39,6 +39,7 @@ const Dashboard: React.FC<{ const appConfig = useContext(AppConfig) const ODD_IMAGING = appConfig.features.imaging.enabled const ODD_QUESTIONNAIRES = appConfig.features.questionnaires.enabled + const ODD_DOCUMENT_REFERENCE = appConfig.features.documentReference.enabled const [searchParams] = useSearchParams() const groupIds = getCleanGroupId(searchParams.get('groupId')) @@ -55,15 +56,19 @@ const Dashboard: React.FC<{ case 'patients': setTabs([ // { label: 'Création cohorte', value: 'creation', to: `/cohort/new`, disabled: true }, - { label: 'Aperçu', value: 'preview', to: '/my-patients/preview' }, - { label: 'Patients', value: 'patients', to: '/my-patients/patients' }, - { label: 'Documents', value: 'documents', to: '/my-patients/documents' }, - { label: 'PMSI', value: 'pmsi', to: '/my-patients/pmsi' }, - { label: 'Médicaments', value: 'medication', to: '/my-patients/medication' }, - { label: 'Biologie', value: 'biology', to: '/my-patients/biology' }, - ...(ODD_IMAGING ? [{ label: 'Imagerie', value: 'imaging', to: '/my-patients/imaging' }] : []), + { label: 'Aperçu', value: 'preview', to: '/my-patients/preview', disabled: false }, + { label: 'Patients', value: 'patients', to: '/my-patients/patients', disabled: false }, + ...(ODD_DOCUMENT_REFERENCE + ? [{ label: 'Documents', value: 'documents', to: '/my-patients/documents', disabled: false }] + : []), + { label: 'PMSI', value: 'pmsi', to: '/my-patients/pmsi', disabled: false }, + { label: 'Médicaments', value: 'medication', to: '/my-patients/medication', disabled: false }, + { label: 'Biologie', value: 'biology', to: '/my-patients/biology', disabled: false }, + ...(ODD_IMAGING + ? [{ label: 'Imagerie', value: 'imaging', to: '/my-patients/imaging', disabled: false }] + : []), ...(ODD_QUESTIONNAIRES && !dashboard.deidentifiedBoolean - ? [{ label: 'Formulaires', value: 'forms', to: `/my-patients/forms` }] + ? [{ label: 'Formulaires', value: 'forms', to: `/my-patients/forms`, disabled: false }] : []) ]) break @@ -76,11 +81,16 @@ const Dashboard: React.FC<{ }, { label: 'Aperçu cohorte', value: 'preview', to: `/cohort/preview?groupId=${groupIds}` }, { label: 'Données patient', value: 'patients', to: `/cohort/patients${location.search}` }, - { - label: 'Documents cliniques', - value: 'documents', - to: `/cohort/documents${location.search}` - }, + ...(ODD_DOCUMENT_REFERENCE + ? [ + { + label: 'Documents cliniques', + value: 'documents', + to: `/cohort/documents${location.search}`, + disabled: false + } + ] + : []), { label: 'PMSI', value: 'pmsi', to: `/cohort/pmsi${location.search}` }, { label: 'Médicaments', value: 'medication', to: `/cohort/medication${location.search}` }, { label: 'Biologie', value: 'biology', to: `/cohort/biology${location.search}` }, @@ -95,7 +105,9 @@ const Dashboard: React.FC<{ // { label: 'Création cohorte', value: 'creation', to: `/cohort/new`, disabled: true }, { label: 'Aperçu cohorte', value: 'preview', to: `/cohort/new/preview`, disabled: true }, { label: 'Données patient', value: 'patients', to: `/cohort/new/patients`, disabled: true }, - { label: 'Documents cliniques', value: 'documents', to: `/cohort/new/documents`, disabled: true }, + ...(ODD_DOCUMENT_REFERENCE + ? [{ label: 'Documents cliniques', value: 'documents', to: `/cohort/new/documents`, disabled: true }] + : []), { label: 'PMSI', value: 'pmsi', to: `/cohort/new/pmsi` }, { label: 'Médicaments', value: 'medication', to: `/cohort/new/medication` }, { label: 'Biologie', value: 'biology', to: `/cohort/new/biology` }, @@ -114,11 +126,16 @@ const Dashboard: React.FC<{ value: 'patients', to: `/perimeters/patients${location.search}` }, - { - label: 'Documents cliniques', - value: 'documents', - to: `/perimeters/documents${location.search}` - }, + ...(ODD_DOCUMENT_REFERENCE + ? [ + { + label: 'Documents cliniques', + value: 'documents', + to: `/perimeters/documents${location.search}`, + disabled: false + } + ] + : []), { label: 'PMSI', value: 'pmsi', to: `/perimeters/pmsi${location.search}` }, { label: 'Médicaments',