Skip to content

Commit

Permalink
refactor: Change of route Composition by DocumentReference Ref gestio…
Browse files Browse the repository at this point in the history
…n-de-projet#1489
  • Loading branch information
Mehdi-BOUYAHIA committed Apr 6, 2023
1 parent 6739a98 commit f4c3197
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -331,13 +331,13 @@ const CriteriaCardContent: React.FC<CriteriaCardContentProps> = ({ currentCriter
label={
<Tooltip
title={`Contient ${_currentCriteria.search} dans le ${
_currentCriteria.searchBy === SearchByTypes.title && 'titre du'
_currentCriteria.searchBy === SearchByTypes.description && 'titre du'
}
document`}
>
<Typography style={{ maxWidth: 500 }} noWrap>
Contient "{_currentCriteria.search}" dans le
{_currentCriteria.searchBy === SearchByTypes.title && ' titre du'} document
{_currentCriteria.searchBy === SearchByTypes.description && ' titre du'} document
</Typography>
</Tooltip>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ const CompositionForm: React.FC<TestGeneratedFormProps> = (props) => {
label="Rechercher dans :"
>
<MenuItem value={SearchByTypes.text}>Corps du document</MenuItem>
<MenuItem value={SearchByTypes.title}>Titre du document</MenuItem>
<MenuItem value={SearchByTypes.description}>Titre du document</MenuItem>
</Select>
</FormControl>

Expand Down
2 changes: 1 addition & 1 deletion src/components/DataTable/DataTableTopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ const DataTableTopBar: React.FC<DataTableTopBarProps> = ({ loading, tabs, result
style={{ height: 42 }}
>
<MenuItem value={SearchByTypes.text}>Corps du document</MenuItem>
<MenuItem value={SearchByTypes.title}>Titre du document</MenuItem>
<MenuItem value={SearchByTypes.description}>Titre du document</MenuItem>
</Select>
</FormControl>
)}
Expand Down
1 change: 1 addition & 0 deletions src/components/DocumentViewer/DocumentViewer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useState, useEffect } from 'react'
import { Buffer } from 'buffer'

import { IDocumentReference } from '@ahryman40k/ts-fhir-types/lib/R4'

Expand Down
4 changes: 1 addition & 3 deletions src/services/aphp/callApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ export const fetchComposition = async (args: fetchCompositionProps) => {
if (_sort) options = [...options, `_sort=${_sortDirection}${_sort},id`] // eslint-disable-line
if (type) options = [...options, `type=${type}`] // eslint-disable-line
if (_text)
options = [...options, `${searchBy === SearchByTypes.text ? `_text` : 'title'}=${encodeURIComponent(_text)}`] // eslint-disable-line
options = [...options, `${searchBy === SearchByTypes.text ? `_text` : 'description'}=${encodeURIComponent(_text)}`] // eslint-disable-line
if (status) options = [...options, `docstatus=${status}`] // eslint-disable-line
if (patient) options = [...options, `patient=${patient}`] // eslint-disable-line
if (patientIdentifier) options = [...options, `patient.identifier=${patientIdentifier}`] // eslint-disable-line
Expand All @@ -291,8 +291,6 @@ export const fetchComposition = async (args: fetchCompositionProps) => {
{ signal: signal }
)

console.log('response', response)

return response
}

Expand Down
4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export enum SearchByTypes {
family = 'family',
given = 'given',
identifier = 'identifier',
title = 'title'
description = 'description'
}

export enum VitalStatus {
Expand Down Expand Up @@ -450,7 +450,7 @@ export type DocumentDataType = {
title: string
type: 'Composition'
search: string
searchBy: SearchByTypes.text | SearchByTypes.title
searchBy: SearchByTypes.text | SearchByTypes.description
docType: DocType[] | null
encounterEndDate: Date | ''
encounterStartDate: Date | ''
Expand Down
4 changes: 2 additions & 2 deletions src/utils/cohortCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const CONDITION_TYPE = 'type' // ok

const RESSOURCE_TYPE_COMPOSITION: 'Composition' = 'Composition'
const COMPOSITION_TEXT = '_text' // ok
const COMPOSITION_TITLE = 'title'
const COMPOSITION_TITLE = 'description' // ok
const COMPOSITION_TYPE = 'type' // ok

const RESSOURCE_TYPE_MEDICATION_REQUEST: 'MedicationRequest' = 'MedicationRequest' // = Prescription
Expand Down Expand Up @@ -1058,7 +1058,7 @@ export async function unbuildRequest(_json: string) {
switch (key) {
case COMPOSITION_TITLE:
currentCriterion.search = value ? decodeURIComponent(value) : ''
currentCriterion.searchBy = SearchByTypes.title
currentCriterion.searchBy = SearchByTypes.description
break
case COMPOSITION_TEXT: {
currentCriterion.search = value ? decodeURIComponent(value) : ''
Expand Down

0 comments on commit f4c3197

Please sign in to comment.