Skip to content

Commit

Permalink
Release 0.3.12 (#362)
Browse files Browse the repository at this point in the history
* Update fhir version

* Add customId to accordion (#361)

* Add hashCode function

* Remove unused code

* Remove hashcode and add customId

* Update readme

* [PATIENTAPP-144] EOB Information only displaying status for Days Supply/Claim Received Date (#363)

* Fix issiue with coding

* Remove unnecessary let
  • Loading branch information
daria-lasecka authored May 17, 2022
1 parent 5aacefe commit 3f4d5b9
Show file tree
Hide file tree
Showing 42 changed files with 160 additions and 17 deletions.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![CircleCI](https://circleci.com/gh/1uphealth/fhir-react/tree/master.svg?style=svg)](https://circleci.com/gh/1uphealth/fhir-react/tree/master)
[![Storybook](https://github.com/storybookjs/brand/raw/master/badge/badge-storybook.svg?sanitize=true)](https://fhir-react-lib-test-storybook.s3.amazonaws.com/branch/release-0-3-11/index.html)
[![Storybook](https://github.com/storybookjs/brand/raw/master/badge/badge-storybook.svg?sanitize=true)](https://fhir-react-lib-test-storybook.s3.amazonaws.com/branch/release-0-3-12/index.html)

# fhir-react

Expand Down Expand Up @@ -157,6 +157,22 @@ const MyComponent = () => {
};
```

User can provide a number that can be assigned at the end of Accordion id. Not providing any number will cause a lodash uniqueId function to be used instead (default functionality up to this point).

```jsx
const MyComponent = () => {
const fhirResource = JSON.parse(fhirResourceAsJsonString);

return (
<FhirResource
fhirResource={fhirResource}
fhirVersion={fhirVersions.R4}
customId={id}
/>
);
};
```

### `FhirResource` component props

| Prop | Type | Default | Description |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fhir-react",
"version": "0.3.11",
"version": "0.3.12",
"description": "React component library for displaying FHIR Resources ",
"main": "build/index.js",
"peerDependencies": {
Expand Down
12 changes: 8 additions & 4 deletions src/components/containers/Accordion/Accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ const CHEVRON_DOWN_COLOR = '#6f83a9';
const CHEVRON_UP_COLOR = '#2a6fd7';

const Accordion = props => {
const { headerContent, bodyContent, onClick, rawOnClick } = props;
const { headerContent, bodyContent, onClick, rawOnClick, customId } = props;
const [rotate, setRotate] = useState(false);
const handleAccordionClick = () => setRotate(!rotate);
const accordionId = uniqueId(
`accordion-type-${headerContent.props.resourceName || 'default'}-`,
);

const accordionIdText = `accordion-type-${headerContent.props.resourceName ||
'default'}-`;
const accordionId =
typeof customId === 'number'
? `${accordionIdText}${customId}`
: uniqueId(accordionIdText);

const isAccordionOpenable = () => {
if (bodyContent) {
Expand Down
2 changes: 2 additions & 0 deletions src/components/resources/AdverseEvent/AdverseEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const AdverseEvent = ({
fhirIcons,
onClick,
rawOnClick,
customId,
}) => {
let fhirResourceData = {};
try {
Expand Down Expand Up @@ -172,6 +173,7 @@ const AdverseEvent = ({
}
onClick={onClick}
rawOnClick={rawOnClick}
customId={customId}
/>
</Root>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const dstu2DTO = fhirResource => {
asserter,
};
};

const stu3DTO = fhirResource => {
const title = _get(fhirResource, 'code.coding.0.display');
const status = _get(fhirResource, 'verificationStatus');
Expand All @@ -73,6 +74,7 @@ const stu3DTO = fhirResource => {
hasNote,
};
};

const r4DTO = fhirResource => {
const title = _get(fhirResource, 'code.coding.0.display');
const status = _get(fhirResource, 'verificationStatus.coding[0].display');
Expand Down Expand Up @@ -129,6 +131,7 @@ const AllergyIntolerance = ({
fhirIcons,
onClick,
rawOnClick,
customId,
}) => {
let fhirResourceData = {};
try {
Expand Down Expand Up @@ -239,6 +242,7 @@ const AllergyIntolerance = ({
bodyContent={<Body tableData={tableData} />}
onClick={onClick}
rawOnClick={rawOnClick}
customId={customId}
/>
</Root>
);
Expand Down
2 changes: 2 additions & 0 deletions src/components/resources/Appointment/Appointment.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ const Appointment = ({
fhirIcons,
onClick,
rawOnClick,
customId,
}) => {
const {
description,
Expand Down Expand Up @@ -261,6 +262,7 @@ const Appointment = ({
}
onClick={onClick}
rawOnClick={rawOnClick}
customId={customId}
/>
</Root>
);
Expand Down
3 changes: 2 additions & 1 deletion src/components/resources/Binary/Binary.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Accordion from '../../containers/Accordion/Accordion';
import { Body, Header } from '../../ui';

const Binary = props => {
const { fhirResource, fhirIcons, rawOnClick } = props;
const { fhirResource, fhirIcons, rawOnClick, customId } = props;

const loadBinaryFile = () => {
switch (fhirResource.contentType) {
Expand Down Expand Up @@ -38,6 +38,7 @@ const Binary = props => {
}
bodyContent={<Body>{loadBinaryFile()}</Body>}
rawOnClick={rawOnClick}
customId={customId}
/>
</div>
);
Expand Down
3 changes: 3 additions & 0 deletions src/components/resources/CarePlan/CarePlan.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const dstu2DTO = fhirResource => {
hasActivity,
};
};

const stu3DTO = fhirResource => {
let activity = _get(fhirResource, 'activity');
const hasActivity = Array.isArray(activity);
Expand Down Expand Up @@ -168,6 +169,7 @@ const CarePlan = ({
fhirIcons,
onClick,
rawOnClick,
customId,
}) => {
let fhirResourceData = {};
try {
Expand Down Expand Up @@ -312,6 +314,7 @@ const CarePlan = ({
}
onClick={onClick}
rawOnClick={rawOnClick}
customId={customId}
/>
</Root>
);
Expand Down
2 changes: 2 additions & 0 deletions src/components/resources/CareTeam/CareTeam.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ const CareTeam = ({
fhirIcons,
onClick,
rawOnClick,
customId,
}) => {
const {
name,
Expand Down Expand Up @@ -174,6 +175,7 @@ const CareTeam = ({
}
onClick={onClick}
rawOnClick={rawOnClick}
customId={customId}
/>
</Root>
);
Expand Down
3 changes: 3 additions & 0 deletions src/components/resources/Claim/Claim.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const dstu2DTO = fhirResource => {
items,
};
};

const stu3DTO = fhirResource => {
const status = _get(fhirResource, 'status');
const typeCoding = _get(fhirResource, 'type.coding[0]');
Expand Down Expand Up @@ -304,6 +305,7 @@ const Claim = ({
fhirIcons,
onClick,
rawOnClick,
customId,
}) => {
let fhirResourceData = {};
try {
Expand Down Expand Up @@ -489,6 +491,7 @@ const Claim = ({
}
onClick={onClick}
rawOnClick={rawOnClick}
customId={customId}
/>
</Root>
);
Expand Down
2 changes: 2 additions & 0 deletions src/components/resources/ClaimResponse/ClaimResponse.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ const ClaimResponse = ({
fhirIcons,
onClick,
rawOnClick,
customId,
}) => {
let fhirResourceData = {};
try {
Expand Down Expand Up @@ -456,6 +457,7 @@ const ClaimResponse = ({
}
onClick={onClick}
rawOnClick={rawOnClick}
customId={customId}
/>
</Root>
);
Expand Down
2 changes: 2 additions & 0 deletions src/components/resources/Condition/Condition.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ const Condition = ({
fhirIcons,
onClick,
rawOnClick,
customId,
}) => {
const {
codeText,
Expand Down Expand Up @@ -164,6 +165,7 @@ const Condition = ({
bodyContent={<Body tableData={tableData} />}
onClick={onClick}
rawOnClick={rawOnClick}
customId={customId}
/>
</Root>
);
Expand Down
3 changes: 3 additions & 0 deletions src/components/resources/Coverage/Coverage.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const stu3DTO = fhirResource => {
hasExtension,
};
};

const r4DTO = fhirResource => {
const issuer = _get(fhirResource, 'payor.0');
const planId = _get(fhirResource, 'class.plan');
Expand Down Expand Up @@ -120,6 +121,7 @@ const Coverage = ({
fhirIcons,
onClick,
rawOnClick,
customId,
}) => {
let fhirResourceData = {};
try {
Expand Down Expand Up @@ -240,6 +242,7 @@ const Coverage = ({
bodyContent={<Body tableData={tableData} />}
onClick={onClick}
rawOnClick={rawOnClick}
customId={customId}
/>
</Root>
);
Expand Down
3 changes: 3 additions & 0 deletions src/components/resources/Device/Device.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const dstu2DTO = fhirResource => {
getExpiry,
};
};

const stu3DTO = fhirResource => {
const getUdi = _get(fhirResource, 'udi.name');
const hasExpiry = _has(fhirResource, 'expirationDate');
Expand Down Expand Up @@ -108,6 +109,7 @@ const Device = ({
fhirIcons,
onClick,
rawOnClick,
customId,
}) => {
let fhirResourceData = {};
try {
Expand Down Expand Up @@ -186,6 +188,7 @@ const Device = ({
}
onClick={onClick}
rawOnClick={rawOnClick}
customId={customId}
/>
</Root>
);
Expand Down
2 changes: 2 additions & 0 deletions src/components/resources/DiagnosticReport/DiagnosticReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ const DiagnosticReport = ({
fhirIcons,
onClick,
rawOnClick,
customId,
}) => {
let fhirResourceData = {};
try {
Expand Down Expand Up @@ -172,6 +173,7 @@ const DiagnosticReport = ({
bodyContent={<Body tableData={tableData} />}
onClick={onClick}
rawOnClick={rawOnClick}
customId={customId}
/>
</Root>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ const DocumentReference = ({
fhirIcons,
onClick,
rawOnClick,
customId,
}) => {
let fhirResourceData = {};
try {
Expand Down Expand Up @@ -344,6 +345,7 @@ const DocumentReference = ({
}
onClick={onClick}
rawOnClick={rawOnClick}
customId={customId}
/>
</Root>
);
Expand Down
2 changes: 2 additions & 0 deletions src/components/resources/Encounter/Encounter.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ const Encounter = ({
fhirIcons,
onClick,
rawOnClick,
customId,
}) => {
let fhirResourceData = {};
try {
Expand Down Expand Up @@ -237,6 +238,7 @@ const Encounter = ({
}
onClick={onClick}
rawOnClick={rawOnClick}
customId={customId}
/>
</Root>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ const ExplanationOfBenefit = ({
fhirIcons,
onClick,
rawOnClick,
customId,
}) => {
let fhirResourceData = {};
try {
Expand Down Expand Up @@ -517,9 +518,22 @@ const ExplanationOfBenefit = ({
return key !== 'sequence' && key !== 'category';
},
);
const infoStatus = _get(informationItem, infoKey);
const StatusComponent =
infoKey.toString() === 'timingDate' ? Date : Quantity;
let infoStatus = _get(informationItem, infoKey);
let StatusComponent;
switch (infoKey.toString()) {
case 'timingDate':
StatusComponent = Date;
break;
case 'timingPeriod':
StatusComponent = Period;
break;
case 'valueQuantity':
StatusComponent = Quantity;
break;
default:
StatusComponent = Coding;
infoStatus = _get(infoStatus, 'coding', '')[0];
}

return (
<TableRow key={`serviceItem-${i}`}>
Expand Down Expand Up @@ -550,6 +564,7 @@ const ExplanationOfBenefit = ({
}
onClick={onClick}
rawOnClick={rawOnClick}
customId={customId}
/>
</Root>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ const FamilyMemberHistory = ({
fhirIcons,
onClick,
rawOnClick,
customId,
}) => {
let fhirResourceData = {};
try {
Expand Down Expand Up @@ -142,6 +143,7 @@ const FamilyMemberHistory = ({
bodyContent={<Body tableData={tableData} />}
onClick={onClick}
rawOnClick={rawOnClick}
customId={customId}
/>
</Root>
);
Expand Down
Loading

0 comments on commit 3f4d5b9

Please sign in to comment.