Skip to content

Commit

Permalink
Update eICR Details section (#2618)
Browse files Browse the repository at this point in the history
* fix device resource, add eicr release version to composition

* update eicr details and remove sender details

* update snapshot & unit tests

* remove eicr sender details from loading view

* update data.sql

* update snapshot test and bundle
  • Loading branch information
angelathe authored Sep 27, 2024
1 parent 1ff2f17 commit 7cc33c9
Show file tree
Hide file tree
Showing 16 changed files with 225 additions and 492 deletions.
242 changes: 121 additions & 121 deletions containers/ecr-viewer/seed-scripts/sql/data.sql

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion containers/ecr-viewer/src/app/api/fhirPath.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ patientSexualOrientation: "Bundle.entry.resource.where(resourceType='Observation
patientGenderIdentity: "Bundle.entry.resource.where(resourceType = 'Patient').extension.where(url='http: //hl7.org/fhir/us/ecr/StructureDefinition/us-ph-genderidentity-extension').extension.value.coding.display"

eicrIdentifier: "Bundle.entry.resource.where(resourceType= 'Composition').id"
eicrReleaseVersion: "Bundle.entry.resource.where(resourceType='Composition').extension.where(url='https://www.hl7.org/implement/standards/product_brief.cfm?product_id=436').valueString"
eicrCustodianRef: "Bundle.entry.resource.where(resourceType= 'Composition').custodian.reference"
dateTimeEcrCreated: "Bundle.entry.resource.where(resourceType = 'Composition').date"
senderSoftware: "Bundle.entry.resource.where(resourceType = 'Device').where(property[0].type.coding.code='software').type.coding.display"
ehrSoftware: "Bundle.entry.resource.where(resourceType = 'Device').where(property[0].type.coding.code='software').version.value"
ehrManufacturerModel: "Bundle.entry.resource.where(resourceType = 'Device').where(property[0].type.coding.code='software').manufacturer"
senderFacilityName: "Bundle.entry.resource.where(resourceType = 'Encounter')[0].location[0].location.display"

# Encounter Info
Expand Down
74 changes: 21 additions & 53 deletions containers/ecr-viewer/src/app/services/ecrMetadataService.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
import {
formatAddress,
formatContactPoint,
formatDateTime,
} from "@/app/services/formatService";
import { formatDateTime } from "@/app/services/formatService";
import { PathMappings, evaluateData } from "@/app/view-data/utils/utils";
import { Bundle, Organization } from "fhir/r4";
import { Bundle } from "fhir/r4";
import { evaluate } from "@/app/view-data/utils/evaluate";
import {
evaluateFacilityAddress,
evaluateReference,
evaluateFacilityId,
} from "./evaluateFhirDataService";
import { DisplayDataProps } from "@/app/view-data/components/DataDisplay";

export interface ReportableConditions {
Expand Down Expand Up @@ -57,12 +48,18 @@ export const evaluateEcrMetadata = (
);
}
}
const custodianRef = evaluate(fhirBundle, mappings.eicrCustodianRef)[0] ?? "";
const custodian = evaluateReference(
fhirBundle,
mappings,
custodianRef,
) as Organization;

const eicrReleaseVersion = (fhirBundle: any, mappings: any) => {
const releaseVersion = evaluate(fhirBundle, mappings.eicrReleaseVersion)[0];
console.log(releaseVersion);
if (releaseVersion === "2016-12-01") {
return "R1.1 (2016-12-01)";
} else if (releaseVersion === "2021-01-01") {
return "R3.1 (2021-01-01)";
} else {
return releaseVersion;
}
};

