Skip to content

Commit

Permalink
fix: add missing type import (#778)
Browse files Browse the repository at this point in the history
  • Loading branch information
pl-buiquang authored May 26, 2023
1 parent 3c1706b commit f791547
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
6 changes: 4 additions & 2 deletions src/components/DataTable/DataTablePatient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ const DataTablePatientLine: React.FC<{
}
>
<TableCell align="center">
{patient.gender && <PatientGender gender={patient.gender} className={classes.genderIcon} />}
{patient.gender && (
<PatientGender gender={patient.gender as PatientGenderKind} className={classes.genderIcon} />
)}
</TableCell>
<TableCell>{deidentified ? 'Prénom' : capitalizeFirstLetter(patient.name?.[0].given?.[0])}</TableCell>
<TableCell>{deidentified ? 'Nom' : patient.name?.map((e) => e.family).join(' ')}</TableCell>
Expand Down Expand Up @@ -154,7 +156,7 @@ const DataTablePatientLine: React.FC<{
export default DataTablePatient

type PatientGenderProps = {
gender: PatientGenderKind
gender?: PatientGenderKind
className?: string
}

Expand Down
4 changes: 2 additions & 2 deletions src/components/Patient/PatientHeader/PatientHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'

import { CohortPatient, IPatientDetails } from 'types'
import { CohortPatient, IPatientDetails, PatientGenderKind } from 'types'

import Grid from '@mui/material/Grid'

Expand Down Expand Up @@ -40,7 +40,7 @@ const PatientHeader: React.FC<PatientHeaderProps> = ({
<PatientTitle firstName={firstName} lastName={lastName} />
</Grid>
<Grid container item justifyContent="flex-end" xs={3}>
<PatientInfo age={age} ipp={ipp} gender={patient.gender} />
<PatientInfo age={age} ipp={ipp} gender={patient.gender as PatientGenderKind} />
</Grid>
</Grid>
</Grid>
Expand Down
11 changes: 9 additions & 2 deletions src/components/Patient/PatientSidebar/PatientSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ import ChevronRightIcon from '@mui/icons-material/ChevronRight'

import { getAge, substructAgeString } from 'utils/age'
import services from 'services/aphp'
import { CohortPatient, PatientFilters as PatientFiltersType, SearchByTypes, Sort, VitalStatus } from 'types'
import {
CohortPatient,
PatientFilters as PatientFiltersType,
PatientGenderKind,
SearchByTypes,
Sort,
VitalStatus
} from 'types'

import useStyles from './styles'
import moment from 'moment/moment'
Expand Down Expand Up @@ -168,7 +175,7 @@ const PatientSidebar: React.FC<PatientSidebarTypes> = ({
firstName={deidentifiedBoolean ? 'Prénom' : patient.name?.[0].given?.[0] ?? ''}
lastName={deidentifiedBoolean ? 'Nom' : patient.name?.map((e) => e.family).join(' ') ?? ''}
age={getAge(patient)}
gender={patient.gender}
gender={patient.gender as PatientGenderKind}
deceased={patient.deceasedDateTime ?? patient.deceasedBoolean}
ipp={
deidentifiedBoolean
Expand Down
2 changes: 1 addition & 1 deletion src/services/aphp/serviceCohorts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
import { ODD_EXPORT } from '../../constants'

import apiBackend from '../apiBackend'
import { DocumentReference, Identifier } from 'fhir/r4'
import { DocumentReference, Identifier, Patient } from 'fhir/r4'

export interface IServiceCohorts {
/**
Expand Down
4 changes: 3 additions & 1 deletion src/state/patient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ import {
Condition,
DocumentReference,
Encounter,
Identifier,
MedicationAdministration,
MedicationRequest,
Observation,
Patient,
Procedure
} from 'fhir/r4'
Expand Down Expand Up @@ -1195,7 +1197,7 @@ function fillElementInformation<
newElement.NDA = encounter?.id ?? 'Inconnu'

if (!deidentifiedBoolean && encounter?.identifier) {
const nda = encounter.identifier.find((identifier: IIdentifier) => identifier.type?.coding?.[0].code === 'NDA')
const nda = encounter.identifier.find((identifier: Identifier) => identifier.type?.coding?.[0].code === 'NDA')
if (nda) {
newElement.NDA = nda?.value ?? 'Inconnu'
}
Expand Down

0 comments on commit f791547

Please sign in to comment.