@ltht-react/diagnosis-summary 2.0.187 → 2.0.188
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -22
- package/package.json +10 -10
- package/src/atoms/diagnosis-category.tsx +31 -31
- package/src/atoms/diagnosis-data-source.tsx +45 -45
- package/src/atoms/diagnosis-onset-estimated.tsx +40 -40
- package/src/atoms/diagnosis-title.tsx +72 -72
- package/src/constants.ts +5 -5
- package/src/index.tsx +3 -3
- package/src/molecules/diagnosis-redacted.tsx +31 -31
- package/src/organisms/diagnosis-summary.tsx +252 -252
- package/lib/atoms/diagnosis-category.d.ts +0 -8
- package/lib/atoms/diagnosis-category.js +0 -46
- package/lib/atoms/diagnosis-category.js.map +0 -1
- package/lib/atoms/diagnosis-data-source.d.ts +0 -8
- package/lib/atoms/diagnosis-data-source.js +0 -56
- package/lib/atoms/diagnosis-data-source.js.map +0 -1
- package/lib/atoms/diagnosis-onset-estimated.d.ts +0 -8
- package/lib/atoms/diagnosis-onset-estimated.js +0 -47
- package/lib/atoms/diagnosis-onset-estimated.js.map +0 -1
- package/lib/atoms/diagnosis-title.d.ts +0 -10
- package/lib/atoms/diagnosis-title.js +0 -52
- package/lib/atoms/diagnosis-title.js.map +0 -1
- package/lib/constants.d.ts +0 -4
- package/lib/constants.js +0 -10
- package/lib/constants.js.map +0 -1
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -8
- package/lib/index.js.map +0 -1
- package/lib/molecules/diagnosis-redacted.d.ts +0 -7
- package/lib/molecules/diagnosis-redacted.js +0 -22
- package/lib/molecules/diagnosis-redacted.js.map +0 -1
- package/lib/organisms/diagnosis-summary.d.ts +0 -19
- package/lib/organisms/diagnosis-summary.js +0 -65
- package/lib/organisms/diagnosis-summary.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
# DiagnosisSummary
|
|
2
|
-
|
|
3
|
-
<!-- STORY -->
|
|
4
|
-
|
|
5
|
-
### Import
|
|
6
|
-
|
|
7
|
-
```js
|
|
8
|
-
import DiagnosisSummary from '@ltht-react/diagnosis-summary'
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
### Usage
|
|
12
|
-
|
|
13
|
-
```jsx
|
|
14
|
-
<DiagnosisSummary title="Conditions" conditions={conditions} clickHandler={handleCLick} />
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### Properties
|
|
18
|
-
|
|
19
|
-
| Prop | Required | Default | Type | Description |
|
|
20
|
-
| :------------- | :------- | :-------- | :---------- | :------------------------------------------------------------ |
|
|
21
|
-
| `conditions` | Yes | | Condition[] | Array of conditions to display |
|
|
22
|
-
| `clickHandler` | No | undefined | Function | Callback click handler containing the selected condition item |
|
|
1
|
+
# DiagnosisSummary
|
|
2
|
+
|
|
3
|
+
<!-- STORY -->
|
|
4
|
+
|
|
5
|
+
### Import
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
import DiagnosisSummary from '@ltht-react/diagnosis-summary'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### Usage
|
|
12
|
+
|
|
13
|
+
```jsx
|
|
14
|
+
<DiagnosisSummary title="Conditions" conditions={conditions} clickHandler={handleCLick} />
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Properties
|
|
18
|
+
|
|
19
|
+
| Prop | Required | Default | Type | Description |
|
|
20
|
+
| :------------- | :------- | :-------- | :---------- | :------------------------------------------------------------ |
|
|
21
|
+
| `conditions` | Yes | | Condition[] | Array of conditions to display |
|
|
22
|
+
| `clickHandler` | No | undefined | Function | Callback click handler containing the selected condition item |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ltht-react/diagnosis-summary",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.188",
|
|
4
4
|
"description": "ltht-react clinical DiagnosisSummary component.",
|
|
5
5
|
"author": "LTHT",
|
|
6
6
|
"homepage": "",
|
|
@@ -28,16 +28,16 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@emotion/react": "^11.0.0",
|
|
30
30
|
"@emotion/styled": "^11.0.0",
|
|
31
|
-
"@ltht-react/button": "^2.0.
|
|
32
|
-
"@ltht-react/hooks": "^2.0.
|
|
33
|
-
"@ltht-react/icon": "^2.0.
|
|
34
|
-
"@ltht-react/list": "^2.0.
|
|
35
|
-
"@ltht-react/styles": "^2.0.
|
|
36
|
-
"@ltht-react/type-summary": "^2.0.
|
|
37
|
-
"@ltht-react/types": "^2.0.
|
|
38
|
-
"@ltht-react/utils": "^2.0.
|
|
31
|
+
"@ltht-react/button": "^2.0.188",
|
|
32
|
+
"@ltht-react/hooks": "^2.0.188",
|
|
33
|
+
"@ltht-react/icon": "^2.0.188",
|
|
34
|
+
"@ltht-react/list": "^2.0.188",
|
|
35
|
+
"@ltht-react/styles": "^2.0.188",
|
|
36
|
+
"@ltht-react/type-summary": "^2.0.188",
|
|
37
|
+
"@ltht-react/types": "^2.0.188",
|
|
38
|
+
"@ltht-react/utils": "^2.0.188",
|
|
39
39
|
"html-react-parser": "^5.0.6",
|
|
40
40
|
"react": "^18.2.0"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "db9a3b619b84b838cf14219aeec376975beea4fd"
|
|
43
43
|
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { FC, HTMLAttributes } from 'react'
|
|
2
|
-
import styled from '@emotion/styled'
|
|
3
|
-
|
|
4
|
-
import { TEXT_COLOURS } from '@ltht-react/styles'
|
|
5
|
-
import { Condition } from '@ltht-react/types'
|
|
6
|
-
import { codeableConceptDisplaySummary } from '@ltht-react/utils'
|
|
7
|
-
|
|
8
|
-
const StyledConditionCategory = styled.div<IStyledDescription>`
|
|
9
|
-
color: ${TEXT_COLOURS.SECONDARY.VALUE};
|
|
10
|
-
text-align: left;
|
|
11
|
-
font-size: smaller;
|
|
12
|
-
padding-top: 0.25rem;
|
|
13
|
-
text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
|
|
14
|
-
`
|
|
15
|
-
|
|
16
|
-
const DiagnosisCategory: FC<Props> = ({ condition, enteredInError, ...rest }) => (
|
|
17
|
-
<StyledConditionCategory enteredInError={enteredInError} {...rest}>
|
|
18
|
-
{codeableConceptDisplaySummary(condition.severity)}
|
|
19
|
-
</StyledConditionCategory>
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
23
|
-
condition: Condition
|
|
24
|
-
enteredInError: boolean
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
interface IStyledDescription {
|
|
28
|
-
enteredInError: boolean
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export default DiagnosisCategory
|
|
1
|
+
import { FC, HTMLAttributes } from 'react'
|
|
2
|
+
import styled from '@emotion/styled'
|
|
3
|
+
|
|
4
|
+
import { TEXT_COLOURS } from '@ltht-react/styles'
|
|
5
|
+
import { Condition } from '@ltht-react/types'
|
|
6
|
+
import { codeableConceptDisplaySummary } from '@ltht-react/utils'
|
|
7
|
+
|
|
8
|
+
const StyledConditionCategory = styled.div<IStyledDescription>`
|
|
9
|
+
color: ${TEXT_COLOURS.SECONDARY.VALUE};
|
|
10
|
+
text-align: left;
|
|
11
|
+
font-size: smaller;
|
|
12
|
+
padding-top: 0.25rem;
|
|
13
|
+
text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
|
|
14
|
+
`
|
|
15
|
+
|
|
16
|
+
const DiagnosisCategory: FC<Props> = ({ condition, enteredInError, ...rest }) => (
|
|
17
|
+
<StyledConditionCategory enteredInError={enteredInError} {...rest}>
|
|
18
|
+
{codeableConceptDisplaySummary(condition.severity)}
|
|
19
|
+
</StyledConditionCategory>
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
23
|
+
condition: Condition
|
|
24
|
+
enteredInError: boolean
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface IStyledDescription {
|
|
28
|
+
enteredInError: boolean
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default DiagnosisCategory
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { FC, HTMLAttributes } from 'react'
|
|
2
|
-
import styled from '@emotion/styled'
|
|
3
|
-
|
|
4
|
-
import { TEXT_COLOURS } from '@ltht-react/styles'
|
|
5
|
-
import { Condition } from '@ltht-react/types'
|
|
6
|
-
|
|
7
|
-
const StyledConditionStatus = styled.div<IStyledDescription>`
|
|
8
|
-
color: ${TEXT_COLOURS.SECONDARY.VALUE};
|
|
9
|
-
text-align: left;
|
|
10
|
-
font-size: smaller;
|
|
11
|
-
text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
|
|
12
|
-
`
|
|
13
|
-
|
|
14
|
-
const extractDataSourceDisplayNames = (condition: Condition) => {
|
|
15
|
-
const dataSourceDisplayNames: string[] = []
|
|
16
|
-
|
|
17
|
-
condition?.metadata?.dataSources?.forEach((dataSource, _) => {
|
|
18
|
-
if (dataSource?.display) {
|
|
19
|
-
dataSourceDisplayNames.push(dataSource.display)
|
|
20
|
-
}
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
return dataSourceDisplayNames.join(', ')
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const DiagnosisDataSource: FC<Props> = ({ condition, enteredInError, ...rest }) => {
|
|
27
|
-
const dataSourceDisplayNames = extractDataSourceDisplayNames(condition)
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<StyledConditionStatus enteredInError={enteredInError} {...rest}>
|
|
31
|
-
{dataSourceDisplayNames ? `Source: ${dataSourceDisplayNames}` : `Source: Unknown`}
|
|
32
|
-
</StyledConditionStatus>
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
37
|
-
condition: Condition
|
|
38
|
-
enteredInError: boolean
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
interface IStyledDescription {
|
|
42
|
-
enteredInError: boolean
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export default DiagnosisDataSource
|
|
1
|
+
import { FC, HTMLAttributes } from 'react'
|
|
2
|
+
import styled from '@emotion/styled'
|
|
3
|
+
|
|
4
|
+
import { TEXT_COLOURS } from '@ltht-react/styles'
|
|
5
|
+
import { Condition } from '@ltht-react/types'
|
|
6
|
+
|
|
7
|
+
const StyledConditionStatus = styled.div<IStyledDescription>`
|
|
8
|
+
color: ${TEXT_COLOURS.SECONDARY.VALUE};
|
|
9
|
+
text-align: left;
|
|
10
|
+
font-size: smaller;
|
|
11
|
+
text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
|
|
12
|
+
`
|
|
13
|
+
|
|
14
|
+
const extractDataSourceDisplayNames = (condition: Condition) => {
|
|
15
|
+
const dataSourceDisplayNames: string[] = []
|
|
16
|
+
|
|
17
|
+
condition?.metadata?.dataSources?.forEach((dataSource, _) => {
|
|
18
|
+
if (dataSource?.display) {
|
|
19
|
+
dataSourceDisplayNames.push(dataSource.display)
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
return dataSourceDisplayNames.join(', ')
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const DiagnosisDataSource: FC<Props> = ({ condition, enteredInError, ...rest }) => {
|
|
27
|
+
const dataSourceDisplayNames = extractDataSourceDisplayNames(condition)
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<StyledConditionStatus enteredInError={enteredInError} {...rest}>
|
|
31
|
+
{dataSourceDisplayNames ? `Source: ${dataSourceDisplayNames}` : `Source: Unknown`}
|
|
32
|
+
</StyledConditionStatus>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
37
|
+
condition: Condition
|
|
38
|
+
enteredInError: boolean
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface IStyledDescription {
|
|
42
|
+
enteredInError: boolean
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default DiagnosisDataSource
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import { FC, HTMLAttributes } from 'react'
|
|
2
|
-
import styled from '@emotion/styled'
|
|
3
|
-
|
|
4
|
-
import { TEXT_COLOURS } from '@ltht-react/styles'
|
|
5
|
-
import { Condition } from '@ltht-react/types'
|
|
6
|
-
|
|
7
|
-
import { getBooleanExtension } from '@ltht-react/utils'
|
|
8
|
-
|
|
9
|
-
const StyledOnsetEstimated = styled.div<IStyledDescription>`
|
|
10
|
-
color: ${TEXT_COLOURS.INFO};
|
|
11
|
-
font-size: x-small;
|
|
12
|
-
white-space: pre-wrap;
|
|
13
|
-
display: inline-block;
|
|
14
|
-
text-align: right;
|
|
15
|
-
text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
|
|
16
|
-
`
|
|
17
|
-
|
|
18
|
-
const DiagnosisOnsetEstimated: FC<Props> = ({ condition, enteredInError, ...rest }) => {
|
|
19
|
-
const onsetDateEstimated = getBooleanExtension(
|
|
20
|
-
condition.extension,
|
|
21
|
-
'https://fhir.leedsth.nhs.uk/ValueSet/diagnosis-onset-date-estimated-1'
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<StyledOnsetEstimated enteredInError={enteredInError} {...rest}>
|
|
26
|
-
{onsetDateEstimated ? '(estimated)' : ''}
|
|
27
|
-
</StyledOnsetEstimated>
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
32
|
-
condition: Condition
|
|
33
|
-
enteredInError: boolean
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
interface IStyledDescription {
|
|
37
|
-
enteredInError: boolean
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export default DiagnosisOnsetEstimated
|
|
1
|
+
import { FC, HTMLAttributes } from 'react'
|
|
2
|
+
import styled from '@emotion/styled'
|
|
3
|
+
|
|
4
|
+
import { TEXT_COLOURS } from '@ltht-react/styles'
|
|
5
|
+
import { Condition } from '@ltht-react/types'
|
|
6
|
+
|
|
7
|
+
import { getBooleanExtension } from '@ltht-react/utils'
|
|
8
|
+
|
|
9
|
+
const StyledOnsetEstimated = styled.div<IStyledDescription>`
|
|
10
|
+
color: ${TEXT_COLOURS.INFO};
|
|
11
|
+
font-size: x-small;
|
|
12
|
+
white-space: pre-wrap;
|
|
13
|
+
display: inline-block;
|
|
14
|
+
text-align: right;
|
|
15
|
+
text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
|
|
16
|
+
`
|
|
17
|
+
|
|
18
|
+
const DiagnosisOnsetEstimated: FC<Props> = ({ condition, enteredInError, ...rest }) => {
|
|
19
|
+
const onsetDateEstimated = getBooleanExtension(
|
|
20
|
+
condition.extension,
|
|
21
|
+
'https://fhir.leedsth.nhs.uk/ValueSet/diagnosis-onset-date-estimated-1'
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<StyledOnsetEstimated enteredInError={enteredInError} {...rest}>
|
|
26
|
+
{onsetDateEstimated ? '(estimated)' : ''}
|
|
27
|
+
</StyledOnsetEstimated>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
32
|
+
condition: Condition
|
|
33
|
+
enteredInError: boolean
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface IStyledDescription {
|
|
37
|
+
enteredInError: boolean
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default DiagnosisOnsetEstimated
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import { FC, HTMLAttributes } from 'react'
|
|
2
|
-
import styled from '@emotion/styled'
|
|
3
|
-
import { titleCase, codeableConceptDisplaySummary } from '@ltht-react/utils'
|
|
4
|
-
import parseHtml from 'html-react-parser'
|
|
5
|
-
|
|
6
|
-
import { TEXT_COLOURS } from '@ltht-react/styles'
|
|
7
|
-
import { Condition } from '@ltht-react/types'
|
|
8
|
-
import { SNIPPET_HOVER_TEXT } from '../constants'
|
|
9
|
-
|
|
10
|
-
const StyledConditionTitle = styled.div<IStyledDescription>`
|
|
11
|
-
color: ${TEXT_COLOURS.PRIMARY};
|
|
12
|
-
text-align: left;
|
|
13
|
-
text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
|
|
14
|
-
`
|
|
15
|
-
|
|
16
|
-
const DiagnosisTitle: FC<Props> = ({ condition, enteredInError, systemExclusionsFilter, isRichText = false }) => {
|
|
17
|
-
const snippetTagText = extractSnippetTagDisplayValue(condition)
|
|
18
|
-
|
|
19
|
-
if (snippetTagText) {
|
|
20
|
-
return renderTitle(snippetTagText, enteredInError, isRichText)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const conditionText = extractConditionOrFallbackText(condition, systemExclusionsFilter)
|
|
24
|
-
const conditionStatusText = extractConditionStatusText(condition)
|
|
25
|
-
const title = conditionStatusText ? `${conditionText}, ${conditionStatusText}` : conditionText
|
|
26
|
-
|
|
27
|
-
return renderTitle(title, enteredInError, isRichText)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const extractConditionOrFallbackText = (condition: Condition, systemExclusionsFilter?: string[]): string => {
|
|
31
|
-
if (!condition?.code) {
|
|
32
|
-
return titleCase('Unknown Condition')
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const diagnosisTitle = codeableConceptDisplaySummary(condition.code, systemExclusionsFilter)
|
|
36
|
-
|
|
37
|
-
return titleCase(diagnosisTitle || 'Unknown Condition')
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const extractConditionStatusText = (condition: Condition): string => {
|
|
41
|
-
const statusParts: string[] = []
|
|
42
|
-
|
|
43
|
-
if (condition?.clinicalStatus) {
|
|
44
|
-
statusParts.push(condition?.clinicalStatus)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (condition?.verificationStatus) {
|
|
48
|
-
statusParts.push(condition.verificationStatus)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return titleCase(statusParts.join(', '))
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const extractSnippetTagDisplayValue = (condition: Condition) =>
|
|
55
|
-
condition?.metadata.tag?.find((coding) => coding?.system === SNIPPET_HOVER_TEXT)?.display
|
|
56
|
-
|
|
57
|
-
const renderTitle = (title: string, enteredInError: boolean, isRichText?: boolean) => (
|
|
58
|
-
<StyledConditionTitle enteredInError={enteredInError}>{isRichText ? parseHtml(title) : title}</StyledConditionTitle>
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
62
|
-
condition: Condition
|
|
63
|
-
enteredInError: boolean
|
|
64
|
-
systemExclusionsFilter?: string[]
|
|
65
|
-
isRichText?: boolean
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
interface IStyledDescription {
|
|
69
|
-
enteredInError: boolean
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export default DiagnosisTitle
|
|
1
|
+
import { FC, HTMLAttributes } from 'react'
|
|
2
|
+
import styled from '@emotion/styled'
|
|
3
|
+
import { titleCase, codeableConceptDisplaySummary } from '@ltht-react/utils'
|
|
4
|
+
import parseHtml from 'html-react-parser'
|
|
5
|
+
|
|
6
|
+
import { TEXT_COLOURS } from '@ltht-react/styles'
|
|
7
|
+
import { Condition } from '@ltht-react/types'
|
|
8
|
+
import { SNIPPET_HOVER_TEXT } from '../constants'
|
|
9
|
+
|
|
10
|
+
const StyledConditionTitle = styled.div<IStyledDescription>`
|
|
11
|
+
color: ${TEXT_COLOURS.PRIMARY};
|
|
12
|
+
text-align: left;
|
|
13
|
+
text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
|
|
14
|
+
`
|
|
15
|
+
|
|
16
|
+
const DiagnosisTitle: FC<Props> = ({ condition, enteredInError, systemExclusionsFilter, isRichText = false }) => {
|
|
17
|
+
const snippetTagText = extractSnippetTagDisplayValue(condition)
|
|
18
|
+
|
|
19
|
+
if (snippetTagText) {
|
|
20
|
+
return renderTitle(snippetTagText, enteredInError, isRichText)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const conditionText = extractConditionOrFallbackText(condition, systemExclusionsFilter)
|
|
24
|
+
const conditionStatusText = extractConditionStatusText(condition)
|
|
25
|
+
const title = conditionStatusText ? `${conditionText}, ${conditionStatusText}` : conditionText
|
|
26
|
+
|
|
27
|
+
return renderTitle(title, enteredInError, isRichText)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const extractConditionOrFallbackText = (condition: Condition, systemExclusionsFilter?: string[]): string => {
|
|
31
|
+
if (!condition?.code) {
|
|
32
|
+
return titleCase('Unknown Condition')
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const diagnosisTitle = codeableConceptDisplaySummary(condition.code, systemExclusionsFilter)
|
|
36
|
+
|
|
37
|
+
return titleCase(diagnosisTitle || 'Unknown Condition')
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const extractConditionStatusText = (condition: Condition): string => {
|
|
41
|
+
const statusParts: string[] = []
|
|
42
|
+
|
|
43
|
+
if (condition?.clinicalStatus) {
|
|
44
|
+
statusParts.push(condition?.clinicalStatus)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (condition?.verificationStatus) {
|
|
48
|
+
statusParts.push(condition.verificationStatus)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return titleCase(statusParts.join(', '))
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const extractSnippetTagDisplayValue = (condition: Condition) =>
|
|
55
|
+
condition?.metadata.tag?.find((coding) => coding?.system === SNIPPET_HOVER_TEXT)?.display
|
|
56
|
+
|
|
57
|
+
const renderTitle = (title: string, enteredInError: boolean, isRichText?: boolean) => (
|
|
58
|
+
<StyledConditionTitle enteredInError={enteredInError}>{isRichText ? parseHtml(title) : title}</StyledConditionTitle>
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
62
|
+
condition: Condition
|
|
63
|
+
enteredInError: boolean
|
|
64
|
+
systemExclusionsFilter?: string[]
|
|
65
|
+
isRichText?: boolean
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
interface IStyledDescription {
|
|
69
|
+
enteredInError: boolean
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export default DiagnosisTitle
|
package/src/constants.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const SNIPPET_HOVER_TEXT = 'https://leedsth.nhs.uk/cds/snippet-hover-text'
|
|
2
|
-
const EXTENSION_TEMPLATE_DISPLAY_NAME = 'https://leedsth.nhs.uk/cds/extension-template-display-name'
|
|
3
|
-
const EXTENSION_TEMPLATE_VERSION = 'https://leedsth.nhs.uk/cds/extension-template-version'
|
|
4
|
-
|
|
5
|
-
export { EXTENSION_TEMPLATE_DISPLAY_NAME, EXTENSION_TEMPLATE_VERSION, SNIPPET_HOVER_TEXT }
|
|
1
|
+
const SNIPPET_HOVER_TEXT = 'https://leedsth.nhs.uk/cds/snippet-hover-text'
|
|
2
|
+
const EXTENSION_TEMPLATE_DISPLAY_NAME = 'https://leedsth.nhs.uk/cds/extension-template-display-name'
|
|
3
|
+
const EXTENSION_TEMPLATE_VERSION = 'https://leedsth.nhs.uk/cds/extension-template-version'
|
|
4
|
+
|
|
5
|
+
export { EXTENSION_TEMPLATE_DISPLAY_NAME, EXTENSION_TEMPLATE_VERSION, SNIPPET_HOVER_TEXT }
|
package/src/index.tsx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import DiagnosisSummary from './organisms/diagnosis-summary'
|
|
2
|
-
|
|
3
|
-
export default DiagnosisSummary
|
|
1
|
+
import DiagnosisSummary from './organisms/diagnosis-summary'
|
|
2
|
+
|
|
3
|
+
export default DiagnosisSummary
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { FC } from 'react'
|
|
2
|
-
import styled from '@emotion/styled'
|
|
3
|
-
|
|
4
|
-
import { Condition } from '@ltht-react/types'
|
|
5
|
-
import { DateSummary, RedactedDescription } from '@ltht-react/type-summary'
|
|
6
|
-
|
|
7
|
-
const StyledRedactedDescription = styled.div`
|
|
8
|
-
flex-grow: 1;
|
|
9
|
-
text-align: left;
|
|
10
|
-
`
|
|
11
|
-
|
|
12
|
-
const StyledDateSummary = styled.div`
|
|
13
|
-
text-align: right;
|
|
14
|
-
`
|
|
15
|
-
|
|
16
|
-
const DiagnosisRedacted: FC<Props> = ({ condition }) => (
|
|
17
|
-
<>
|
|
18
|
-
<StyledRedactedDescription>
|
|
19
|
-
<RedactedDescription />
|
|
20
|
-
</StyledRedactedDescription>
|
|
21
|
-
<StyledDateSummary>
|
|
22
|
-
<DateSummary datetime={condition?.onset?.dateTime} />
|
|
23
|
-
</StyledDateSummary>
|
|
24
|
-
</>
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
interface Props {
|
|
28
|
-
condition?: Condition | null
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export default DiagnosisRedacted
|
|
1
|
+
import { FC } from 'react'
|
|
2
|
+
import styled from '@emotion/styled'
|
|
3
|
+
|
|
4
|
+
import { Condition } from '@ltht-react/types'
|
|
5
|
+
import { DateSummary, RedactedDescription } from '@ltht-react/type-summary'
|
|
6
|
+
|
|
7
|
+
const StyledRedactedDescription = styled.div`
|
|
8
|
+
flex-grow: 1;
|
|
9
|
+
text-align: left;
|
|
10
|
+
`
|
|
11
|
+
|
|
12
|
+
const StyledDateSummary = styled.div`
|
|
13
|
+
text-align: right;
|
|
14
|
+
`
|
|
15
|
+
|
|
16
|
+
const DiagnosisRedacted: FC<Props> = ({ condition }) => (
|
|
17
|
+
<>
|
|
18
|
+
<StyledRedactedDescription>
|
|
19
|
+
<RedactedDescription />
|
|
20
|
+
</StyledRedactedDescription>
|
|
21
|
+
<StyledDateSummary>
|
|
22
|
+
<DateSummary datetime={condition?.onset?.dateTime} />
|
|
23
|
+
</StyledDateSummary>
|
|
24
|
+
</>
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
interface Props {
|
|
28
|
+
condition?: Condition | null
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default DiagnosisRedacted
|