const eicrDetails: DisplayDataProps[] = [
{
Expand All @@ -71,57 +68,28 @@ export const evaluateEcrMetadata = (
"Unique document ID for the eICR that originates from the medical record. Different from the Document ID that NBS creates for all incoming records.",
value: evaluate(fhirBundle, mappings.eicrIdentifier)[0],
},
{
title: "Document Author",
value: custodian?.name,
},
{
title: "Author Address",
value: formatAddress(
custodian?.address?.[0].line ?? [],
custodian?.address?.[0].city ?? "",
custodian?.address?.[0].state ?? "",
custodian?.address?.[0].postalCode ?? "",
custodian?.address?.[0].country ?? "",
),
},
{
title: "Author Contact",
value: formatContactPoint(custodian?.telecom).join("\n"),
},
];
const ecrSenderDetails: DisplayDataProps[] = [
{
title: "Date/Time eCR Created",
value: formatDateTime(
evaluate(fhirBundle, mappings.dateTimeEcrCreated)[0],
),
},
{
title: "Sender Software",
toolTip: "EHR system used by the sending provider.",
value: evaluate(fhirBundle, mappings.senderSoftware)[0],
},
{
title: "Sender Facility Name",
value: evaluate(fhirBundle, mappings.senderFacilityName)[0],
},
{
title: "Facility Address",
value: evaluateFacilityAddress(fhirBundle, mappings),
title: "eICR Release Version",
value: eicrReleaseVersion(fhirBundle, mappings),
},
{
title: "Facility Contact",
value: evaluate(fhirBundle, mappings.facilityContact)[0],
title: "EHR Software Name",
toolTip: "EHR system used by the sending provider.",
value: evaluate(fhirBundle, mappings.ehrSoftware)[0],
},
{
title: "Facility ID",
value: evaluateFacilityId(fhirBundle, mappings),
title: "EHR Manufacturer Model Name",
value: evaluate(fhirBundle, mappings.ehrManufacturerModel)[0],
},
];
return {
eicrDetails: evaluateData(eicrDetails),
ecrSenderDetails: evaluateData(ecrSenderDetails),
rrDetails: reportableConditionsList,
};
};
46 changes: 46 additions & 0 deletions containers/ecr-viewer/src/app/tests/assets/BundleEcrMetadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
{
"url": "http://hl7.org/fhir/StructureDefinition/composition-clinicaldocument-versionNumber",
"valueString": "2"
},
{
"url": "https://www.hl7.org/implement/standards/product_brief.cfm?product_id=436",
"valueString": "2016-12-01"
}
],
"status": "final",
Expand Down Expand Up @@ -440,6 +444,48 @@
"url": "Composition/1.2.840.114350.1.13.478.3.7.8.688883.230886"
}
},
{
"fullUrl": "urn:uuid:a57ef88d-1c60-d952-e7ca-5e9e16c7ef05",
"resource": {
"resourceType": "Device",
"id": "a57ef88d-1c60-d952-e7ca-5e9e16c7ef05",
"identifier": [
{
"system": "urn:oid:1.2.840.114350.1.1",
"value": "10.1"
}
],
"manufacturer": "Epic - Version 10.1",
"version": [
{
"value": "Epic - Version 10.1"
}
],
"property": [
{
"type": {
"coding": [
{
"system": "http://hl7.org/fhir/device-category",
"code": "software",
"display": "software"
}
]
}
}
],
"owner": {
"reference": "Organization/d319a926-0eb3-5847-3b21-db8b778b4f07"
},
"meta": {
"source": "ecr"
}
},
"request": {
"method": "PUT",
"url": "Device/a57ef88d-1c60-d952-e7ca-5e9e16c7ef05"
}
},
{
"fullUrl": "urn:uuid:21e7aca1-7a03-43dc-15e6-8f7ee24b6613",
"resource": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,40 +34,19 @@ describe("ECR Metadata", () => {
title: "eICR Identifier",
value: "1dd10047-2207-4eac-a993-0f706c88be5d",
},
];
const ecrSenderDetails: DisplayDataProps[] = [
{
title: "Date/Time eCR Created",
value: "2022-05-14T12:56:38Z",
},
{ title: "eICR Release Version", value: "R1.1 (2016-12-01)" },
{
title: "Sender Software",
value: "",
},
{
title: "Sender Facility Name",
value: "PRM- Palmdale Regional Medical Center",
},
{
title: "Facility Address",
value: "38600 Medical Center Drive\nPalmdale, CA\n93551, USA",
},
{
title: "Facility Contact",
value: "(661)382-5000",
},
{
title: "Facility ID",
value: "2.16.840.1.113883.4.6",
title: "EHR Software Name",
value: "Epic - Version 10.1",
},
{ title: "EHR Manufacturer Model Name", value: "Epic - Version 10.1" },
];

container = render(
<EcrMetadata
eicrDetails={eicrDetails}
eCRSenderDetails={ecrSenderDetails}
rrDetails={rrConditionsList}
/>,
<EcrMetadata eicrDetails={eicrDetails} rrDetails={rrConditionsList} />,
).container;
});
it("should match snapshot", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe("UnavailableInfo", () => {
];
const ecrMetadata = [
{
title: "Sender Software",
title: "EHR Software Name",
value: "",
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1301,45 +1301,7 @@ exports[`Snapshot test for Accordion Content Given no data, info message for emp
<div
class="data-title padding-right-1"
>
Document Author
</div>
<div
class="grid-col maxw7 text-pre-line text-italic text-base"
>
No data
</div>
</div>
<div
class="section__line_gray"
/>
</div>
<div>
<div
class="grid-row"
>
<div
class="data-title padding-right-1"
>
Author Address
</div>
<div
class="grid-col maxw7 text-pre-line text-italic text-base"
>
No data
</div>
</div>
<div
class="section__line_gray"
/>
</div>
<div>
<div
class="grid-row"
>
<div
class="data-title padding-right-1"
>
Author Contact
Date/Time eCR Created
</div>
<div
class="grid-col maxw7 text-pre-line text-italic text-base"
Expand All @@ -1358,7 +1320,7 @@ exports[`Snapshot test for Accordion Content Given no data, info message for emp
<div
class="data-title padding-right-1"
>
Date/Time eCR Created
eICR Release Version
</div>
<div
class="grid-col maxw7 text-pre-line text-italic text-base"
Expand Down Expand Up @@ -1388,7 +1350,7 @@ exports[`Snapshot test for Accordion Content Given no data, info message for emp
tabindex="0"
title=""
>
Sender Software
EHR Software Name
</div>
<span
aria-hidden="true"
Expand Down Expand Up @@ -1418,64 +1380,7 @@ exports[`Snapshot test for Accordion Content Given no data, info message for emp
<div
class="data-title padding-right-1"
>
Sender Facility Name
</div>
<div
class="grid-col maxw7 text-pre-line text-italic text-base"
>
No data
</div>
</div>
<div
class="section__line_gray"
/>
</div>
<div>
<div
class="grid-row"
>
<div
class="data-title padding-right-1"
>
Facility Address
</div>
<div
class="grid-col maxw7 text-pre-line text-italic text-base"
>
No data
</div>
</div>
<div
class="section__line_gray"
/>
</div>
<div>
<div
class="grid-row"
>
<div
class="data-title padding-right-1"
>
Facility Contact
</div>
<div
class="grid-col maxw7 text-pre-line text-italic text-base"
>
No data
</div>
</div>
<div
class="section__line_gray"
/>
</div>
<div>
<div
class="grid-row"
>
<div
class="data-title padding-right-1"
>
Facility ID
EHR Manufacturer Model Name
</div>
<div
class="grid-col maxw7 text-pre-line text-italic text-base"
Expand Down
Loading

0 comments on commit 7cc33c9

Please sign in to comment.