Skip to content

Commit

Permalink
Update ecr summary (#2722)
Browse files Browse the repository at this point in the history
* Update ecr summary

* undo changes carried over from other branch

* [pre-commit.ci] auto fixes from pre-commit hooks

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 137083d commit 2486489
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 65 deletions.
25 changes: 12 additions & 13 deletions containers/ecr-viewer/src/app/services/ecrSummaryService.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
evaluatePatientName,
evaluatePatientContactInfo,
evaluatePatientAddress,
evaluateFacilityAddress,
} from "./evaluateFhirDataService";
import { DisplayDataProps } from "@/app/view-data/components/DataDisplay";
import { returnProblemsTable } from "@/app/view-data/components/common";
Expand Down Expand Up @@ -62,6 +61,10 @@ export const evaluateEcrSummaryPatientDetails = (
value:
formatDate(evaluate(fhirBundle, fhirPathMappings.patientDOB)[0]) || "",
},
{
title: "Sex",
value: evaluate(fhirBundle, fhirPathMappings.patientGender)[0],
},
{
title: "Patient Address",
value: evaluatePatientAddress(fhirBundle, fhirPathMappings),
Expand All @@ -84,18 +87,6 @@ export const evaluateEcrSummaryEncounterDetails = (
fhirPathMappings: PathMappings,
) => {
return evaluateData([
{
title: "Facility Name",
value: evaluate(fhirBundle, fhirPathMappings.facilityName),
},
{
title: "Facility Address",
value: evaluateFacilityAddress(fhirBundle, fhirPathMappings),
},
{
title: "Facility Contact",
value: evaluate(fhirBundle, fhirPathMappings.facilityContact),
},
{
title: "Encounter Date/Time",
value: evaluateEncounterDate(fhirBundle, fhirPathMappings),
Expand All @@ -104,6 +95,14 @@ export const evaluateEcrSummaryEncounterDetails = (
title: "Encounter Type",
value: evaluate(fhirBundle, fhirPathMappings.encounterType),
},
{
title: "Facility Name",
value: evaluate(fhirBundle, fhirPathMappings.facilityName),
},
{
title: "Facility Contact",
value: evaluate(fhirBundle, fhirPathMappings.facilityContact),
},
]);
};

Expand Down
27 changes: 0 additions & 27 deletions containers/ecr-viewer/src/app/services/evaluateFhirDataService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,33 +96,6 @@ export const evaluateEncounterId = (
return filteredIds[0] ?? "";
};

/**
* Evaluates facility address from the FHIR bundle and formats it into structured data for display.
* @param fhirBundle - The FHIR bundle containing patient contact info.
* @param mappings - The object containing the fhir paths.
* @returns The formatted facility address
*/
export const evaluateFacilityAddress = (
fhirBundle: Bundle,
mappings: PathMappings,
) => {
const locationReference =
evaluate(fhirBundle, mappings.facilityLocation)?.[0] ?? "";
const locationResource = evaluateReference(
fhirBundle,
mappings,
locationReference,
);

const streetAddresses = locationResource?.address?.line;
const city = locationResource?.address?.city;
const state = locationResource?.address?.state;
const zipCode = locationResource?.address?.postalCode;
const country = locationResource?.address?.country;

return formatAddress(streetAddresses, city, state, zipCode, country);
};

/**
* Evaluates patient contact info from the FHIR bundle and formats it into structured data for display.
* @param fhirBundle - The FHIR bundle containing patient contact info.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ describe("EcrSummary", () => {
title: "DOB",
value: "04/15/2015",
},
{
title: "Sex",
value: "male",
},
{
title: "Patient Address",
value: "1050 CARPENTER ST\nEDWARDS, CA\n93523-2800, US",
Expand All @@ -28,10 +32,6 @@ describe("EcrSummary", () => {
title: "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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,25 @@ exports[`EcrSummary should match snapshot 1`] = `
class="section__line_gray"
/>
</div>
<div>
<div
class="grid-row"
>
<div
class="data-title padding-right-1"
>
Sex
</div>
<div
class="grid-col maxw7 text-pre-line"
>
male
</div>
</div>
<div
class="section__line_gray"
/>
</div>
<div>
<div
class="grid-row"
Expand Down Expand Up @@ -130,27 +149,6 @@ MELLY.C.A.16@GMAIL.COM
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"
>
38600 Medical Center Drive
Palmdale, CA
93551, USA
</div>
</div>
<div
class="section__line_gray"
/>
</div>
<div>
<div
class="grid-row"
Expand Down

0 comments on commit 2486489

Please sign in to comment.