Skip to content

Commit

Permalink
feat: adding AREM in data visualisation and requestor - Ref gestion-d…
Browse files Browse the repository at this point in the history
…e-projet#2183 (#911)

* feat: adding Arem visualisation on exploration - Ref gestion-de-projet#2183

* feat: add AREM adaptation for requestor - Ref gestion-de-projet#2279

* feat: add info on source ORBIS-AREM - Ref gestion-de-projet#2279
  • Loading branch information
Mehdi-BOUYAHIA authored Nov 30, 2023
1 parent a8e69c3 commit def2646
Show file tree
Hide file tree
Showing 18 changed files with 172 additions and 58 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
import React, { useState } from 'react'

import { Alert, Button, Divider, FormLabel, Grid, IconButton, Link, Switch, TextField, Typography } from '@mui/material'
import {
Alert,
Button,
Divider,
FormLabel,
Grid,
IconButton,
Link,
Switch,
TextField,
Typography,
Radio,
RadioGroup,
FormControlLabel
} from '@mui/material'

import KeyboardBackspaceIcon from '@mui/icons-material/KeyboardBackspace'

Expand Down Expand Up @@ -129,6 +143,28 @@ const CcamForm: React.FC<CcamFormProps> = (props) => {
onChangeValue={onChangeValue}
/>

<Grid style={{ display: 'flex' }}>
<RadioGroup
row
style={{ justifyContent: 'space-around' }}
className={classes.inputItem}
aria-label="mode"
name="criteria-mode-radio"
value={currentState.source}
onChange={(e, value) => onChangeValue('source', value)}
>
<FormControlLabel value="AREM" control={<Radio color="secondary" />} label="AREM" />
<FormControlLabel value="ORBIS" control={<Radio color="secondary" />} label="ORBIS" />
</RadioGroup>
</Grid>

<Grid>
<Alert severity="info">
Les données PMSI d'Obris sont codées au quotidien par les médecins. Les données PMSI AREM sont validées,
remontées aux tutelles et disponibles dans le SNDS.
</Alert>
</Grid>

<InputAutocompleteAsync
multiple
label="Codes d'actes CCAM"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const defaultProcedure = {
type: RessourceType.PROCEDURE,
title: "Critères d'actes CCAM",
code: [],
source: 'AREM',
occurrence: 1,
occurrenceComparator: '>=',
startOccurrence: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ const DemographicForm = (props: DemographicFormProps) => {
const [multiFields, setMultiFields] = useState<string | null>(localStorage.getItem('multiple_fields'))
const isEdition = selectedCriteria !== null ? true : false

console.log('test error', error)

useEffect(() => {
setError(Error.NO_ERROR)
const _age0 = convertStringToDuration(age[0])
Expand Down
24 changes: 12 additions & 12 deletions src/components/DataTable/DataTablePmsi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const DataTablePmsi: React.FC<DataTablePmsiProps> = ({
const columns = [
{ label: `NDA${deidentified ? ' chiffré' : ''}`, code: '', align: 'left', sortableColumn: false },
{ label: 'Codage le', code: Order.DATE, align: 'center', sortableColumn: true },
{ label: 'source', code: '', align: 'center', sortableColumn: false },
{ label: 'Code', code: Order.CODE, align: 'center', sortableColumn: true },
{ label: 'Libellé', code: '', align: 'center', sortableColumn: false },
selectedTab === PMSI.DIAGNOSTIC ? { label: 'Type', code: '', align: 'center', sortableColumn: false } : null,
Expand Down Expand Up @@ -101,16 +102,12 @@ const DataTablePmsiLine: React.FC<{
? new Date(pmsi.performedDateTime).toLocaleDateString('fr-FR') ?? 'Date inconnue'
: 'Date inconnue'

const code =
pmsi.resourceType === 'Claim'
? pmsi.diagnosis?.[0].packageCode?.coding?.[0].code
: // @ts-ignore TODO: There is no class member in Conditon or Procedure FHIR types
pmsi.class?.code || pmsi.code?.coding?.[0].code
const libelle =
pmsi.resourceType === 'Claim'
? pmsi.diagnosis?.[0].packageCode?.coding?.[0].display
: // @ts-ignore TODO: There is no class member in Conditon or Procedure FHIR types
pmsi.class?.code || pmsi.code?.coding?.[0].display
const filterCode = pmsi.resourceType === 'Claim' ? pmsi.diagnosis?.[0]?.packageCode : pmsi.code

const codeToDisplay = filterCode?.coding?.find((code) => code.userSelected === true)

const source = pmsi.meta?.source ?? 'Non renseigné'

const type = pmsi.extension ? pmsi.extension[0].valueCodeableConcept?.coding?.[0].code?.toUpperCase() : '-'
const serviceProvider = pmsi.serviceProvider ?? 'Non renseigné'

Expand All @@ -119,10 +116,13 @@ const DataTablePmsiLine: React.FC<{
<TableCell align="left">{nda ?? 'Inconnu'}</TableCell>
<TableCell align="center">{date}</TableCell>
<TableCell align="center">
<Typography className={classes.libelle}>{code}</Typography>
<Typography className={classes.libelle}>{source}</Typography>
</TableCell>
<TableCell align="center">
<Typography className={classes.libelle}>{codeToDisplay?.code}</Typography>
</TableCell>
<TableCell align="center">
<Typography className={classes.libelle}>{libelle}</Typography>
<Typography className={classes.libelle}>{codeToDisplay?.display}</Typography>
</TableCell>
{selectedTab === PMSI.DIAGNOSTIC && <TableCell align="center">{type}</TableCell>}
<TableCell align="center">{serviceProvider ?? '-'}</TableCell>
Expand Down
37 changes: 37 additions & 0 deletions src/components/Filters/SourceFilter/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React, { useContext, useEffect, useState } from 'react'
import { RadioGroup, Radio, FormControlLabel, Typography } from '@mui/material'
import { InputWrapper } from 'components/ui/Inputs'
import { FormContext } from 'components/ui/Modal'

type SourceFilterProps = {
value: string
name: string
}

const SourceFilter = ({ name, value }: SourceFilterProps) => {
const context = useContext(FormContext)
const [source, setSource] = useState(value)

useEffect(() => {
if (context?.updateFormData) context.updateFormData(name, source)
}, [source])

return (
<InputWrapper>
<Typography variant="h3">Source :</Typography>
<RadioGroup
row
style={{ justifyContent: 'space-around' }}
aria-label="mode"
name="criteria-mode-radio"
value={source}
onChange={(e) => setSource((e.target as HTMLInputElement).value)}
>
<FormControlLabel value="AREM" control={<Radio color="secondary" />} label="AREM" />
<FormControlLabel value="ORBIS" control={<Radio color="secondary" />} label="ORBIS" />
</RadioGroup>
</InputWrapper>
)
}

export default SourceFilter
36 changes: 19 additions & 17 deletions src/components/Patient/PatientBiology/PatientBiology.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,23 +151,25 @@ const PatientBiology = ({ groupId }: PatientBiologyProps) => {
<Button width={'25%'} icon={<FilterList height="15px" fill="#FFF" />} onClick={() => setToggleModal(true)}>
Filtrer
</Button>
<Modal
title="Filtrer par :"
open={toggleModal}
width={'600px'}
onClose={() => setToggleModal(false)}
onSubmit={(newFilters) => addFilters({ ...filters, ...newFilters })}
>
{!searchResults.deidentified && <NdaFilter name={FilterKeys.NDA} value={nda} />}
<AnabioFilter name={FilterKeys.ANABIO} value={anabio} />
<LoincFilter name={FilterKeys.LOINC} value={loinc} />
<DatesRangeFilter values={[startDate, endDate]} names={[FilterKeys.START_DATE, FilterKeys.END_DATE]} />
<ExecutiveUnitsFilter
value={executiveUnits}
name={FilterKeys.EXECUTIVE_UNITS}
criteriaName={CriteriaName.Biology}
/>
</Modal>
{toggleModal && (
<Modal
title="Filtrer par :"
open={toggleModal}
width={'600px'}
onClose={() => setToggleModal(false)}
onSubmit={(newFilters) => addFilters({ ...filters, ...newFilters })}
>
{!searchResults.deidentified && <NdaFilter name={FilterKeys.NDA} value={nda} />}
<AnabioFilter name={FilterKeys.ANABIO} value={anabio} />
<LoincFilter name={FilterKeys.LOINC} value={loinc} />
<DatesRangeFilter values={[startDate, endDate]} names={[FilterKeys.START_DATE, FilterKeys.END_DATE]} />
<ExecutiveUnitsFilter
value={executiveUnits}
name={FilterKeys.EXECUTIVE_UNITS}
criteriaName={CriteriaName.Biology}
/>
</Modal>
)}
</Grid>
</Searchbar>
</Grid>
Expand Down
34 changes: 18 additions & 16 deletions src/components/Patient/PatientDocs/PatientDocs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,22 +199,24 @@ const PatientDocs: React.FC<PatientTypes> = ({ groupId }) => {
setPage={(newPage: number) => setPage(newPage)}
total={searchResults.totalDocs}
/>
<Modal
title="Filtrer par :"
open={toggleModal}
width={'600px'}
onClose={() => setToggleModal(false)}
onSubmit={(newFilters) => addFilters({ ...filters, ...newFilters })}
>
{!searchResults.deidentified && <NdaFilter name={FilterKeys.NDA} value={nda} />}
<DocTypesFilter allDocTypesList={allDocTypesList.docTypes} value={docTypes} name={FilterKeys.DOC_TYPES} />
<DatesRangeFilter values={[startDate, endDate]} names={[FilterKeys.START_DATE, FilterKeys.END_DATE]} />
<ExecutiveUnitsFilter
value={executiveUnits}
name={FilterKeys.EXECUTIVE_UNITS}
criteriaName={CriteriaName.Document}
/>
</Modal>
{toggleModal && (
<Modal
title="Filtrer par :"
open={toggleModal}
width={'600px'}
onClose={() => setToggleModal(false)}
onSubmit={(newFilters) => addFilters({ ...filters, ...newFilters })}
>
{!searchResults.deidentified && <NdaFilter name={FilterKeys.NDA} value={nda} />}
<DocTypesFilter allDocTypesList={allDocTypesList.docTypes} value={docTypes} name={FilterKeys.DOC_TYPES} />
<DatesRangeFilter values={[startDate, endDate]} names={[FilterKeys.START_DATE, FilterKeys.END_DATE]} />
<ExecutiveUnitsFilter
value={executiveUnits}
name={FilterKeys.EXECUTIVE_UNITS}
criteriaName={CriteriaName.Document}
/>
</Modal>
)}
</Grid>
)
}
Expand Down
12 changes: 7 additions & 5 deletions src/components/Patient/PatientPMSI/PatientPMSI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import DatesRangeFilter from 'components/Filters/DatesRangeFilter'
import DiagnosticTypesFilter from 'components/Filters/DiagnosticTypesFilter'
import ExecutiveUnitsFilter from 'components/Filters/ExecutiveUnitsFilter'
import NdaFilter from 'components/Filters/NdaFilter'
import SourceFilter from 'components/Filters/SourceFilter'

export type PatientPMSIProps = {
groupId?: string
Expand Down Expand Up @@ -61,13 +62,13 @@ const PatientPMSI = ({ groupId }: PatientPMSIProps) => {
orderBy,
searchInput,
filters,
filters: { code, nda, diagnosticTypes, startDate, endDate, executiveUnits }
filters: { code, nda, diagnosticTypes, source, startDate, endDate, executiveUnits }
},
{ changeOrderBy, changeSearchInput, addFilters, removeFilter, removeSearchCriterias }
] = useSearchCriterias(initPmsiSearchCriterias)
const filtersAsArray = useMemo(() => {
return selectFiltersAsArray({ code, nda, diagnosticTypes, startDate, endDate, executiveUnits })
}, [code, nda, diagnosticTypes, startDate, endDate, executiveUnits])
return selectFiltersAsArray({ code, nda, diagnosticTypes, source, startDate, endDate, executiveUnits })
}, [code, nda, diagnosticTypes, source, startDate, endDate, executiveUnits])

const [allDiagnosticTypesList, setAllDiagnosticTypesList] = useState<HierarchyElement[]>([])
const [loadingStatus, setLoadingStatus] = useState(LoadingStatus.FETCHING)
Expand Down Expand Up @@ -96,7 +97,7 @@ const PatientPMSI = ({ groupId }: PatientPMSIProps) => {
searchCriterias: {
orderBy,
searchInput,
filters: { code, nda, diagnosticTypes, startDate, endDate, executiveUnits }
filters: { code, nda, diagnosticTypes, source, startDate, endDate, executiveUnits }
}
},
groupId,
Expand Down Expand Up @@ -130,7 +131,7 @@ const PatientPMSI = ({ groupId }: PatientPMSIProps) => {
useEffect(() => {
setLoadingStatus(LoadingStatus.IDDLE)
setPage(1)
}, [searchInput, nda, code, startDate, endDate, diagnosticTypes, orderBy, executiveUnits])
}, [searchInput, nda, code, startDate, endDate, diagnosticTypes, source, orderBy, executiveUnits])

useEffect(() => {
setLoadingStatus(LoadingStatus.IDDLE)
Expand Down Expand Up @@ -208,6 +209,7 @@ const PatientPMSI = ({ groupId }: PatientPMSIProps) => {
allDiagnosticTypesList={allDiagnosticTypesList}
/>
)}
{selectedTab.id === PMSI.CCAM && <SourceFilter name={FilterKeys.SOURCE} value={source} />}
<DatesRangeFilter values={[startDate, endDate]} names={[FilterKeys.START_DATE, FilterKeys.END_DATE]} />
<ExecutiveUnitsFilter
value={executiveUnits}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ const TimelineItemRight: React.FC<TimelineItemRightTypes> = ({ data }) => {
}

const { classes } = useStyles({ color: color })

const codeToDisplay = data.code?.coding?.find((code) => code.userSelected === true)

return (
<li className={classes.timelineItem}>
<div className={classes.timelineRightContent}>
Expand All @@ -50,9 +53,7 @@ const TimelineItemRight: React.FC<TimelineItemRightTypes> = ({ data }) => {
: 'Date inconnue'}
</span>
{data.code && (
<div className={classes.timelineTextRight}>
{`${data.code?.coding?.[0].display} (${data.code?.coding?.[0].code})`}
</div>
<div className={classes.timelineTextRight}>{`${codeToDisplay?.display} (${codeToDisplay?.code})`}</div>
)}
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/reducers/searchCriteriasReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export const initPmsiSearchCriterias: SearchCriterias<PMSIFilters> = {
filters: {
code: '',
nda: '',
source: '',
diagnosticTypes: [],
startDate: null,
endDate: null,
Expand Down
5 changes: 4 additions & 1 deletion src/services/aphp/callApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ type fetchProcedureProps = {
sortDirection?: 'asc' | 'desc'
subject?: string
code?: string
source?: string
minDate?: string
maxDate?: string
_text?: string
Expand All @@ -397,7 +398,8 @@ type fetchProcedureProps = {
executiveUnits?: string[]
}
export const fetchProcedure = async (args: fetchProcedureProps): FHIR_Bundle_Promise_Response<Procedure> => {
const { size, offset, _sort, sortDirection, subject, code, _text, status, minDate, maxDate, executiveUnits } = args
const { size, offset, _sort, sortDirection, subject, code, source, _text, status, minDate, maxDate, executiveUnits } =
args
const _sortDirection = sortDirection === 'desc' ? '-' : ''
let { _list } = args
const encounterIdentifier = args['encounter-identifier']
Expand All @@ -412,6 +414,7 @@ export const fetchProcedure = async (args: fetchProcedureProps): FHIR_Bundle_Pro
if (subject) options = [...options, `subject=${subject}`] // eslint-disable-line
if (code)
options = [...options, `code=${encodeURIComponent('https://terminology.eds.aphp.fr/aphp-orbis-ccam|') + code}`] // eslint-disable-line
if (source) options = [...options, `source=${source}`]
if (_text) options = [...options, `_text=${encodeURIComponent(_text)}`] // eslint-disable-line
if (status)
options = [...options, `status=${encodeURIComponent('http://hl7.org/fhir/CodeSystem/event-status|') + status}`] // eslint-disable-line
Expand Down
3 changes: 3 additions & 0 deletions src/services/aphp/servicePatients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export interface IServicePatients {
searchInput: string,
nda: string,
code: string,
source: string,
diagnosticTypes: string[],
sortBy: Order,
sortDirection: Direction,
Expand Down Expand Up @@ -354,6 +355,7 @@ const servicesPatients: IServicePatients = {
searchInput,
nda,
code,
source,
diagnosticTypes,
sortBy,
sortDirection,
Expand Down Expand Up @@ -395,6 +397,7 @@ const servicesPatients: IServicePatients = {
sortDirection: sortDirection,
'encounter-identifier': nda,
code: code,
source: source,
minDate: startDate ?? '',
maxDate: endDate ?? '',
signal,
Expand Down
Loading

0 comments on commit def2646

Please sign in to comment.